@pega/custom-dx-components 0.24.3 → 0.24.5

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 (119) hide show
  1. package/package.json +1 -1
  2. package/src/tasks/bundle/builder/webpack.config.js +15 -1
  3. package/src/tasks/create/templates/Constellation/Field/Picklist-Autocomplete/index.tsx.mustache +11 -0
  4. package/src/tasks/create/templates/Constellation/Field/Picklist-Autocomplete/utils.ts.mustache +3 -0
  5. package/src/tasks/create/templates/Constellation/Field/Text/index.tsx.mustache +94 -4
  6. package/src/tasks/create/templates/Constellation/Template/DETAILS/DetailsRender.tsx +58 -0
  7. package/src/tasks/create/templates/Constellation/Template/DETAILS/HighlightRender.tsx +50 -0
  8. package/src/tasks/create/templates/Constellation/Template/DETAILS/index.tsx.mustache +38 -24
  9. package/src/tasks/create/templates/Constellation/Template/DETAILS-region/DetailsRender.tsx +58 -0
  10. package/src/tasks/create/templates/Constellation/Template/DETAILS-region/HighlightRender.tsx +50 -0
  11. package/src/tasks/create/templates/Constellation/Template/DETAILS-region/index.tsx.mustache +45 -23
  12. package/src/tasks/create/templates/Constellation/Template/FORM/DetailsRender.tsx +58 -0
  13. package/src/tasks/create/templates/Constellation/Template/FORM/index.tsx.mustache +31 -5
  14. package/src/tasks/create/templates/Constellation/Template/FORM-region/DetailsRender.tsx +58 -0
  15. package/src/tasks/create/templates/Constellation/Template/FORM-region/index.tsx.mustache +28 -6
  16. package/src/tasks/create/templates/Constellation/Template/PAGE/GetNextWork.tsx.mustache +2 -1
  17. package/src/tasks/init/template/package.json.mustache +1 -1
  18. package/src/tasks/init/template/tsconfig.build.json +3 -1
  19. package/tests/assets/components/create/Pega_DXIL_MyDetails.zip +0 -0
  20. package/tests/assets/components/create/Pega_DXIL_MyTestText/demo.stories.tsx +0 -3
  21. package/tests/assets/components/create/Pega_DXIL_MyTestText/index.tsx +94 -4
  22. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyBoolean/demo.stories.tsx +3 -13
  23. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyBoolean/index.tsx +8 -5
  24. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyCaseWidget/demo.stories.tsx +3 -2
  25. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyCurrency/demo.stories.tsx +2 -9
  26. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyCurrency/mock.ts +2 -0
  27. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDate/demo.stories.tsx +8 -19
  28. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDateTime/demo.stories.tsx +7 -18
  29. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDateTime/mock.ts +1 -0
  30. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDecimal/demo.stories.tsx +1 -7
  31. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDecimal/mock.ts +1 -0
  32. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDetails/DetailsRender.tsx +58 -0
  33. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDetails/HighlightRender.tsx +50 -0
  34. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDetails/demo.stories.tsx +5 -5
  35. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDetails/index.tsx +35 -21
  36. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDetails.zip +0 -0
  37. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyEmail/demo.stories.tsx +1 -5
  38. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyForm/DetailsRender.tsx +58 -0
  39. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyForm/demo.stories.tsx +5 -3
  40. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyForm/index.tsx +28 -5
  41. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyInteger/demo.stories.tsx +2 -6
  42. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPage/GetNextWork.tsx +2 -1
  43. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPage/demo.stories.tsx +4 -3
  44. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPageCaseWidget/demo.stories.tsx +5 -4
  45. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPageWidget/demo.stories.tsx +5 -8
  46. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyParagraph/demo.stories.tsx +1 -5
  47. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyParagraph/mock.ts +1 -0
  48. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPercentage/demo.stories.tsx +2 -6
  49. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPercentage/mock.ts +1 -0
  50. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPhone/demo.stories.tsx +2 -5
  51. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPhone/mock.ts +1 -0
  52. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPicklist/demo.stories.tsx +2 -6
  53. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPicklist/mock.ts +1 -0
  54. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyRadioButtons/demo.stories.tsx +1 -7
  55. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MySearchbox/demo.stories.tsx +2 -8
  56. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MySearchbox/index.tsx +11 -0
  57. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MySearchbox/utils.ts +3 -0
  58. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyText/demo.stories.tsx +0 -3
  59. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyText/index.tsx +94 -4
  60. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTextInput/demo.stories.tsx +1 -5
  61. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTextInput/mock.ts +1 -0
  62. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTimeOfDay/demo.stories.tsx +5 -15
  63. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTwoColumnDetails/DetailsRender.tsx +58 -0
  64. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTwoColumnDetails/HighlightRender.tsx +50 -0
  65. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTwoColumnDetails/demo.stories.tsx +5 -5
  66. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTwoColumnDetails/index.tsx +42 -20
  67. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTwoColumnForm/DetailsRender.tsx +58 -0
  68. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTwoColumnForm/demo.stories.tsx +4 -2
  69. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTwoColumnForm/index.tsx +22 -3
  70. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyURL/demo.stories.tsx +1 -5
  71. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyURL/mock.ts +1 -0
  72. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyBoolean/demo.stories.tsx +3 -13
  73. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyBoolean/index.tsx +8 -5
  74. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyCurrency/demo.stories.tsx +2 -9
  75. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyCurrency/mock.ts +2 -0
  76. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDate/demo.stories.tsx +8 -19
  77. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDateTime/demo.stories.tsx +7 -18
  78. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDateTime/mock.ts +1 -0
  79. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDecimal/demo.stories.tsx +1 -7
  80. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDecimal/mock.ts +1 -0
  81. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDetails/DetailsRender.tsx +58 -0
  82. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDetails/HighlightRender.tsx +50 -0
  83. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDetails/demo.stories.tsx +5 -5
  84. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDetails/index.tsx +35 -21
  85. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDetails.zip +0 -0
  86. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyEmail/demo.stories.tsx +1 -5
  87. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyForm/DetailsRender.tsx +58 -0
  88. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyForm/demo.stories.tsx +5 -3
  89. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyForm/index.tsx +28 -5
  90. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyInteger/demo.stories.tsx +2 -6
  91. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPage/GetNextWork.tsx +2 -1
  92. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPage/demo.stories.tsx +4 -3
  93. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPageWidget/demo.stories.tsx +5 -8
  94. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyParagraph/demo.stories.tsx +1 -5
  95. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyParagraph/mock.ts +1 -0
  96. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPercentage/demo.stories.tsx +2 -6
  97. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPercentage/mock.ts +1 -0
  98. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPhone/demo.stories.tsx +2 -5
  99. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPhone/mock.ts +1 -0
  100. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPicklist/demo.stories.tsx +2 -6
  101. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPicklist/mock.ts +1 -0
  102. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyRadioButtons/demo.stories.tsx +1 -7
  103. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MySearchbox/demo.stories.tsx +2 -8
  104. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MySearchbox/index.tsx +11 -0
  105. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MySearchbox/utils.ts +3 -0
  106. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyText/demo.stories.tsx +0 -3
  107. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyText/index.tsx +94 -4
  108. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTextInput/demo.stories.tsx +1 -5
  109. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTextInput/mock.ts +1 -0
  110. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTimeOfDay/demo.stories.tsx +5 -15
  111. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnDetails/DetailsRender.tsx +58 -0
  112. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnDetails/HighlightRender.tsx +50 -0
  113. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnDetails/demo.stories.tsx +5 -5
  114. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnDetails/index.tsx +42 -20
  115. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnForm/DetailsRender.tsx +58 -0
  116. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnForm/demo.stories.tsx +4 -2
  117. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnForm/index.tsx +22 -3
  118. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyURL/demo.stories.tsx +1 -5
  119. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyURL/mock.ts +1 -0
