@pega/custom-dx-components 0.24.2 → 0.24.4

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 (101) hide show
  1. package/package.json +1 -1
  2. package/src/tasks/create/templates/Constellation/Field/Picklist-Autocomplete/index.tsx.mustache +11 -0
  3. package/src/tasks/create/templates/Constellation/Field/Picklist-Autocomplete/utils.ts.mustache +3 -0
  4. package/src/tasks/create/templates/Constellation/Template/DETAILS/DetailsRender.tsx +52 -0
  5. package/src/tasks/create/templates/Constellation/Template/DETAILS/HighlightRender.tsx +50 -0
  6. package/src/tasks/create/templates/Constellation/Template/DETAILS/index.tsx.mustache +42 -21
  7. package/src/tasks/create/templates/Constellation/Template/DETAILS-region/DetailsRender.tsx +52 -0
  8. package/src/tasks/create/templates/Constellation/Template/DETAILS-region/HighlightRender.tsx +50 -0
  9. package/src/tasks/create/templates/Constellation/Template/DETAILS-region/index.tsx.mustache +41 -20
  10. package/src/tasks/create/templates/Constellation/Template/PAGE/GetNextWork.tsx.mustache +2 -1
  11. package/src/tasks/init/template/package.json.mustache +4 -4
  12. package/tests/assets/components/create/Pega_DXIL_MyDetails.zip +0 -0
  13. package/tests/assets/components/create/Pega_DXIL_MyTestText/demo.stories.tsx +0 -3
  14. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyBoolean/demo.stories.tsx +3 -13
  15. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyBoolean/index.tsx +8 -5
  16. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyCaseWidget/demo.stories.tsx +3 -2
  17. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyCurrency/demo.stories.tsx +2 -9
  18. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyCurrency/mock.ts +2 -0
  19. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDate/demo.stories.tsx +8 -19
  20. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDateTime/demo.stories.tsx +7 -18
  21. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDateTime/mock.ts +1 -0
  22. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDecimal/demo.stories.tsx +1 -7
  23. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDecimal/mock.ts +1 -0
  24. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDetails/DetailsRender.tsx +52 -0
  25. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDetails/HighlightRender.tsx +50 -0
  26. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDetails/demo.stories.tsx +5 -5
  27. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDetails/index.tsx +42 -21
  28. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDetails.zip +0 -0
  29. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyEmail/demo.stories.tsx +1 -5
  30. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyForm/demo.stories.tsx +5 -3
  31. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyInteger/demo.stories.tsx +2 -6
  32. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPage/GetNextWork.tsx +2 -1
  33. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPage/demo.stories.tsx +4 -3
  34. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPageCaseWidget/demo.stories.tsx +5 -4
  35. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPageWidget/demo.stories.tsx +5 -8
  36. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyParagraph/demo.stories.tsx +1 -5
  37. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyParagraph/mock.ts +1 -0
  38. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPercentage/demo.stories.tsx +2 -6
  39. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPercentage/mock.ts +1 -0
  40. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPhone/demo.stories.tsx +2 -5
  41. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPhone/mock.ts +1 -0
  42. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPicklist/demo.stories.tsx +2 -6
  43. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPicklist/mock.ts +1 -0
  44. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyRadioButtons/demo.stories.tsx +1 -7
  45. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MySearchbox/demo.stories.tsx +2 -8
  46. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MySearchbox/index.tsx +11 -0
  47. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MySearchbox/utils.ts +3 -0
  48. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyText/demo.stories.tsx +0 -3
  49. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTextInput/demo.stories.tsx +1 -5
  50. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTextInput/mock.ts +1 -0
  51. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTimeOfDay/demo.stories.tsx +5 -15
  52. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTwoColumnDetails/DetailsRender.tsx +52 -0
  53. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTwoColumnDetails/HighlightRender.tsx +50 -0
  54. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTwoColumnDetails/demo.stories.tsx +5 -5
  55. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTwoColumnDetails/index.tsx +41 -20
  56. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTwoColumnForm/demo.stories.tsx +4 -2
  57. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyURL/demo.stories.tsx +1 -5
  58. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyURL/mock.ts +1 -0
  59. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyBoolean/demo.stories.tsx +3 -13
  60. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyBoolean/index.tsx +8 -5
  61. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyCurrency/demo.stories.tsx +2 -9
  62. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyCurrency/mock.ts +2 -0
  63. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDate/demo.stories.tsx +8 -19
  64. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDateTime/demo.stories.tsx +7 -18
  65. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDateTime/mock.ts +1 -0
  66. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDecimal/demo.stories.tsx +1 -7
  67. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDecimal/mock.ts +1 -0
  68. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDetails/DetailsRender.tsx +52 -0
  69. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDetails/HighlightRender.tsx +50 -0
  70. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDetails/demo.stories.tsx +5 -5
  71. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDetails/index.tsx +42 -21
  72. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDetails.zip +0 -0
  73. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyEmail/demo.stories.tsx +1 -5
  74. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyForm/demo.stories.tsx +5 -3
  75. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyInteger/demo.stories.tsx +2 -6
  76. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPage/GetNextWork.tsx +2 -1
  77. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPage/demo.stories.tsx +4 -3
  78. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPageWidget/demo.stories.tsx +5 -8
  79. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyParagraph/demo.stories.tsx +1 -5
  80. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyParagraph/mock.ts +1 -0
  81. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPercentage/demo.stories.tsx +2 -6
  82. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPercentage/mock.ts +1 -0
  83. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPhone/demo.stories.tsx +2 -5
  84. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPhone/mock.ts +1 -0
  85. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPicklist/demo.stories.tsx +2 -6
  86. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPicklist/mock.ts +1 -0
  87. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyRadioButtons/demo.stories.tsx +1 -7
  88. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MySearchbox/demo.stories.tsx +2 -8
  89. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MySearchbox/index.tsx +11 -0
  90. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MySearchbox/utils.ts +3 -0
  91. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyText/demo.stories.tsx +0 -3
  92. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTextInput/demo.stories.tsx +1 -5
  93. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTextInput/mock.ts +1 -0
  94. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTimeOfDay/demo.stories.tsx +5 -15
  95. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnDetails/DetailsRender.tsx +52 -0
  96. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnDetails/HighlightRender.tsx +50 -0
  97. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnDetails/demo.stories.tsx +5 -5
  98. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnDetails/index.tsx +41 -20
  99. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnForm/demo.stories.tsx +4 -2
  100. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyURL/demo.stories.tsx +1 -5
  101. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyURL/mock.ts +1 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pega/custom-dx-components",
