@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.
- package/package.json +1 -1
- package/src/tasks/bundle/builder/webpack.config.js +15 -1
- package/src/tasks/create/templates/Constellation/Field/Picklist-Autocomplete/index.tsx.mustache +11 -0
- package/src/tasks/create/templates/Constellation/Field/Picklist-Autocomplete/utils.ts.mustache +3 -0
- package/src/tasks/create/templates/Constellation/Field/Text/index.tsx.mustache +94 -4
- package/src/tasks/create/templates/Constellation/Template/DETAILS/DetailsRender.tsx +58 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS/HighlightRender.tsx +50 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS/index.tsx.mustache +38 -24
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/DetailsRender.tsx +58 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/HighlightRender.tsx +50 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/index.tsx.mustache +45 -23
- package/src/tasks/create/templates/Constellation/Template/FORM/DetailsRender.tsx +58 -0
- package/src/tasks/create/templates/Constellation/Template/FORM/index.tsx.mustache +31 -5
- package/src/tasks/create/templates/Constellation/Template/FORM-region/DetailsRender.tsx +58 -0
- package/src/tasks/create/templates/Constellation/Template/FORM-region/index.tsx.mustache +28 -6
- package/src/tasks/create/templates/Constellation/Template/PAGE/GetNextWork.tsx.mustache +2 -1
- package/src/tasks/init/template/package.json.mustache +1 -1
- package/src/tasks/init/template/tsconfig.build.json +3 -1
- package/tests/assets/components/create/Pega_DXIL_MyDetails.zip +0 -0
- package/tests/assets/components/create/Pega_DXIL_MyTestText/demo.stories.tsx +0 -3
- package/tests/assets/components/create/Pega_DXIL_MyTestText/index.tsx +94 -4
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyBoolean/demo.stories.tsx +3 -13
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyBoolean/index.tsx +8 -5
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyCaseWidget/demo.stories.tsx +3 -2
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyCurrency/demo.stories.tsx +2 -9
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyCurrency/mock.ts +2 -0
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDate/demo.stories.tsx +8 -19
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDateTime/demo.stories.tsx +7 -18
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDateTime/mock.ts +1 -0
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDecimal/demo.stories.tsx +1 -7
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDecimal/mock.ts +1 -0
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDetails/DetailsRender.tsx +58 -0
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDetails/HighlightRender.tsx +50 -0
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDetails/demo.stories.tsx +5 -5
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDetails/index.tsx +35 -21
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDetails.zip +0 -0
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyEmail/demo.stories.tsx +1 -5
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyForm/DetailsRender.tsx +58 -0
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyForm/demo.stories.tsx +5 -3
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyForm/index.tsx +28 -5
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyInteger/demo.stories.tsx +2 -6
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPage/GetNextWork.tsx +2 -1
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPage/demo.stories.tsx +4 -3
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPageCaseWidget/demo.stories.tsx +5 -4
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPageWidget/demo.stories.tsx +5 -8
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyParagraph/demo.stories.tsx +1 -5
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyParagraph/mock.ts +1 -0
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPercentage/demo.stories.tsx +2 -6
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPercentage/mock.ts +1 -0
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPhone/demo.stories.tsx +2 -5
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPhone/mock.ts +1 -0
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPicklist/demo.stories.tsx +2 -6
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPicklist/mock.ts +1 -0
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyRadioButtons/demo.stories.tsx +1 -7
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MySearchbox/demo.stories.tsx +2 -8
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MySearchbox/index.tsx +11 -0
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MySearchbox/utils.ts +3 -0
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyText/demo.stories.tsx +0 -3
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyText/index.tsx +94 -4
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTextInput/demo.stories.tsx +1 -5
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTextInput/mock.ts +1 -0
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTimeOfDay/demo.stories.tsx +5 -15
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTwoColumnDetails/DetailsRender.tsx +58 -0
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTwoColumnDetails/HighlightRender.tsx +50 -0
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTwoColumnDetails/demo.stories.tsx +5 -5
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTwoColumnDetails/index.tsx +42 -20
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTwoColumnForm/DetailsRender.tsx +58 -0
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTwoColumnForm/demo.stories.tsx +4 -2
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTwoColumnForm/index.tsx +22 -3
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyURL/demo.stories.tsx +1 -5
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyURL/mock.ts +1 -0
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyBoolean/demo.stories.tsx +3 -13
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyBoolean/index.tsx +8 -5
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyCurrency/demo.stories.tsx +2 -9
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyCurrency/mock.ts +2 -0
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDate/demo.stories.tsx +8 -19
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDateTime/demo.stories.tsx +7 -18
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDateTime/mock.ts +1 -0
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDecimal/demo.stories.tsx +1 -7
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDecimal/mock.ts +1 -0
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDetails/DetailsRender.tsx +58 -0
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDetails/HighlightRender.tsx +50 -0
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDetails/demo.stories.tsx +5 -5
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDetails/index.tsx +35 -21
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDetails.zip +0 -0
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyEmail/demo.stories.tsx +1 -5
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyForm/DetailsRender.tsx +58 -0
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyForm/demo.stories.tsx +5 -3
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyForm/index.tsx +28 -5
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyInteger/demo.stories.tsx +2 -6
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPage/GetNextWork.tsx +2 -1
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPage/demo.stories.tsx +4 -3
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPageWidget/demo.stories.tsx +5 -8
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyParagraph/demo.stories.tsx +1 -5
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyParagraph/mock.ts +1 -0
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPercentage/demo.stories.tsx +2 -6
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPercentage/mock.ts +1 -0
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPhone/demo.stories.tsx +2 -5
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPhone/mock.ts +1 -0
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPicklist/demo.stories.tsx +2 -6
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPicklist/mock.ts +1 -0
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyRadioButtons/demo.stories.tsx +1 -7
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MySearchbox/demo.stories.tsx +2 -8
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MySearchbox/index.tsx +11 -0
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MySearchbox/utils.ts +3 -0
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyText/demo.stories.tsx +0 -3
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyText/index.tsx +94 -4
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTextInput/demo.stories.tsx +1 -5
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTextInput/mock.ts +1 -0
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTimeOfDay/demo.stories.tsx +5 -15
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnDetails/DetailsRender.tsx +58 -0
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnDetails/HighlightRender.tsx +50 -0
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnDetails/demo.stories.tsx +5 -5
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnDetails/index.tsx +42 -20
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnForm/DetailsRender.tsx +58 -0
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnForm/demo.stories.tsx +4 -2
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnForm/index.tsx +22 -3
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyURL/demo.stories.tsx +1 -5
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyURL/mock.ts +1 -0
package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTwoColumnDetails/index.tsx
CHANGED
|
@@ -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 StyledPegaDxilMyTwoColumnDetailsWrapper from './styles';
|
|
6
8
|
|
|
@@ -15,8 +17,6 @@ interface PegaDxilMyTwoColumnDetailsProps 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 PegaDxilMyTwoColumnDetails(props: PegaDxilMyTwoColumnDetailsProps) {
|
|
@@ -24,9 +24,17 @@ function PegaDxilMyTwoColumnDetails(props: PegaDxilMyTwoColumnDetailsProps) {
|
|
|
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":
|
|
37
|
+
const gridContainer = { "colGap": 0};
|
|
30
38
|
// @ts-ignore
|
|
31
39
|
gridContainer.cols = gridRepeat;
|
|
32
40
|
// @ts-ignore
|
|
@@ -36,7 +44,7 @@ function PegaDxilMyTwoColumnDetails(props: PegaDxilMyTwoColumnDetailsProps) {
|
|
|
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,33 +55,47 @@ function PegaDxilMyTwoColumnDetails(props: PegaDxilMyTwoColumnDetailsProps) {
|
|
|
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
|
-
|
|
55
|
-
|
|
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
|
<StyledPegaDxilMyTwoColumnDetailsWrapper>
|
|
64
80
|
<FieldGroup name={propsToUse.showLabel ? propsToUse.label : ''}>
|
|
65
81
|
{showHighlightedData && highlightedDataArr.length > 0 && (
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
82
|
+
<>
|
|
83
|
+
<Flex
|
|
84
|
+
container={{ direction: 'row', alignItems: 'start', colGap: 10 }}
|
|
85
|
+
data-testid={`highlighted-column-count-${numRegions}`}
|
|
86
|
+
>
|
|
87
|
+
{highlightedDataArr.map((child: any, i: number) => (
|
|
88
|
+
<Fragment key={`hf-${i + 1}`}>{child}</Fragment>
|
|
89
|
+
))}
|
|
90
|
+
</Flex>
|
|
91
|
+
<hr style={hrStyle.line} />
|
|
92
|
+
</>
|
|
72
93
|
)}
|
|
73
94
|
<Grid container={gridContainer} data-testid={`column-count-${numRegions}`} >
|
|
74
95
|
{children.map((child: any, i: number) => (
|
|
75
|
-
|
|
76
|
-
{
|
|
96
|
+
// @ts-ignore
|
|
97
|
+
<Flex container={{ direction: 'column', alignItems: 'normal', colGap: 0, rowGap: 1.5 }} key={`r-${i + 1}`}>
|
|
98
|
+
<DetailsRender child={child} />
|
|
77
99
|
</Flex>
|
|
78
100
|
))}
|
|
79
101
|
</Grid>
|
package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTwoColumnForm/DetailsRender.tsx
ADDED
|
@@ -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;
|
package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTwoColumnForm/demo.stories.tsx
CHANGED
|
@@ -142,7 +142,6 @@ const renderField = resolvedProps => {
|
|
|
142
142
|
|
|
143
143
|
export const BasePegaDxilMyTwoColumnForm: Story = args => {
|
|
144
144
|
const props = {
|
|
145
|
-
template: 'DefaultForm',
|
|
146
145
|
getPConnect: () => {
|
|
147
146
|
return {
|
|
148
147
|
getChildren: () => {
|
|
@@ -187,4 +186,7 @@ export const BasePegaDxilMyTwoColumnForm: Story = args => {
|
|
|
187
186
|
);
|
|
188
187
|
};
|
|
189
188
|
|
|
190
|
-
BasePegaDxilMyTwoColumnForm.args = {
|
|
189
|
+
BasePegaDxilMyTwoColumnForm.args = {
|
|
190
|
+
showLabel: true,
|
|
191
|
+
label: 'Form Region template',
|
|
192
|
+
};
|
|
@@ -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 StyledPegaDxilMyTwoColumnFormWrapper from './styles';
|
|
6
7
|
|
|
@@ -11,14 +12,12 @@ interface PegaDxilMyTwoColumnFormProps 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 PegaDxilMyTwoColumnForm(props: PegaDxilMyTwoColumnFormProps) {
|
|
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,6 +32,26 @@ function PegaDxilMyTwoColumnForm(props: PegaDxilMyTwoColumnFormProps) {
|
|
|
33
32
|
// @ts-ignore
|
|
34
33
|
flexContainer.gap = 2;
|
|
35
34
|
|
|
35
|
+
if (readOnly && readOnly === true && displayMode && displayMode === 'DISPLAY_ONLY') {
|
|
36
|
+
return (
|
|
37
|
+
<StyledPegaDxilMyTwoColumnFormWrapper>
|
|
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
|
+
</StyledPegaDxilMyTwoColumnFormWrapper>
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
|
|
36
55
|
return (
|
|
37
56
|
<StyledPegaDxilMyTwoColumnFormWrapper>
|
|
38
57
|
<FieldGroup name={propsToUse.showLabel ? propsToUse.label : ''}>
|
|
@@ -19,12 +19,7 @@ export const BasePegaDxilMyUrl: Story = args => {
|
|
|
19
19
|
|
|
20
20
|
const props = {
|
|
21
21
|
value: configProps.value,
|
|
22
|
-
placeholder: configProps.placeholder,
|
|
23
|
-
label: configProps.label,
|
|
24
|
-
helperText: configProps.helperText,
|
|
25
|
-
testId: configProps.testId,
|
|
26
22
|
hasSuggestions: configProps.hasSuggestions,
|
|
27
|
-
validatemessage: '',
|
|
28
23
|
getPConnect: () => {
|
|
29
24
|
return {
|
|
30
25
|
getStateProps: () => {
|
|
@@ -62,5 +57,6 @@ BasePegaDxilMyUrl.args = {
|
|
|
62
57
|
status: configProps.status,
|
|
63
58
|
hideLabel: configProps.hideLabel,
|
|
64
59
|
displayMode: configProps.displayMode,
|
|
60
|
+
variant: configProps.variant,
|
|
65
61
|
validatemessage: configProps.validatemessage
|
|
66
62
|
};
|
|
@@ -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
|
-
|
|
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 (
|
|
106
|
+
return (
|
|
107
|
+
<StyledPegaDxilMyBooleanWrapper>
|
|
108
|
+
{displayComponent}
|
|
109
|
+
</StyledPegaDxilMyBooleanWrapper>
|
|
110
|
+
);
|
|
108
111
|
}
|
|
109
112
|
|
|
110
113
|
if (displayMode === "LABELS_LEFT") {
|
|
@@ -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,
|
|
@@ -31,6 +31,9 @@ window.PCore.getEnvironmentInfo = () => {
|
|
|
31
31
|
|
|
32
32
|
export const BasePegaDxilMyDate: Story = args => {
|
|
33
33
|
const props = {
|
|
34
|
+
value: configProps.value,
|
|
35
|
+
additionalProps: configProps.additionalProps,
|
|
36
|
+
hasSuggestions: configProps.hasSuggestions,
|
|
34
37
|
getPConnect: () => {
|
|
35
38
|
return {
|
|
36
39
|
getActionsApi: () => {
|
|
@@ -54,25 +57,7 @@ export const BasePegaDxilMyDate: Story = args => {
|
|
|
54
57
|
acceptSuggestion: () => {/* nothing */},
|
|
55
58
|
clearErrorMessages: () => {/* nothing */}
|
|
56
59
|
};
|
|
57
|
-
}
|
|
58
|
-
value: configProps.value,
|
|
59
|
-
validatemessage: configProps.validatemessage,
|
|
60
|
-
label: configProps.label,
|
|
61
|
-
hideLabel: configProps.hideLabel,
|
|
62
|
-
helperText: configProps.helperText,
|
|
63
|
-
nextYearRange: configProps.nextYearRange,
|
|
64
|
-
previousYearRange: configProps.previousYearRange,
|
|
65
|
-
showWeekNumber: configProps.showWeekNumber,
|
|
66
|
-
testId: configProps.testId,
|
|
67
|
-
showAsFormattedText: configProps.showAsFormattedText,
|
|
68
|
-
additionalProps: configProps.additionalProps,
|
|
69
|
-
displayMode: configProps.displayMode,
|
|
70
|
-
variant: configProps.variant,
|
|
71
|
-
hasSuggestions: configProps.hasSuggestions,
|
|
72
|
-
validatemessage: '',
|
|
73
|
-
disabled: configProps.disabled,
|
|
74
|
-
readOnly: configProps.readOnly,
|
|
75
|
-
required: configProps.required
|
|
60
|
+
}
|
|
76
61
|
};
|
|
77
62
|
|
|
78
63
|
return (
|
|
@@ -92,6 +77,10 @@ BasePegaDxilMyDate.args = {
|
|
|
92
77
|
required: configProps.required,
|
|
93
78
|
status: configProps.status,
|
|
94
79
|
hideLabel: configProps.hideLabel,
|
|
80
|
+
nextYearRange: configProps.nextYearRange,
|
|
81
|
+
previousYearRange: configProps.previousYearRange,
|
|
82
|
+
showAsFormattedText: configProps.showAsFormattedText,
|
|
95
83
|
displayMode: configProps.displayMode,
|
|
84
|
+
variant: configProps.variant,
|
|
96
85
|
validatemessage: configProps.validatemessage
|
|
97
86
|
};
|
|
@@ -31,6 +31,9 @@ window.PCore.getEnvironmentInfo = () => {
|
|
|
31
31
|
|
|
32
32
|
export const BasePegaDxilMyDateTime: Story = args => {
|
|
33
33
|
const props = {
|
|
34
|
+
value: configProps.value,
|
|
35
|
+
additionalProps: configProps.additionalProps,
|
|
36
|
+
hasSuggestions: configProps.hasSuggestions,
|
|
34
37
|
getPConnect: () => {
|
|
35
38
|
return {
|
|
36
39
|
getActionsApi: () => {
|
|
@@ -54,24 +57,7 @@ export const BasePegaDxilMyDateTime: Story = args => {
|
|
|
54
57
|
acceptSuggestion: () => {/* nothing */},
|
|
55
58
|
clearErrorMessages: () => {/* nothing */}
|
|
56
59
|
};
|
|
57
|
-
}
|
|
58
|
-
value: configProps.value,
|
|
59
|
-
validatemessage: configProps.validatemessage,
|
|
60
|
-
label: configProps.label,
|
|
61
|
-
hideLabel: configProps.hideLabel,
|
|
62
|
-
helperText: configProps.helperText,
|
|
63
|
-
withSeconds: configProps.withSeconds,
|
|
64
|
-
nextYearRange: configProps.nextYearRange,
|
|
65
|
-
previousYearRange: configProps.previousYearRange,
|
|
66
|
-
showWeekNumber: configProps.showWeekNumber,
|
|
67
|
-
testId: configProps.testId,
|
|
68
|
-
additionalProps: configProps.additionalProps,
|
|
69
|
-
displayMode: configProps.displayMode,
|
|
70
|
-
variant: configProps.variant,
|
|
71
|
-
hasSuggestions: configProps.hasSuggestions,
|
|
72
|
-
disabled: configProps.disabled,
|
|
73
|
-
readOnly: configProps.readOnly,
|
|
74
|
-
required: configProps.required
|
|
60
|
+
}
|
|
75
61
|
};
|
|
76
62
|
|
|
77
63
|
return (
|
|
@@ -92,6 +78,9 @@ BasePegaDxilMyDateTime.args = {
|
|
|
92
78
|
required: configProps.required,
|
|
93
79
|
status: configProps.status,
|
|
94
80
|
hideLabel: configProps.hideLabel,
|
|
81
|
+
nextYearRange: configProps.nextYearRange,
|
|
82
|
+
previousYearRange: configProps.previousYearRange,
|
|
95
83
|
displayMode: configProps.displayMode,
|
|
84
|
+
variant: configProps.variant,
|
|
96
85
|
validatemessage: configProps.validatemessage
|
|
97
86
|
};
|
|
@@ -20,14 +20,7 @@ export const BasePegaDxilMyDecimal: Story = args => {
|
|
|
20
20
|
|
|
21
21
|
const props = {
|
|
22
22
|
value: configProps.value,
|
|
23
|
-
placeholder: configProps.placeholder,
|
|
24
|
-
label: configProps.label,
|
|
25
|
-
helperText: configProps.helperText,
|
|
26
|
-
showGroupSeparators: configProps.showGroupSeparators,
|
|
27
|
-
hasSuggestions: configProps.hasSuggestions,
|
|
28
|
-
testId: configProps.testId,
|
|
29
23
|
fieldMetadata,
|
|
30
|
-
validatemessage: '',
|
|
31
24
|
getPConnect: () => {
|
|
32
25
|
return {
|
|
33
26
|
getStateProps: () => {
|
|
@@ -66,5 +59,6 @@ BasePegaDxilMyDecimal.args = {
|
|
|
66
59
|
status: configProps.status,
|
|
67
60
|
hideLabel: configProps.hideLabel,
|
|
68
61
|
displayMode: configProps.displayMode,
|
|
62
|
+
variant: configProps.variant,
|
|
69
63
|
validatemessage: configProps.validatemessage
|
|
70
64
|
};
|
|
@@ -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;
|
|
@@ -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;
|
|
@@ -88,10 +88,6 @@ const renderField = resolvedProps => {
|
|
|
88
88
|
|
|
89
89
|
export const BasePegaDxilMyDetails: Story = args => {
|
|
90
90
|
const props = {
|
|
91
|
-
template: 'MyCo_MyComponents_NewDetailsTemplate',
|
|
92
|
-
showHighlightedData: true,
|
|
93
|
-
label: 'Test Details',
|
|
94
|
-
showLabel: true,
|
|
95
91
|
getPConnect: () => {
|
|
96
92
|
return {
|
|
97
93
|
getChildren: () => {
|
|
@@ -146,4 +142,8 @@ export const BasePegaDxilMyDetails: Story = args => {
|
|
|
146
142
|
);
|
|
147
143
|
};
|
|
148
144
|
|
|
149
|
-
BasePegaDxilMyDetails.args = {
|
|
145
|
+
BasePegaDxilMyDetails.args = {
|
|
146
|
+
showLabel: true,
|
|
147
|
+
label: 'Details template',
|
|
148
|
+
showHighlightedData: true
|
|
149
|
+
};
|