@@ -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,40 +55,54 @@ 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
- {{! pick new delimiters for mustache }}
65
- {{=<% %>=}}
80
+ {{! pick new delimiters for mustache }}
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
+ // @ts-ignore
99
+ <Flex container={{ direction: 'column', alignItems: 'normal', colGap: 0, rowGap: 1.5 }} key={`r-${i + 1}`}>
100
+ <DetailsRender child={child} />
79
101
  </Flex>
80
102
  ))}
81
103
  </Grid>
82
104
  </FieldGroup>
83
- <%={{ }}=%> {{! revert delimiters for mustache }}
105
+ <%={{ }}=%> {{! revert delimiters for mustache }}
84
106
  </Styled{{COMPONENT_CLASS_NAME}}Wrapper>
85
107
  );
86
108
 
@@ -0,0 +1,58 @@
1
+ import { Fragment, ReactElement } from 'react';
2
+ import { FieldValueList } from '@pega/cosmos-react-core';
3
+
4
+ interface DetailsRenderProps {
5
+ children?: never;
6
+ child: NonNullable<ReactElement>;
7
+ }
8
+
9
+ const DetailsRender = (props: DetailsRenderProps) => {
10
+ const { child } = props;
11
+
12
+ const kids = child.props.getPConnect().getChildren();
13
+
14
+ const displayCompArr: ReactElement[] = [];
15
+
16
+ Object.values(kids).forEach((value: any) => {
17
+ const { type } = value.getPConnect().getRawMetadata();
18
+ const { hideLabel, variant, testId, label } = value
19
+ .getPConnect()
20
+ .resolveConfigProps(value.getPConnect().getConfigProps());
21
+
22
+ let displayComp;
23
+ const key = JSON.stringify(value.getPConnect());
24
+
25
+ if (type === 'reference') {
26
+ const refElement = value.getPConnect().getComponent();
27
+
28
+ displayCompArr.push(refElement);
29
+ } else {
30
+ const element = value.getPConnect().getComponent();
31
+ const displayEl = <Fragment key={key}>{element}</Fragment>;
32
+
33
+ const fvlStyle = {
34
+ myColGap: {
35
+ columnGap: '0'
36
+ }
37
+ };
38
+
39
+ // const myEl = <div>boo</div>;
40
+ displayComp = (
41
+ <Fragment key={key}>
42
+ <FieldValueList
43
+ style={fvlStyle.myColGap}
44
+ variant={hideLabel ? 'stacked' : variant}
45
+ data-testid={testId}
46
+ fields={[{ id: '1', name: hideLabel ? '' : label, value: displayEl }]}
47
+ />
48
+ </Fragment>
49
+ );
50
+
51
+ displayCompArr.push(displayComp);
52
+ }
53
+ });
54
+
55
+ return <>{displayCompArr}</>;
56
+ };
57
+
58
+ export default DetailsRender;
@@ -1,7 +1,8 @@
1
- import { Grid, FieldGroup, withConfiguration } from '@pega/cosmos-react-core';
1
+ import { Grid, Flex, FieldGroup, withConfiguration } from '@pega/cosmos-react-core';
2
2
 
