@pega/custom-dx-components 0.24.12 → 0.24.13

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 (53) hide show
  1. package/package.json +1 -1
  2. package/src/tasks/build-all/helper.js +6 -0
  3. package/src/tasks/build-comp/helper.js +8 -0
  4. package/src/tasks/create/templates/Constellation/Template/DETAILS/{DetailsRender.tsx → DetailsRender.tsx.mustache} +7 -10
  5. package/src/tasks/create/templates/Constellation/Template/DETAILS/{HighlightRender.tsx → HighlightRender.tsx.mustache} +12 -13
  6. package/src/tasks/create/templates/Constellation/Template/DETAILS/demo.stories.tsx.mustache +27 -7
  7. package/src/tasks/create/templates/Constellation/Template/DETAILS/index.tsx.mustache +26 -33
  8. package/src/tasks/create/templates/Constellation/Template/DETAILS/mock.ts.mustache +4 -0
  9. package/src/tasks/create/templates/Constellation/Template/DETAILS/styles.ts.mustache +16 -0
  10. package/src/tasks/create/templates/Constellation/Template/DETAILS-region/{DetailsRender.tsx → DetailsRender.tsx.mustache} +7 -10
  11. package/src/tasks/create/templates/Constellation/Template/DETAILS-region/{HighlightRender.tsx → HighlightRender.tsx.mustache} +12 -13
  12. package/src/tasks/create/templates/Constellation/Template/DETAILS-region/demo.stories.tsx.mustache +45 -10
  13. package/src/tasks/create/templates/Constellation/Template/DETAILS-region/index.tsx.mustache +19 -41
  14. package/src/tasks/create/templates/Constellation/Template/DETAILS-region/mock.ts.mustache +4 -0
  15. package/src/tasks/create/templates/Constellation/Template/DETAILS-region/styles.ts.mustache +15 -0
  16. package/src/tasks/create/templates/Constellation/Template/PAGE/localizations.json.mustache +4 -2
  17. package/src/tasks/create/templates/Constellation/Widget/PAGE/demo.stories.tsx.mustache +5 -5
  18. package/src/tasks/create/templates/Constellation/Widget/PAGE/index.tsx.mustache +1 -1
  19. package/src/tasks/create/templates/Launchpad/Widget/PAGE/demo.stories.tsx.mustache +1 -1
  20. package/src/tasks/create/templates/Launchpad/Widget/PAGE/index.tsx.mustache +1 -1
  21. package/src/tasks/init/template/package.json.mustache +1 -1
  22. package/src/tasks/publish/helper.js +6 -0
  23. package/src/tasks/publish-all/helper.js +6 -0
  24. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDetails/DetailsRender.tsx +4 -10
  25. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDetails/HighlightRender.tsx +9 -13
  26. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDetails/demo.stories.tsx +27 -7
  27. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDetails/index.tsx +26 -33
  28. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDetails/mock.ts +4 -0
  29. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDetails/styles.ts +16 -0
  30. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPage/localizations.json +4 -2
  31. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPageWidget/demo.stories.tsx +5 -5
  32. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPageWidget/index.tsx +1 -1
  33. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTwoColumnDetails/DetailsRender.tsx +4 -10
  34. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTwoColumnDetails/HighlightRender.tsx +9 -13
  35. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTwoColumnDetails/demo.stories.tsx +45 -10
  36. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTwoColumnDetails/index.tsx +19 -41
  37. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTwoColumnDetails/mock.ts +4 -0
  38. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTwoColumnDetails/styles.ts +15 -0
  39. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDetails/DetailsRender.tsx +4 -10
  40. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDetails/HighlightRender.tsx +9 -13
  41. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDetails/demo.stories.tsx +27 -7
  42. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDetails/index.tsx +26 -33
  43. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDetails/mock.ts +4 -0
  44. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDetails/styles.ts +16 -0
  45. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPage/localizations.json +4 -2
  46. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPageWidget/demo.stories.tsx +1 -1
  47. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPageWidget/index.tsx +1 -1
  48. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnDetails/DetailsRender.tsx +4 -10
  49. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnDetails/HighlightRender.tsx +9 -13
  50. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnDetails/demo.stories.tsx +45 -10
  51. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnDetails/index.tsx +19 -41
  52. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnDetails/mock.ts +4 -0
  53. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnDetails/styles.ts +15 -0
@@ -1,10 +1,10 @@
1
- import { Fragment } from 'react';
2
- import { Grid, Flex, FieldGroup, withConfiguration } from '@pega/cosmos-react-core';
1
+ import { Fragment, Children, ReactElement } from 'react';
2
+ import { Grid, Flex, FieldGroup, withConfiguration, GridContainerProps } from '@pega/cosmos-react-core';
3
3
  import type { PConnFieldProps } from './PConnProps';
4
4
  import DetailsRender from './DetailsRender';
5
5
  import HighlightRender from './HighlightRender';
6
6
 
7
- import StyledPegaDxilMyTwoColumnDetailsWrapper from './styles';
7
+ import StyledPegaDxilMyTwoColumnDetailsWrapper, { StyledDetailsGridContainer, StyledHighlightedFieldsHrLine } from './styles';
8
8
 
9
9
  // includes in bundle
10
10
  import { getAllFields } from './utils';
@@ -14,40 +14,31 @@ interface PegaDxilMyTwoColumnDetailsProps extends PConnFieldProps {
14
14
  // If any, enter additional props that only exist on TextInput here
15
15
  showLabel: boolean;
16
16
  showHighlightedData: boolean;
17
- children: any;
17
+ children: ReactElement[];
18
18
  }