3
- "version": "0.24.2",
3
+ "version": "0.24.4",
4
4
  "description": "Utility for building custom UI components",
5
5
  "bin": "./bin/index.js",
6
6
  "scripts": {
@@ -645,12 +645,14 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
645
645
  PCore.getDataApi()
646
646
  .init(dataConfig, contextName)
647
647
  .then(dataObj => {
648
+ // @ts-ignore
648
649
  setDataApiObj(dataObj);
649
650
  // To avoid calling doSearch if someone types/pastes value before the API call is made
650
651
  if (!filterValue)
651
652
  doSearch(
652
653
  '',
653
654
  getDisplayFieldsMetaData(dataConfig.columns),
655
+ // @ts-ignore
654
656
  dataObj,
655
657
  setItems as any,
656
658
  setLoading,
@@ -677,6 +679,7 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
677
679
  PCore.getDataApi()
678
680
  .init(dataConfig, contextName)
679
681
  .then(dataObj => {
682
+ // @ts-ignore
680
683
  setDataApiObj(dataObj);
681
684
  // To avoid calling doSearch if someone types/pastes value before the API call is made
682
685
  if (!filterValue) {
@@ -692,6 +695,7 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
692
695
  doSearch(
693
696
  '',
694
697
  getDisplayFieldsMetaData(dataConfig.columns),
698
+ // @ts-ignore
695
699
  dataObj,
696
700
  setItems as any,
697
701
  setLoading,
@@ -711,6 +715,7 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
711
715
  doSearch(
712
716
  '',
713
717
  getDisplayFieldsMetaData(dataConfig.columns),
718
+ // @ts-ignore
714
719
  dataObj,
715
720
  setItems as any,
716
721
  setLoading,
@@ -770,10 +775,14 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
770
775
  PCore.getDataApi()
771
776
  .init(dataConfig, contextName)
772
777
  .then(dataObj => {
778
+ // @ts-ignore
773
779
  setDataApiObj(dataObj);
780
+ // @ts-ignore
774
781
  buildColumnForDisplayValue(dataObj);
775
782
  // SET matchPosition to EQUALS to return exact matching record
783
+ // @ts-ignore
776
784
  dataObj.matchPosition = 'equals';
785
+ // @ts-ignore
777
786
  dataObj
778
787
  .fetchData(value)
779
788
  .then((displayResponse: { data: Array<never> }) => {
@@ -822,11 +831,13 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
822
831
  setSelected(searchedItem[0]);
823
832
  setActualValue(value);
824
833
  // RESET matchPosition
834
+ // @ts-ignore
825
835
  dataObj.matchPosition = dataConfig.matchPosition;
826
836
  })
827
837
  .catch(() => {
828
838
  setActualValue(value);
829
839
  // RESET matchPosition
840
+ // @ts-ignore
830
841
  dataObj.matchPosition = dataConfig.matchPosition;
831
842
  });
832
843
  });
@@ -181,7 +181,9 @@ export const updatePropertiesForNewRecord = (
181
181
  setDataApiObj(dataObj);
182
182
  buildColumnForDisplayValue(dataObj);
183
183
  // SET matchPosition to EQUALS to return exact matching record
184
+ // @ts-ignore
184
185
  dataObj.matchPosition = 'equals';
186
+ // @ts-ignore
185
187
  dataObj
186
188
  .fetchData(newCaseId)
187
189
  // @ts-ignore
@@ -212,6 +214,7 @@ export const updatePropertiesForNewRecord = (
212
214
  })
213
215
  .finally(() => {
214
216
  // RESET matchPosition
217
+ // @ts-ignore
215
218
  dataObj.matchPosition = dataConfig.matchPosition;
216
219
  });
217
220
  });
@@ -0,0 +1,52 @@
1
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
2
+ import React, { Fragment } from 'react';
3
+ import { FieldValueList } from '@pega/cosmos-react-core';
4
+
5
+ const DetailsRender = (child: any) => {
6
+ const kids = child.props.getPConnect().getChildren();
7
+
8
+ const displayCompArr: JSX.Element[] = [];
9
+
10
+ Object.values(kids).forEach((value: any) => {
11
+ const { type } = value.getPConnect().getRawMetadata();
12
+ const { hideLabel, variant, testId, label } = value
13
+ .getPConnect()
14
+ .resolveConfigProps(value.getPConnect().getConfigProps());
15
+
16
+ let displayComp;
17
+ const key = JSON.stringify(value.getPConnect());
18
+
19
+ if (type === 'reference') {
20
+ const refElement = value.getPConnect().getComponent();
21
+
22
+ displayCompArr.push(refElement);
23
+ } else {
24
+ const element = value.getPConnect().getComponent();
25
+ const displayEl = <Fragment key={key}>{element}</Fragment>;
26
+
27
+ const fvlStyle = {
28
+ myColGap: {
29
+ columnGap: '0'
30
+ }
31
+ };
32
+
33
+ // const myEl = <div>boo</div>;
34
+ displayComp = (
35
+ <Fragment key={key}>
36
+ <FieldValueList
37
+ style={fvlStyle.myColGap}
38
+ variant={hideLabel ? 'stacked' : variant}
39
+ data-testid={testId}
40
+ fields={[{ id: '1', name: hideLabel ? '' : label, value: displayEl }]}
41
+ />
42
+ </Fragment>
43
+ );
44
+
45
+ displayCompArr.push(displayComp);
46
+ }
47
+ });
48
+
49
+ return <>{displayCompArr}</>;
50
+ };
51
+
52
+ export default DetailsRender;
@@ -0,0 +1,50 @@
1
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
2
+ import React from 'react';
3
+ import { FieldValueList, Text } from '@pega/cosmos-react-core';
4
+
5
+ const HighlightRender = (data: any) => {
6
+ const { getPConnect } = data.props;
7
+ const { field } = data;
8
+
9
+ field.config['displayMode'] = 'DISPLAY_ONLY';
10
+
11
+ // Mark as status display when using pyStatusWork
12
+ if (field.config?.value === '@P .pyStatusWork') {
13
+ field.type = 'TextInput';
14
+ field.config.displayAsStatus = true;
15
+ }
16
+
17
+ const configProps = getPConnect().resolveConfigProps(field.config);
18
+
19
+ // field.config = configProps;
20
+
21
+ const reactField = getPConnect().createComponent(field);
22
+ // const reactField = field.getPConnect().getComponent();
23
+
24
+ const styles = {
25
+ myWidth: {
26
+ width: 'auto'
27
+ }
28
+ };
29
+
30
+ return (
31
+ <FieldValueList
32
+ style={styles.myWidth}
33
+ variant='stacked'
34
+ data-testid={field.testId}
35
+ fields={[
36
+ {
37
+ id: '2',
38
+ name: configProps.hideLabel ? '' : configProps.label,
39
+ value: (
40
+ <Text variant='h1' as='span'>
41
+ {reactField}
42
+ </Text>
43
+ )
44
+ }
45
+ ]}
46
+ />
47
+ );
48
+ };
49
+
50
+ export default HighlightRender;
@@ -1,6 +1,8 @@
1
1
  import { Fragment } from 'react';
2
2
  import { Grid, Flex, FieldGroup, withConfiguration } from '@pega/cosmos-react-core';
3
3
  import type { PConnFieldProps } from './PConnProps';
4
+ import DetailsRender from './DetailsRender';
5
+ import HighlightRender from './HighlightRender';
4
6
 
5
7
  import Styled{{COMPONENT_CLASS_NAME}}Wrapper from './styles';
6
8
 
@@ -16,8 +18,6 @@ interface {{COMPONENT_CLASS_NAME}}Props extends PConnFieldProps {
16
18
  children: any;
17
19
  }
18
20
 
19
- // Duplicated runtime code from Constellation Design System Component
20
-
21
21
  // props passed in combination of props from property panel (config.json) and run time props from Constellation
22
22
  // any default values in config.pros should be set in defaultProps at bottom of this file
23
23
  function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
@@ -25,9 +25,17 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
25
25
  const { getPConnect, children, label, showLabel = true, showHighlightedData = false } = props;
26
26
  const propsToUse = { label, showLabel, ...getPConnect().getInheritedProps() };
27
27
 
28
+ // update children with readonly
29
+ // eslint-disable-next-line guard-for-in
30
+ for (const index in children) {
31
+ const kid = children[index];
32
+ kid.props.getPConnect().setInheritedProp('readOnly', true);
33
+ kid.props.getPConnect().setInheritedProp('displayMode', 'DISPLAY_ONLY');
34
+ }
35
+
28
36
  const numRegions = getAllFields(getPConnect)?.length;
29
37
  const gridRepeat = "repeat(".concat(numRegions).concat(", 1fr)");
30
- const gridContainer = { "colGap": 1};
38
+ const gridContainer = { "colGap": 0};
31
39
  // @ts-ignore
32
40
  gridContainer.cols = gridRepeat;
33
41
  // @ts-ignore
@@ -37,7 +45,7 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
37
45
  // @ts-ignore
38
46
  gridHighlightContainer.cols = gridRepeat;
39
47
  // @ts-ignore
40
- gridHighlightContainer.alignItems = 'start';
48
+ gridHighlightContainer.alignItems = 'flex-start';
41
49
  // @ts-ignore
42
50
  gridHighlightContainer.pad = [0, 0, 2, 0];
43
51
 
@@ -48,35 +56,48 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
48
56
  const { highlightedData = [] } = getPConnect().getRawMetadata().config;
49
57
  // @ts-ignore
50
58
  highlightedDataArr = highlightedData.map((field) => {
51
- field.config.displayMode = 'STACKED_LARGE_VAL';
52
-
53
- // Mark as status display when using pyStatusWork
54
- if (field.config.value === '@P .pyStatusWork') {
55
- field.type = 'TextInput';
56
- field.config.displayAsStatus = true;
57
- }
58
- // @ts-ignore
59
- return getPConnect().createComponent(field);
59
+ // field.config.displayMode = 'STACKED_LARGE_VAL';
60
+
61
+ // // Mark as status display when using pyStatusWork
62
+ // if (field.config.value === '@P .pyStatusWork') {
63
+ // field.type = 'TextInput';
64
+ // field.config.displayAsStatus = true;
65
+ // }
66
+ // // @ts-ignore
67
+ // return getPConnect().createComponent(field);
68
+ return <HighlightRender field={field} props={props} />;
60
69
  });
61
70
  }
62
71
 
72
+ const hrStyle = {
73
+ line: {
74
+ margin: '0.75rem 0',
75
+ opacity: '50%'
76
+ }
77
+ };
78
+
63
79
  return (
64
80
  <Styled{{COMPONENT_CLASS_NAME}}Wrapper>
65
81
  {{! pick new delimiters for mustache }}
66
82
  {{=<% %>=}}
67
83
  <FieldGroup name={propsToUse.showLabel ? propsToUse.label : ''}>
68
84
  {showHighlightedData && highlightedDataArr.length > 0 && (
69
- <Grid container={gridHighlightContainer}
70
- data-testid={`highlighted-column-count-${numRegions}`}>
71
- {highlightedDataArr.map((child: any, i: number) => (
72
- <Fragment key={`hf-${i + 1}`}>{child}</Fragment>
73
- ))}
74
- </Grid>
85
+ <>
86
+ <Flex
87
+ container={{ direction: 'row', alignItems: 'start', colGap: 10 }}
88
+ data-testid={`highlighted-column-count-${numRegions}`}
89
+ >
90
+ {highlightedDataArr.map((child: any, i: number) => (
91
+ <Fragment key={`hf-${i + 1}`}>{child}</Fragment>
92
+ ))}
93
+ </Flex>
94
+ <hr style={hrStyle.line} />
95
+ </>
75
96
  )}
76
97
  <Grid container={gridContainer} data-testid={`column-count-${numRegions}`} >
77
98
  {children.map((child: any, i: number) => (
78
- <Flex container={{ direction: 'column'}} key={`r-${i + 1}`}>
79
- {child}
99
+ <Flex container={{ direction: 'column', alignItems: 'start', colGap: 0, rowGap: 1.5 }} key={`r-${i + 1}`}>
100
+ <DetailsRender {...child} />
80
101
  </Flex>
81
102
  ))}
82
103
  </Grid>
@@ -0,0 +1,52 @@
1
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
2
+ import React, { Fragment } from 'react';
3
+ import { FieldValueList } from '@pega/cosmos-react-core';
4
+
5
+ const DetailsRender = (child: any) => {
6
+ const kids = child.props.getPConnect().getChildren();
7
+
8
+ const displayCompArr: JSX.Element[] = [];
9
+
10
+ Object.values(kids).forEach((value: any) => {
11
+ const { type } = value.getPConnect().getRawMetadata();
12
+ const { hideLabel, variant, testId, label } = value
13
+ .getPConnect()
14
+ .resolveConfigProps(value.getPConnect().getConfigProps());
15
+
16
+ let displayComp;
17
+ const key = JSON.stringify(value.getPConnect());
18
+
19
+ if (type === 'reference') {
20
+ const refElement = value.getPConnect().getComponent();
21
+
22
+ displayCompArr.push(refElement);
23
+ } else {
24
+ const element = value.getPConnect().getComponent();
25
+ const displayEl = <Fragment key={key}>{element}</Fragment>;
26
+
27
+ const fvlStyle = {
28
+ myColGap: {
29
+ columnGap: '0'
30
+ }
31
+ };
32
+
33
+ // const myEl = <div>boo</div>;
34
+ displayComp = (
35
+ <Fragment key={key}>
36
+ <FieldValueList
37
+ style={fvlStyle.myColGap}
38
+ variant={hideLabel ? 'stacked' : variant}
39
+ data-testid={testId}
40
+ fields={[{ id: '1', name: hideLabel ? '' : label, value: displayEl }]}
41
+ />
42
+ </Fragment>
43
+ );
44
+
45
+ displayCompArr.push(displayComp);
46
+ }
47
+ });
48
+
49
+ return <>{displayCompArr}</>;
50
+ };
51
+
52
+ export default DetailsRender;
@@ -0,0 +1,50 @@
1
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
2
+ import React from 'react';
3
+ import { FieldValueList, Text } from '@pega/cosmos-react-core';
4
+
5
+ const HighlightRender = (data: any) => {
6
+ const { getPConnect } = data.props;
7
+ const { field } = data;
8
+
9
+ field.config['displayMode'] = 'DISPLAY_ONLY';
10
+
11
+ // Mark as status display when using pyStatusWork
12
+ if (field.config?.value === '@P .pyStatusWork') {
13
+ field.type = 'TextInput';
14
+ field.config.displayAsStatus = true;
15
+ }
16
+
17
+ const configProps = getPConnect().resolveConfigProps(field.config);
18
+
19
+ // field.config = configProps;
20
+
21
+ const reactField = getPConnect().createComponent(field);
22
+ // const reactField = field.getPConnect().getComponent();
23
+
24
+ const styles = {
25
+ myWidth: {
26
+ width: 'auto'
27
+ }
28
+ };
29
+
30
+ return (
31
+ <FieldValueList
32
+ style={styles.myWidth}
33
+ variant='stacked'
34
+ data-testid={field.testId}
35
+ fields={[
36
+ {
37
+ id: '2',
38
+ name: configProps.hideLabel ? '' : configProps.label,
39
+ value: (
40
+ <Text variant='h1' as='span'>
41
+ {reactField}
42
+ </Text>
43
+ )
44
+ }
45
+ ]}
46
+ />
47
+ );
48
+ };
49
+
50
+ export default HighlightRender;
@@ -1,6 +1,8 @@
1
1
  import { Fragment } from 'react';
2
2
  import { Grid, Flex, FieldGroup, withConfiguration } from '@pega/cosmos-react-core';
3
3
  import type { PConnFieldProps } from './PConnProps';
4
+ import DetailsRender from './DetailsRender';
5
+ import HighlightRender from './HighlightRender';
4
6
 
5
7
  import Styled{{COMPONENT_CLASS_NAME}}Wrapper from './styles';
6
8
 
@@ -15,8 +17,6 @@ interface {{COMPONENT_CLASS_NAME}}Props extends PConnFieldProps {
15
17
  children: any;
16
18
  }
17
19
 
18
- // Duplicated runtime code from Constellation Design System Component
19
-
20
20
  // props passed in combination of props from property panel (config.json) and run time props from Constellation
21
21
  // any default values in config.pros should be set in defaultProps at bottom of this file
22
22
  function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
@@ -24,9 +24,17 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
24
24
  const { getPConnect, children, label, showLabel = true, showHighlightedData = false } = props;
25
25
  const propsToUse = { label, showLabel, ...getPConnect().getInheritedProps() };
26
26
 
27
+ // update children with readonly
28
+ // eslint-disable-next-line guard-for-in
29
+ for (const index in children) {
30
+ const kid = children[index];
31
+ kid.props.getPConnect().setInheritedProp('readOnly', true);
32
+ kid.props.getPConnect().setInheritedProp('displayMode', 'DISPLAY_ONLY');
33
+ }
34
+
27
35
  const numRegions = getAllFields(getPConnect)?.length;
28
36
  const gridRepeat = "repeat(".concat(numRegions).concat(", 1fr)");
29
- const gridContainer = { "colGap": 1};
37
+ const gridContainer = { "colGap": 0};
30
38
  // @ts-ignore
31
39
  gridContainer.cols = gridRepeat;
32
40
  // @ts-ignore
@@ -36,7 +44,7 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
36
44
  // @ts-ignore
37
45
  gridHighlightContainer.cols = gridRepeat;
38
46
  // @ts-ignore
39
- gridHighlightContainer.alignItems = 'start';
47
+ gridHighlightContainer.alignItems = 'flex-start';
40
48
  // @ts-ignore
41
49
  gridHighlightContainer.pad = [0, 0, 2, 0];
42
50
 
@@ -47,35 +55,48 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
47
55
  const { highlightedData = [] } = getPConnect().getRawMetadata().config;
48
56
  // @ts-ignore
49
57
  highlightedDataArr = highlightedData.map((field) => {
50
- field.config.displayMode = 'STACKED_LARGE_VAL';
58
+ // field.config.displayMode = 'STACKED_LARGE_VAL';
51
59
 
52
- // Mark as status display when using pyStatusWork
53
- if (field.config.value === '@P .pyStatusWork') {
54
- field.type = 'TextInput';
55
- field.config.displayAsStatus = true;
56
- }
57
- // @ts-ignore
58
- return getPConnect().createComponent(field);
60
+ // // Mark as status display when using pyStatusWork
61
+ // if (field.config.value === '@P .pyStatusWork') {
62
+ // field.type = 'TextInput';
63
+ // field.config.displayAsStatus = true;
64
+ // }
65
+ // // @ts-ignore
66
+ // return getPConnect().createComponent(field);
67
+ return <HighlightRender field={field} props={props} />;
59
68
  });
60
69
  }
61
70
 
71
+ const hrStyle = {
72
+ line: {
73
+ margin: '0.75rem 0',
74
+ opacity: '50%'
75
+ }
76
+ };
77
+
62
78
  return (
63
79
  <Styled{{COMPONENT_CLASS_NAME}}Wrapper>
64
80
  {{! pick new delimiters for mustache }}
65
81
  {{=<% %>=}}
66
82
  <FieldGroup name={propsToUse.showLabel ? propsToUse.label : ''}>
67
83
  {showHighlightedData && highlightedDataArr.length > 0 && (
68
- <Grid container={gridHighlightContainer}
69
- data-testid={`highlighted-column-count-${numRegions}`}>
70
- {highlightedDataArr.map((child: any, i: number) => (
71
- <Fragment key={`hf-${i + 1}`}>{child}</Fragment>
72
- ))}
73
- </Grid>
84
+ <>
85
+ <Flex
86
+ container={{ direction: 'row', alignItems: 'start', colGap: 10 }}
87
+ data-testid={`highlighted-column-count-${numRegions}`}
88
+ >
89
+ {highlightedDataArr.map((child: any, i: number) => (
90
+ <Fragment key={`hf-${i + 1}`}>{child}</Fragment>
91
+ ))}
92
+ </Flex>
93
+ <hr style={hrStyle.line} />
94
+ </>
74
95
  )}
75
96
  <Grid container={gridContainer} data-testid={`column-count-${numRegions}`} >
76
97
  {children.map((child: any, i: number) => (
77
- <Flex container={{ direction: 'column'}} key={`r-${i + 1}`}>
78
- {child}
98
+ <Flex container={{ direction: 'column', alignItems: 'start', colGap: 0, rowGap: 1.5 }} key={`r-${i + 1}`}>
99
+ <DetailsRender {...child} />
79
100
  </Flex>
80
101
  ))}
81
102
  </Grid>
@@ -18,6 +18,7 @@ export default function GetNextWork(props: {{COMPONENT_CLASS_NAME}}WorkProps) {
18
18
  const toasterCtx = useToaster();
19
19
 
20
20
  const localizedVal = PCore.getLocaleUtils().getLocaleValue;
21
+ const localeCategory = 'Case';
21
22
 
22
23
  const getNextWork = () => {
23
24
 
@@ -30,7 +31,7 @@ export default function GetNextWork(props: {{COMPONENT_CLASS_NAME}}WorkProps) {
30
31
  console.log(err);
31
32
  if (err[0].status === 404) {
32
33
  toasterCtx.push({
33
- content: localizedVal('No task currently available')
34
+ content: localizedVal('No task currently available', localeCategory)
34
35
  });
35
36
  }
36
37
  });
@@ -58,10 +58,10 @@
58
58
  "lodash.get": "^4.4.2",
59
59
  "polished": "^4.2.2",
60
60
  "prop-types": "^15.8.1",
61
- "react": "^18.2.0",
61
+ "react": "^17.0.2",
62
62
  "react-autosuggest": "^10.1.0",
63
- "react-dom": "^18.2.0",
64
- "react-is": "^18.2.0",
63
+ "react-dom": "^17.0.2",
64
+ "react-is": "^17.0.2",
65
65
  "react-player": "^2.10.1",
66
66
  "react-redux": "^7.2.6",
67
67
  "styled-components": "^5.3.5",
@@ -69,7 +69,7 @@
69
69
  },
70
70
  "devDependencies": {
71
71
  "@pega/configs": "^0.6.0",
72
- "@pega/custom-dx-components": "0.24.2",
72
+ "@pega/custom-dx-components": "0.24.4",
73
73
  "@pega/pcore-pconnect-typedefs": "~2.1.1",
74
74
  "@storybook/addon-actions": "^7.6.7",
75
75
  "@storybook/addon-essentials": "^7.6.7",
@@ -23,9 +23,6 @@ export const BasePegaDxilMyTestText: Story = args => {
23
23
 
24
24
  const props = {
25
25
  value,
26
- placeholder: configProps.placeholder,
27
- label: configProps.label,
28
- testId: configProps.testId,
29
26
  hasSuggestions: configProps.hasSuggestions,
30
27
 
31
28
  getPConnect: () => {
@@ -23,20 +23,7 @@ export const BasePegaDxilMyBoolean: Story = args => {
23
23
 
24
24
  const props = {
25
25
  value,
26
- label: configProps.label,
27
- helperText: configProps.helperText,
28
- caption: configProps.caption,
29
- validatemessage: configProps.validatemessage,
30
- hideLabel: configProps.hideLabel,
31
- testId: configProps.testId,
32
26
  additionalProps: configProps.additionalProps,
33
- displayMode: configProps.displayMode,
34
- variant: configProps.variant,
35
- trueLabel: configProps.trueLabel,
36
- falseLabel: configProps.falseLabel,
37
- disabled: configProps.disabled,
38
- readOnly: configProps.readOnly,
39
- required: configProps.required,
40
27
  getPConnect: () => {
41
28
  return {
42
29
  getStateProps: () => {
@@ -76,6 +63,9 @@ BasePegaDxilMyBoolean.args = {
76
63
  required: configProps.required,
77
64
  status: configProps.status,
78
65
  hideLabel: configProps.hideLabel,
66
+ trueLabel: configProps.trueLabel,
67
+ falseLabel: configProps.falseLabel,
79
68
  displayMode: configProps.displayMode,
69
+ variant: configProps.variant,
80
70
  validatemessage: configProps.validatemessage
81
71
  };
@@ -3,7 +3,8 @@ import {
3
3
  CheckboxGroup,
4
4
  FieldValueList,
5
5
  Text,
6
- withConfiguration
6
+ withConfiguration,
7
+ BooleanDisplay
7
8
  } from "@pega/cosmos-react-core";
8
9
 
9
10
  import type { PConnFieldProps } from './PConnProps';
@@ -96,15 +97,17 @@ function PegaDxilMyBoolean(props: PegaDxilMyBooleanProps) {
96
97
 
97
98
  let displayComponent;
98
99
  if (displayMode) {
99
- // @ts-ignore
100
100
  displayComponent = (
101
- // @ts-ignore
102
- <PegaDxilMyBoolean value={value} trueLabel={trueLabel} falseLabel={falseLabel} />
101
+ <BooleanDisplay value={value} trueLabel={trueLabel} falseLabel={falseLabel} />
103
102
  );
104
103
  }
105
104
 
106
105
  if (displayMode === 'DISPLAY_ONLY') {
107
- return ( <StyledPegaDxilMyBooleanWrapper> {displayComponent} </StyledPegaDxilMyBooleanWrapper>);
106
+ return (
107
+ <StyledPegaDxilMyBooleanWrapper>
108
+ {displayComponent}
109
+ </StyledPegaDxilMyBooleanWrapper>
110
+ );
108
111
  }
109
112
 
110
113
  if (displayMode === "LABELS_LEFT") {
@@ -49,7 +49,6 @@ window.PCore.getDataApiUtils = () => {
49
49
  export const BasePegaDxilMyCaseWidget: Story = args => {
50
50
 
51
51
  const props = {
52
- label: 'Case history',
53
52
 
54
53
  getPConnect: () => {
55
54
  return {
@@ -83,4 +82,6 @@ return (
83
82
  );
84
83
  };
85
84
 
86
- BasePegaDxilMyCaseWidget.args = {};
85
+ BasePegaDxilMyCaseWidget.args = {
86
+ label: 'Case history',
87
+ };