3
3
 
4
4
  import type { PConnFieldProps } from './PConnProps';
5
+ import DetailsRender from './DetailsRender';
5
6
 
6
7
  import Styled{{COMPONENT_CLASS_NAME}}Wrapper from './styles';
7
8
 
@@ -13,19 +14,44 @@ interface {{COMPONENT_CLASS_NAME}}Props extends PConnFieldProps {
13
14
  children: any;
14
15
  }
15
16
 
16
- // Duplicated runtime code from Constellation Design System Component
17
-
18
17
  // props passed in combination of props from property panel (config.json) and run time props from Constellation
19
18
  // any default values in config.pros should be set in defaultProps at bottom of this file
20
19
  function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
21
20
 
22
- const { children = [], NumCols = '1', label, showLabel, getPConnect } = props;
21
+ const { children = [], NumCols = '1', label, showLabel, getPConnect, readOnly, displayMode } = props;
23
22
  const propsToUse = { label, showLabel, ...getPConnect().getInheritedProps() };
24
23
 
25
24
  const nCols = parseInt(NumCols, 10);
26
25
 
27
- // console.log(`Rendering ${getPConnect()?.getComponentName()} with ${template} with ${children?.length} Region(s)`);
28
26
 
27
+ if (readOnly && readOnly === true && displayMode && displayMode === 'DISPLAY_ONLY') {
28
+ const numRegions = '1';
29
+ const gridRepeat = 'repeat('.concat(numRegions).concat(', 1fr)');
30
+ const gridContainer = { colGap: 0 };
31
+ // @ts-ignore
32
+ gridContainer.cols = gridRepeat;
33
+
34
+ return (
35
+ <Styled{{COMPONENT_CLASS_NAME}}Wrapper>
36
+ {{! pick new delimiters for mustache }}
37
+ {{=<% %>=}}
38
+ <FieldGroup name={propsToUse.showLabel ? propsToUse.label : ''}>
39
+ <Grid container={gridContainer} data-testid={`column-count-${numRegions}`}>
40
+ {children.map((child: any, i: number) => (
41
+ <Flex
42
+ // @ts-ignore
43
+ container={{ direction: 'column', alignItems: 'normal', colGap: 0, rowGap: 1.5 }}
44
+ key={`r-${i + 1}`}
45
+ >
46
+ <DetailsRender child={child} />
47
+ </Flex>
48
+ ))}
49
+ </Grid>
50
+ </FieldGroup>
51
+ <%={{ }}=%> {{! revert delimiters for mustache }}
52
+ </Styled{{COMPONENT_CLASS_NAME}}Wrapper>
53
+ );
54
+ }
29
55
  return (
30
56
  <Styled{{COMPONENT_CLASS_NAME}}Wrapper>
31
57
  {{! pick new delimiters for mustache }}
@@ -0,0 +1,58 @@
1
+ import { Fragment, ReactElement } from 'react';
2
+ import { FieldValueList } from '@pega/cosmos-react-core';
3
+
4
+ interface DetailsRenderProps {
5
+ children?: never;
6
+ child: NonNullable<ReactElement>;
7
+ }
8
+
9
+ const DetailsRender = (props: DetailsRenderProps) => {
10
+ const { child } = props;
11
+
12
+ const kids = child.props.getPConnect().getChildren();
13
+
14
+ const displayCompArr: ReactElement[] = [];
15
+
16
+ Object.values(kids).forEach((value: any) => {
17
+ const { type } = value.getPConnect().getRawMetadata();
18
+ const { hideLabel, variant, testId, label } = value
19
+ .getPConnect()
20
+ .resolveConfigProps(value.getPConnect().getConfigProps());
21
+
22
+ let displayComp;
23
+ const key = JSON.stringify(value.getPConnect());
24
+
25
+ if (type === 'reference') {
26
+ const refElement = value.getPConnect().getComponent();
27
+
28
+ displayCompArr.push(refElement);
29
+ } else {
30
+ const element = value.getPConnect().getComponent();
31
+ const displayEl = <Fragment key={key}>{element}</Fragment>;
32
+
33
+ const fvlStyle = {
34
+ myColGap: {
35
+ columnGap: '0'
36
+ }
37
+ };
38
+
39
+ // const myEl = <div>boo</div>;
40
+ displayComp = (
41
+ <Fragment key={key}>
42
+ <FieldValueList
43
+ style={fvlStyle.myColGap}
44
+ variant={hideLabel ? 'stacked' : variant}
45
+ data-testid={testId}
46
+ fields={[{ id: '1', name: hideLabel ? '' : label, value: displayEl }]}
47
+ />
48
+ </Fragment>
49
+ );
50
+
51
+ displayCompArr.push(displayComp);
52
+ }
53
+ });
54
+
55
+ return <>{displayCompArr}</>;
56
+ };
57
+
58
+ export default DetailsRender;
@@ -1,6 +1,7 @@
1
1
  import { Grid, Flex, FieldGroup, withConfiguration } from '@pega/cosmos-react-core';
2
2
 
3
3
  import type { PConnFieldProps } from './PConnProps';
4
+ import DetailsRender from './DetailsRender';
4
5
 
5
6
  import Styled{{COMPONENT_CLASS_NAME}}Wrapper from './styles';
6
7
 
@@ -11,14 +12,12 @@ interface {{COMPONENT_CLASS_NAME}}Props extends PConnFieldProps {
11
12
  children: any;
12
13
  }
13
14
 
14
- // Duplicated runtime code from Constellation Design System Component
15
-
16
15
  // props passed in combination of props from property panel (config.json) and run time props from Constellation
17
16
  // any default values in config.pros should be set in defaultProps at bottom of this file
18
17
  function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
19
18
 
20
19
 
21
- const { children = [], label, showLabel, getPConnect } = props;
20
+ const { children = [], label, showLabel, getPConnect, readOnly, displayMode } = props;
22
21
  const propsToUse = { label, showLabel, ...getPConnect().getInheritedProps() };
23
22
 
24
23
  const numRegions = children?.length;
@@ -33,10 +32,33 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
33
32
  // @ts-ignore
34
33
  flexContainer.gap = 2;
35
34
 
35
+ if (readOnly && readOnly === true && displayMode && displayMode === 'DISPLAY_ONLY') {
36
+ return (
37
+ <Styled{{COMPONENT_CLASS_NAME}}Wrapper>
38
+ {{! pick new delimiters for mustache }}
39
+ {{=<% %>=}}
40
+ <FieldGroup name={propsToUse.showLabel ? propsToUse.label : ''}>
41
+ <Grid container={gridContainer} data-testid={`column-count-${numRegions}`}>
42
+ {children.map((child: any, i: number) => (
43
+ <Flex
44
+ // @ts-ignore
45
+ container={{ direction: 'column', alignItems: 'normal', colGap: 0, rowGap: 1.5 }}
46
+ key={`r-${i + 1}`}
47
+ >
48
+ <DetailsRender child={child} />
49
+ </Flex>
50
+ ))}
51
+ </Grid>
52
+ </FieldGroup>
53
+ <%={{ }}=%> {{! revert delimiters for mustache }}
54
+ </Styled{{COMPONENT_CLASS_NAME}}Wrapper>
55
+ );
56
+ }
57
+
36
58
  return (
37
59
  <Styled{{COMPONENT_CLASS_NAME}}Wrapper>
38
- {{! pick new delimiters for mustache }}
39
- {{=<% %>=}}
60
+ {{! pick new delimiters for mustache }}
61
+ {{=<% %>=}}
40
62
  <FieldGroup name={propsToUse.showLabel ? propsToUse.label : ''}>
41
63
  <Grid container={gridContainer}>
42
64
  {children.map((child: any, i: number) => (
@@ -47,7 +69,7 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
47
69
  ))}
48
70
  </Grid>
49
71
  </FieldGroup>
50
- <%={{ }}=%> {{! revert delimiters for mustache }}
72
+ <%={{ }}=%> {{! revert delimiters for mustache }}
51
73
  </Styled{{COMPONENT_CLASS_NAME}}Wrapper>
52
74
  );
53
75
 
@@ -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
  });