19
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 PegaDxilMyTwoColumnDetails(props: PegaDxilMyTwoColumnDetailsProps) {
23
23
 
24
- const { getPConnect, children, label, showLabel = true, showHighlightedData = false } = props;
24
+ const { getPConnect, label, children, showLabel = true, showHighlightedData = false } = props;
25
25
  const propsToUse = { label, showLabel, ...getPConnect().getInheritedProps() };
26
26
 
27
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
- }
28
+ Children.toArray(children).forEach(child => {
29
+ // @ts-ignore
30
+ child.props.getPConnect().setInheritedProp('readOnly', true);
31
+ // @ts-ignore
32
+ child.props.getPConnect().setInheritedProp('displayMode', 'DISPLAY_ONLY');
33
+ });
34
34
 
35
35
  const numRegions = getAllFields(getPConnect)?.length;
36
36
  const gridRepeat = "repeat(".concat(numRegions).concat(", 1fr)");
37
- const gridContainer = { colGap: 0, 'margin-line-start': 0 };
38
- // @ts-ignore
37
+
38
+ const gridContainer: GridContainerProps = { colGap: 0 };
39
39
  gridContainer.cols = gridRepeat;
40
- // @ts-ignore
41
40
  gridContainer.alignItems = 'start';
42
41
 
43
- const gridHighlightContainer = { "gap": 2};
44
- // @ts-ignore
45
- gridHighlightContainer.cols = gridRepeat;
46
- // @ts-ignore
47
- gridHighlightContainer.alignItems = 'flex-start';
48
- // @ts-ignore
49
- gridHighlightContainer.pad = [0, 0, 2, 0];
50
-
51
42
  // Set up highlighted data to pass in return if is set to show, need raw metadata to pass to createComponent
52
43
  let highlightedDataArr = [];
53
44
  if (showHighlightedData) {
@@ -55,26 +46,10 @@ function PegaDxilMyTwoColumnDetails(props: PegaDxilMyTwoColumnDetailsProps) {
55
46
  const { highlightedData = [] } = getPConnect().getRawMetadata().config;
56
47
  // @ts-ignore
57
48
  highlightedDataArr = highlightedData.map((field) => {
58
- // field.config.displayMode = 'STACKED_LARGE_VAL';
59
-
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} />;
49
+ return <HighlightRender field={field} getPConnect={props.getPConnect} />;
68
50
  });
69
51
  }
70
52
 
71
- const hrStyle = {
72
- line: {
73
- margin: '0.75rem 0',
74
- opacity: '50%'
75
- }
76
- };
77
-
78
53
  return (
79
54
  <StyledPegaDxilMyTwoColumnDetailsWrapper>
80
55
  <FieldGroup name={propsToUse.showLabel ? propsToUse.label : ''}>
@@ -88,10 +63,13 @@ function PegaDxilMyTwoColumnDetails(props: PegaDxilMyTwoColumnDetailsProps) {
88
63
  <Fragment key={`hf-${i + 1}`}>{child}</Fragment>
89
64
  ))}
90
65
  </Flex>
91
- <hr style={hrStyle.line} />
66
+ <StyledHighlightedFieldsHrLine />
92
67
  </>
93
68
  )}
94
- <Grid container={gridContainer} data-testid={`column-count-${numRegions}`} >
69
+ <Grid
70
+ as={StyledDetailsGridContainer}
71
+ container={gridContainer}
72
+ data-testid={`column-count-${numRegions}`} >
95
73
  {children.map((child: any, i: number) => (
96
74
  <Flex
97
75
  // @ts-ignore
@@ -16,6 +16,7 @@ export const pyReviewRaw = {
16
16
  config: {
17
17
  value: '@P .pyStatusWork',
18
18
  label: '@L Work Status',
19
+ hideLabel: false,
19
20
  displayMode: 'STACKED_LARGE_VAL',
20
21
  displayAsStatus: true,
21
22
  key: 'pyStatusWork'
@@ -26,6 +27,7 @@ export const pyReviewRaw = {
26
27
  config: {
27
28
  value: '@P .pyID',
28
29
  label: '@L Case ID',
30
+ hideLabel: false,
29
31
  displayMode: 'STACKED_LARGE_VAL',
30
32
  key: 'pyID'
31
33
  }
@@ -35,6 +37,7 @@ export const pyReviewRaw = {
35
37
  config: {
36
38
  value: '@P .pxCreateDateTime',
37
39
  label: '@L Create date/time',
40
+ hideLabel: false,
38
41
  displayMode: 'STACKED_LARGE_VAL',
39
42
  key: 'pxCreateDateTime'
40
43
  }
@@ -43,6 +46,7 @@ export const pyReviewRaw = {
43
46
  type: 'UserReference',
44
47
  config: {
45
48
  label: '@L Create Operator',
49
+ hideLabel: false,
46
50
  value: '@USER .pxCreateOperator',
47
51
  placeholder: 'Select...',
48
52
  displayMode: 'STACKED_LARGE_VAL',
@@ -6,3 +6,18 @@ export default styled.div(() => {
6
6
  margin: 0px 0;
7
7
  `;
8
8
  });
9
+
10
+ export const StyledDetailsGridContainer = styled.div(() => {
11
+ return css`
12
+ margin-line-start: 1;
13
+ `;
14
+ });
15
+
16
+ export const StyledHighlightedFieldsHrLine = styled.hr(() => {
17
+ return css`
18
+ line: {
19
+ margin: '0.75rem 0';
20
+ opacity: '50%'
21
+ }
22
+ `;
23
+ });