@@ -69,7 +69,7 @@
69
69
  },
70
70
  "devDependencies": {
71
71
  "@pega/configs": "^0.6.0",
72
- "@pega/custom-dx-components": "0.24.3",
72
+ "@pega/custom-dx-components": "0.24.5",
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",
@@ -5,7 +5,9 @@
5
5
  "./src/**/*.stories.ts",
6
6
  "./src/**/*.stories.tsx",
7
7
  "./src/**/*.stories.js",
8
- "./src/**/*.stories.jsx"
8
+ "./src/**/*.stories.jsx",
9
+ "./src/**/*.test.jsx",
10
+ "./src/**/*.test.tsx"
9
11
  ],
10
12
  "compilerOptions": {
11
13
  "noEmit": false,
@@ -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: () => {
@@ -1,4 +1,12 @@
1
- import { Input, withConfiguration } from '@pega/cosmos-react-core';
1
+ import {
2
+ Input,
3
+ FieldValueList,
4
+ Text,
5
+ EmailDisplay,
6
+ PhoneDisplay,
7
+ URLDisplay,
8
+ withConfiguration
9
+ } from '@pega/cosmos-react-core';
2
10
 
3
11
  import type { PConnFieldProps } from './PConnProps';
4
12
 
@@ -7,7 +15,9 @@ import StyledPegaDxilMyTestTextWrapper from './styles';
7
15
  // interface for props
8
16
  interface PegaDxilMyTestTextProps extends PConnFieldProps {
9
17
  // If any, enter additional props that only exist on TextInput here
10
-
18
+ isTableFormatter?: boolean;
19
+ formatter: string;
20
+ variant?: any;
11
21
  }
12
22
 
13
23
  // interface for StateProps object
@@ -16,23 +26,103 @@ interface StateProps {
16
26
  hasSuggestions: boolean;
17
27
  }
18
28
 
19
- // Duplicated runtime code from Constellation Design System Component
29
+ export const formatExists = (formatterVal: string) => {
30
+ const formatterValues = [
31
+ 'TextInput',
32
+ 'WorkStatus',
33
+ 'RichText',
34
+ 'Email',
35
+ 'Phone',
36
+ 'URL',
37
+ 'Operator'
38
+ ];
39
+ let isformatter = false;
40
+ if (formatterValues.includes(formatterVal)) {
41
+ isformatter = true;
42
+ }
43
+ return isformatter;
44
+ };
45
+
46
+ export const textFormatter = (formatter: string, value: string) => {
47
+ let displayComponent: any = null;
48
+ switch (formatter) {
49
+ case 'TextInput': {
50
+ displayComponent = value;
51
+ break;
52
+ }
53
+ case 'Email': {
54
+ displayComponent = <EmailDisplay value={value} displayText={value} variant='link' />;
55
+ break;
56
+ }
57
+ case 'Phone': {
58
+ displayComponent = <PhoneDisplay value={value} variant='link' />;
59
+ break;
60
+ }
61
+ case 'URL': {
62
+ displayComponent = (
63
+ <URLDisplay target='_blank' value={value} displayText={value} variant='link' />
64
+ );
65
+ break;
66
+ }
67
+ // no default
68
+ }
69
+ return displayComponent;
70
+ };
20
71
 
21
72
  // props passed in combination of props from property panel (config.json) and run time props from Constellation
22
73
  // any default values in config.pros should be set in defaultProps at bottom of this file
23
74
  function PegaDxilMyTestText(props: PegaDxilMyTestTextProps) {
24
- const { getPConnect, value, placeholder, disabled = false, readOnly = false, required = false, label, hideLabel = false, testId } = props;
75
+ const { getPConnect, value, placeholder, disabled = false, displayMode, readOnly = false, required = false, label, hideLabel = false, testId, isTableFormatter = false, variant = 'inline' } = props;
25
76
 
26
77
  const pConn = getPConnect();
27
78
  const actions = pConn.getActionsApi();
28
79
  const stateProps = pConn.getStateProps() as StateProps;
29
80
  const propName: string = stateProps.value;
81
+ const { formatter } = props;
30
82
 
31
83
  const handleOnChange = (event: any) => {
32
84
  const { value: updatedValue } = event.target;
33
85
  actions.updateFieldValue(propName, updatedValue);
34
86
  };
35
87
 
88
+ if (displayMode === 'LABELS_LEFT' || displayMode === 'DISPLAY_ONLY') {
89
+ let displayComp = value || <span aria-hidden='true'>&ndash;&ndash;</span>;
90
+ if (isTableFormatter && formatExists(formatter)) {
91
+ displayComp = textFormatter(formatter, value);
92
+ }
93
+ return displayMode === 'DISPLAY_ONLY' ? (
94
+ <StyledPegaDxilMyTestTextWrapper> {displayComp} </StyledPegaDxilMyTestTextWrapper>
95
+ ) : (
96
+ <StyledPegaDxilMyTestTextWrapper>
97
+ <FieldValueList
98
+ variant={hideLabel ? 'stacked' : variant}
99
+ data-testid={testId}
100
+ fields={[{ id: '1', name: hideLabel ? '' : label, value: displayComp }]}
101
+ />
102
+ </StyledPegaDxilMyTestTextWrapper>
103
+ );
104
+ }
105
+
106
+ if (displayMode === 'STACKED_LARGE_VAL') {
107
+ const isValDefined = typeof value !== 'undefined' && value !== '';
108
+ const val = isValDefined ? (
109
+ <Text variant='h1' as='span'>
110
+ {value}
111
+ </Text>
112
+ ) : (
113
+ ''
114
+ );
115
+ return (
116
+ <StyledPegaDxilMyTestTextWrapper>
117
+ <FieldValueList
118
+ variant='stacked'
119
+ data-testid={testId}
120
+ fields={[{ id: '2', name: hideLabel ? '' : label, value: val }]}
121
+ />
122
+ </StyledPegaDxilMyTestTextWrapper>
123
+ );
124
+ }
125
+
36
126
  return (
37
127
  <StyledPegaDxilMyTestTextWrapper>
38
128
  <Input
@@ -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
+ };
@@ -20,17 +20,8 @@ export const BasePegaDxilMyCurrency: Story = args => {
20
20
 
21
21
  const props = {
22
22
  value: Number(configProps.value),
23
- placeholder: configProps.placeholder,
24
- label: configProps.label,
25
- helperText: configProps.helperText,
26
- showGroupSeparators: configProps.showGroupSeparators,
27
- allowDecimals: configProps.allowDecimals,
28
- currencyISOCode: configProps.currencyISOCode,
29
- alwaysShowISOCode: configProps.alwaysShowISOCode,
30
23
  hasSuggestions: configProps.hasSuggestions,
31
- testId: configProps.testId,
32
24
  fieldMetadata,
33
- validatemessage: '',
34
25
  getPConnect: () => {
35
26
  return {
36
27
  getStateProps: () => {
@@ -60,6 +51,7 @@ export const BasePegaDxilMyCurrency: Story = args => {
60
51
 
61
52
  BasePegaDxilMyCurrency.args = {
62
53
  label: configProps.label,
54
+ placeholder: configProps.placeholder,
63
55
  helperText: configProps.helperText,
64
56
  showGroupSeparators: configProps.showGroupSeparators,
65
57
  allowDecimals: configProps.allowDecimals,
@@ -72,5 +64,6 @@ BasePegaDxilMyCurrency.args = {
72
64
  status: configProps.status,
73
65
  hideLabel: configProps.hideLabel,
74
66
  displayMode: configProps.displayMode,
67
+ variant: configProps.variant,
75
68
  validatemessage: configProps.validatemessage
76
69
  };
@@ -3,6 +3,7 @@
3
3
  export const configProps = {
4
4
  value: '',
5
5
  label: 'Currency Sample',
6
+ placeholder: 'Currency Placeholder',
6
7
  currencyISOCode: 'USD',
7
8
  allowDecimals: true,
8
9
  showGroupSeparators: true,
@@ -12,6 +13,7 @@ export const configProps = {
12
13
  testId: 'currency-12345678',
13
14
  hasSuggestions: false,
14
15
  displayMode: '',
16
+ variant: '',
15
17
  hideLabel: false,
16
18
  readOnly: false,
17
19
  required: false,