@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
|
@@ -1,13 +1,14 @@
|
|
|
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 StyledPegaDxilMyDetailsWrapper from './styles';
|
|
6
8
|
|
|
7
9
|
// includes in bundle
|
|
8
10
|
import { getAllFields } from './utils';
|
|
9
11
|
|
|
10
|
-
|
|
11
12
|
// interface for props
|
|
12
13
|
interface PegaDxilMyDetailsProps extends PConnFieldProps {
|
|
13
14
|
// If any, enter additional props that only exist on TextInput here
|
|
@@ -16,8 +17,6 @@ interface PegaDxilMyDetailsProps extends PConnFieldProps {
|
|
|
16
17
|
children: any;
|
|
17
18
|
}
|
|
18
19
|
|
|
19
|
-
// Duplicated runtime code from Constellation Design System Component
|
|
20
|
-
|
|
21
20
|
// props passed in combination of props from property panel (config.json) and run time props from Constellation
|
|
22
21
|
// any default values in config.pros should be set in defaultProps at bottom of this file
|
|
23
22
|
function PegaDxilMyDetails(props: PegaDxilMyDetailsProps) {
|
|
@@ -25,9 +24,17 @@ function PegaDxilMyDetails(props: PegaDxilMyDetailsProps) {
|
|
|
25
24
|
const { getPConnect, children, label, showLabel = true, showHighlightedData = false } = props;
|
|
26
25
|
const propsToUse = { label, showLabel, ...getPConnect().getInheritedProps() };
|
|
27
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
|
+
|
|
28
35
|
const numRegions = getAllFields(getPConnect)?.length;
|
|
29
36
|
const gridRepeat = "repeat(".concat(numRegions).concat(", 1fr)");
|
|
30
|
-
const gridContainer = { "colGap":
|
|
37
|
+
const gridContainer = { "colGap": 0};
|
|
31
38
|
// @ts-ignore
|
|
32
39
|
gridContainer.cols = gridRepeat;
|
|
33
40
|
// @ts-ignore
|
|
@@ -37,7 +44,7 @@ function PegaDxilMyDetails(props: PegaDxilMyDetailsProps) {
|
|
|
37
44
|
// @ts-ignore
|
|
38
45
|
gridHighlightContainer.cols = gridRepeat;
|
|
39
46
|
// @ts-ignore
|
|
40
|
-
gridHighlightContainer.alignItems = 'start';
|
|
47
|
+
gridHighlightContainer.alignItems = 'flex-start';
|
|
41
48
|
// @ts-ignore
|
|
42
49
|
gridHighlightContainer.pad = [0, 0, 2, 0];
|
|
43
50
|
|
|
@@ -48,33 +55,40 @@ function PegaDxilMyDetails(props: PegaDxilMyDetailsProps) {
|
|
|
48
55
|
const { highlightedData = [] } = getPConnect().getRawMetadata().config;
|
|
49
56
|
// @ts-ignore
|
|
50
57
|
highlightedDataArr = highlightedData.map((field) => {
|
|
51
|
-
field.config.displayMode = 'STACKED_LARGE_VAL';
|
|
52
58
|
|
|
53
|
-
|
|
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
|
+
return <HighlightRender field={field} props={props} />;
|
|
60
60
|
});
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
+
const hrStyle = {
|
|
64
|
+
line: {
|
|
65
|
+
margin: '0.75rem 0',
|
|
66
|
+
opacity: '50%'
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
|
|
63
70
|
return (
|
|
64
71
|
<StyledPegaDxilMyDetailsWrapper>
|
|
65
72
|
<FieldGroup name={propsToUse.showLabel ? propsToUse.label : ''}>
|
|
66
73
|
{showHighlightedData && highlightedDataArr.length > 0 && (
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
74
|
+
<>
|
|
75
|
+
<Flex
|
|
76
|
+
// @ts-ignore
|
|
77
|
+
container={{ direction: 'row', alignItems: 'normal', colGap: 10 }}
|
|
78
|
+
data-testid={`highlighted-column-count-${numRegions}`}
|
|
79
|
+
>
|
|
80
|
+
{highlightedDataArr.map((child: any, i: number) => (
|
|
81
|
+
<Fragment key={`hf-${i + 1}`}>{child}</Fragment>
|
|
82
|
+
))}
|
|
83
|
+
</Flex>
|
|
84
|
+
<hr style={hrStyle.line} />
|
|
85
|
+
</>
|
|
73
86
|
)}
|
|
74
87
|
<Grid container={gridContainer} data-testid={`column-count-${numRegions}`} >
|
|
75
88
|
{children.map((child: any, i: number) => (
|
|
76
|
-
|
|
77
|
-
{
|
|
89
|
+
// @ts-ignore
|
|
90
|
+
<Flex container={{ direction: 'column', alignItems: 'normal', colGap: 0, rowGap: 1.5 }} key={`r-${i + 1}`}>
|
|
91
|
+
<DetailsRender child={child} />
|
|
78
92
|
</Flex>
|
|
79
93
|
))}
|
|
80
94
|
</Grid>
|
|
@@ -20,13 +20,8 @@ export const BasePegaDxilMyEmail: Story = args => {
|
|
|
20
20
|
|
|
21
21
|
const props = {
|
|
22
22
|
value: configProps.value,
|
|
23
|
-
label: configProps.label,
|
|
24
|
-
placeholder: configProps.placeholder,
|
|
25
|
-
helperText: configProps.helperText,
|
|
26
|
-
testId: configProps.testId,
|
|
27
23
|
hasSuggestions: configProps.hasSuggestions,
|
|
28
24
|
fieldMetadata,
|
|
29
|
-
validatemessage: '',
|
|
30
25
|
getPConnect: () => {
|
|
31
26
|
return {
|
|
32
27
|
getStateProps: () => {
|
|
@@ -64,5 +59,6 @@ BasePegaDxilMyEmail.args = {
|
|
|
64
59
|
status: configProps.status,
|
|
65
60
|
hideLabel: configProps.hideLabel,
|
|
66
61
|
displayMode: configProps.displayMode,
|
|
62
|
+
variant: configProps.variant,
|
|
67
63
|
validatemessage: configProps.validatemessage
|
|
68
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;
|
|
@@ -139,8 +139,6 @@ const renderField = resolvedProps => {
|
|
|
139
139
|
|
|
140
140
|
export const BasePegaDxilMyForm: Story = args => {
|
|
141
141
|
const props = {
|
|
142
|
-
NumCols: 1,
|
|
143
|
-
template: 'DefaultForm',
|
|
144
142
|
getPConnect: () => {
|
|
145
143
|
return {
|
|
146
144
|
getChildren: () => {
|
|
@@ -181,4 +179,8 @@ export const BasePegaDxilMyForm: Story = args => {
|
|
|
181
179
|
);
|
|
182
180
|
};
|
|
183
181
|
|
|
184
|
-
BasePegaDxilMyForm.args = {
|
|
182
|
+
BasePegaDxilMyForm.args = {
|
|
183
|
+
showLabel: true,
|
|
184
|
+
label: 'Form template',
|
|
185
|
+
NumCols: 1,
|
|
186
|
+
};
|
|
@@ -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 StyledPegaDxilMyFormWrapper from './styles';
|
|
7
8
|
|
|
@@ -13,19 +14,41 @@ interface PegaDxilMyFormProps 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 PegaDxilMyForm(props: PegaDxilMyFormProps) {
|
|
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
|
+
<StyledPegaDxilMyFormWrapper>
|
|
36
|
+
<FieldGroup name={propsToUse.showLabel ? propsToUse.label : ''}>
|
|
37
|
+
<Grid container={gridContainer} data-testid={`column-count-${numRegions}`}>
|
|
38
|
+
{children.map((child: any, i: number) => (
|
|
39
|
+
<Flex
|
|
40
|
+
// @ts-ignore
|
|
41
|
+
container={{ direction: 'column', alignItems: 'normal', colGap: 0, rowGap: 1.5 }}
|
|
42
|
+
key={`r-${i + 1}`}
|
|
43
|
+
>
|
|
44
|
+
<DetailsRender child={child} />
|
|
45
|
+
</Flex>
|
|
46
|
+
))}
|
|
47
|
+
</Grid>
|
|
48
|
+
</FieldGroup>
|
|
49
|
+
</StyledPegaDxilMyFormWrapper>
|
|
50
|
+
);
|
|
51
|
+
}
|
|
29
52
|
return (
|
|
30
53
|
<StyledPegaDxilMyFormWrapper>
|
|
31
54
|
<FieldGroup name={propsToUse.showLabel ? propsToUse.label : ''}>
|
|
@@ -19,14 +19,8 @@ export const BasePegaDxilMyInteger: 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
|
-
showGroupSeparators: configProps.showGroupSeparators,
|
|
26
22
|
hasSuggestions: configProps.hasSuggestions,
|
|
27
|
-
testId: configProps.testId,
|
|
28
23
|
fieldMetadata,
|
|
29
|
-
validatemessage: '',
|
|
30
24
|
getPConnect: () => {
|
|
31
25
|
return {
|
|
32
26
|
getStateProps: () => {
|
|
@@ -56,6 +50,7 @@ export const BasePegaDxilMyInteger: Story = args => {
|
|
|
56
50
|
BasePegaDxilMyInteger.args = {
|
|
57
51
|
label: configProps.label,
|
|
58
52
|
helperText: configProps.helperText,
|
|
53
|
+
placeholder: configProps.placeholder,
|
|
59
54
|
showGroupSeparators: configProps.showGroupSeparators,
|
|
60
55
|
testId: configProps.testId,
|
|
61
56
|
readOnly: configProps.readOnly,
|
|
@@ -64,5 +59,6 @@ BasePegaDxilMyInteger.args = {
|
|
|
64
59
|
status: configProps.status,
|
|
65
60
|
hideLabel: configProps.hideLabel,
|
|
66
61
|
displayMode: configProps.displayMode,
|
|
62
|
+
variant: configProps.variant,
|
|
67
63
|
validatemessage: configProps.validatemessage
|
|
68
64
|
};
|
|
@@ -18,6 +18,7 @@ export default function GetNextWork(props: PegaDxilMyPageWorkProps) {
|
|
|
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: PegaDxilMyPageWorkProps) {
|
|
|
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
|
});
|
|
@@ -35,9 +35,7 @@ export const BasePegaDxilMyPage: Story = args => {
|
|
|
35
35
|
|
|
36
36
|
const props = {
|
|
37
37
|
useConfigurableLayout: false,
|
|
38
|
-
enableGetNextWork: pyHome1Raw.config.enableGetNextWork,
|
|
39
38
|
icon: pyHome1Raw.config.icon,
|
|
40
|
-
title: 'Page Template',
|
|
41
39
|
|
|
42
40
|
getPConnect: () => {
|
|
43
41
|
return {
|
|
@@ -108,4 +106,7 @@ export const BasePegaDxilMyPage: Story = args => {
|
|
|
108
106
|
);
|
|
109
107
|
};
|
|
110
108
|
|
|
111
|
-
BasePegaDxilMyPage.args = {
|
|
109
|
+
BasePegaDxilMyPage.args = {
|
|
110
|
+
title: 'Page Template',
|
|
111
|
+
enableGetNextWork: pyHome1Raw.config.enableGetNextWork,
|
|
112
|
+
};
|
|
@@ -20,13 +20,8 @@ type Story = StoryObj<typeof PegaDxilMyPageWidget>;
|
|
|
20
20
|
export const BasePegaDxilMyPageWidget: Story = args => {
|
|
21
21
|
|
|
22
22
|
const props = {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
description: configProps.description,
|
|
26
|
-
image: configProps.image,
|
|
27
|
-
datasource: configProps.datasource,
|
|
28
|
-
whatsnewlink: configProps.whatsnewlink
|
|
29
|
-
};
|
|
23
|
+
image: configProps.image
|
|
24
|
+
};
|
|
30
25
|
|
|
31
26
|
return (
|
|
32
27
|
<>
|
|
@@ -37,5 +32,7 @@ return (
|
|
|
37
32
|
|
|
38
33
|
BasePegaDxilMyPageWidget.args = {
|
|
39
34
|
header: configProps.header,
|
|
40
|
-
description: configProps.description
|
|
35
|
+
description: configProps.description,
|
|
36
|
+
whatsnewlink: configProps.whatsnewlink,
|
|
37
|
+
datasource: configProps.datasource,
|
|
41
38
|
};
|
|
@@ -20,13 +20,8 @@ export const BasePegaDxilMyParagraph: 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
|
-
testId: configProps.testId,
|
|
27
23
|
hasSuggestions: configProps.hasSuggestions,
|
|
28
24
|
fieldMetadata,
|
|
29
|
-
validatemessage: '',
|
|
30
25
|
getPConnect: () => {
|
|
31
26
|
return {
|
|
32
27
|
getStateProps: () => {
|
|
@@ -64,5 +59,6 @@ BasePegaDxilMyParagraph.args = {
|
|
|
64
59
|
status: configProps.status,
|
|
65
60
|
hideLabel: configProps.hideLabel,
|
|
66
61
|
displayMode: configProps.displayMode,
|
|
62
|
+
variant: configProps.variant,
|
|
67
63
|
validatemessage: configProps.validatemessage
|
|
68
64
|
};
|
|
@@ -20,14 +20,8 @@ export const BasePegaDxilMyPercentage: 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
23
|
hasSuggestions: configProps.hasSuggestions,
|
|
28
|
-
testId: configProps.testId,
|
|
29
24
|
fieldMetadata,
|
|
30
|
-
validatemessage: '',
|
|
31
25
|
getPConnect: () => {
|
|
32
26
|
return {
|
|
33
27
|
getStateProps: () => {
|
|
@@ -57,6 +51,7 @@ export const BasePegaDxilMyPercentage: Story = args => {
|
|
|
57
51
|
BasePegaDxilMyPercentage.args = {
|
|
58
52
|
label: configProps.label,
|
|
59
53
|
helperText: configProps.helperText,
|
|
54
|
+
placeholder: configProps.placeholder,
|
|
60
55
|
showGroupSeparators: configProps.showGroupSeparators,
|
|
61
56
|
testId: configProps.testId,
|
|
62
57
|
readOnly: configProps.readOnly,
|
|
@@ -65,5 +60,6 @@ BasePegaDxilMyPercentage.args = {
|
|
|
65
60
|
status: configProps.status,
|
|
66
61
|
hideLabel: configProps.hideLabel,
|
|
67
62
|
displayMode: configProps.displayMode,
|
|
63
|
+
variant: configProps.variant,
|
|
68
64
|
validatemessage: configProps.validatemessage
|
|
69
65
|
};
|
|
@@ -19,12 +19,7 @@ export const BasePegaDxilMyPhone: Story = args => {
|
|
|
19
19
|
|
|
20
20
|
const props = {
|
|
21
21
|
value: configProps.value,
|
|
22
|
-
placeholder: configProps.placeholder,
|
|
23
|
-
label: configProps.label,
|
|
24
|
-
testId: configProps.testId,
|
|
25
22
|
hasSuggestions: configProps.hasSuggestions,
|
|
26
|
-
datasource: configProps.datasource,
|
|
27
|
-
validatemessage: '',
|
|
28
23
|
getPConnect: () => {
|
|
29
24
|
return {
|
|
30
25
|
getStateProps: () => {
|
|
@@ -52,6 +47,7 @@ export const BasePegaDxilMyPhone: Story = args => {
|
|
|
52
47
|
};
|
|
53
48
|
|
|
54
49
|
BasePegaDxilMyPhone.args = {
|
|
50
|
+
datasource: configProps.datasource,
|
|
55
51
|
label: configProps.label,
|
|
56
52
|
helperText: configProps.helperText,
|
|
57
53
|
placeholder: configProps.placeholder,
|
|
@@ -62,5 +58,6 @@ BasePegaDxilMyPhone.args = {
|
|
|
62
58
|
status: configProps.status,
|
|
63
59
|
hideLabel: configProps.hideLabel,
|
|
64
60
|
displayMode: configProps.displayMode,
|
|
61
|
+
variant: configProps.variant,
|
|
65
62
|
validatemessage: configProps.validatemessage
|
|
66
63
|
};
|
|
@@ -23,14 +23,8 @@ export const BasePegaDxilMyPicklist: Story = args => {
|
|
|
23
23
|
|
|
24
24
|
const props = {
|
|
25
25
|
value,
|
|
26
|
-
placeholder: configProps.placeholder,
|
|
27
|
-
label: configProps.label,
|
|
28
|
-
helperText: configProps.helperText,
|
|
29
|
-
datasource: configProps.datasource,
|
|
30
|
-
testId: configProps.testId,
|
|
31
26
|
hasSuggestions: configProps.hasSuggestions,
|
|
32
27
|
fieldMetadata,
|
|
33
|
-
validatemessage: '',
|
|
34
28
|
getPConnect: () => {
|
|
35
29
|
return {
|
|
36
30
|
getConfigProps: () => {
|
|
@@ -84,6 +78,7 @@ export const BasePegaDxilMyPicklist: Story = args => {
|
|
|
84
78
|
};
|
|
85
79
|
|
|
86
80
|
BasePegaDxilMyPicklist.args = {
|
|
81
|
+
datasource: configProps.datasource,
|
|
87
82
|
label: configProps.label,
|
|
88
83
|
helperText: configProps.helperText,
|
|
89
84
|
placeholder: configProps.placeholder,
|
|
@@ -94,5 +89,6 @@ BasePegaDxilMyPicklist.args = {
|
|
|
94
89
|
status: configProps.status,
|
|
95
90
|
hideLabel: configProps.hideLabel,
|
|
96
91
|
displayMode: configProps.displayMode,
|
|
92
|
+
variant: configProps.variant,
|
|
97
93
|
validatemessage: configProps.validatemessage
|
|
98
94
|
};
|
package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyRadioButtons/demo.stories.tsx
CHANGED
|
@@ -23,15 +23,8 @@ export const BasePegaDxilMyRadiobuttons: Story = args => {
|
|
|
23
23
|
|
|
24
24
|
const props = {
|
|
25
25
|
value,
|
|
26
|
-
placeholder: configProps.placeholder,
|
|
27
|
-
label: configProps.label,
|
|
28
|
-
helperText: configProps.helperText,
|
|
29
|
-
datasource: configProps.datasource,
|
|
30
|
-
inline: configProps.inline,
|
|
31
|
-
testId: configProps.testId,
|
|
32
26
|
hasSuggestions: configProps.hasSuggestions,
|
|
33
27
|
fieldMetadata,
|
|
34
|
-
validatemessage: '',
|
|
35
28
|
getPConnect: () => {
|
|
36
29
|
return {
|
|
37
30
|
getConfigProps: () => {
|
|
@@ -88,6 +81,7 @@ export const BasePegaDxilMyRadiobuttons: Story = args => {
|
|
|
88
81
|
};
|
|
89
82
|
|
|
90
83
|
BasePegaDxilMyRadiobuttons.args = {
|
|
84
|
+
datasource: configProps.datasource,
|
|
91
85
|
label: configProps.label,
|
|
92
86
|
helperText: configProps.helperText,
|
|
93
87
|
placeholder: configProps.placeholder,
|
|
@@ -24,19 +24,11 @@ export const BasePegaDxilMySearchbox: Story = args => {
|
|
|
24
24
|
|
|
25
25
|
const props = {
|
|
26
26
|
value,
|
|
27
|
-
placeholder: configProps.placeholder,
|
|
28
|
-
label: configProps.label,
|
|
29
|
-
helperText: configProps.helperText,
|
|
30
|
-
datasource: configProps.datasource,
|
|
31
|
-
testId: configProps.testId,
|
|
32
27
|
hasSuggestions: configProps.hasSuggestions,
|
|
33
28
|
columns: [],
|
|
34
|
-
isTableFormatter: false,
|
|
35
29
|
listType: 'associated',
|
|
36
|
-
parameters: {},
|
|
37
30
|
datasourceMetadata,
|
|
38
31
|
fieldMetadata,
|
|
39
|
-
validatemessage: '',
|
|
40
32
|
getPConnect: () => {
|
|
41
33
|
return {
|
|
42
34
|
getConfigProps: () => {
|
|
@@ -93,9 +85,11 @@ export const BasePegaDxilMySearchbox: Story = args => {
|
|
|
93
85
|
};
|
|
94
86
|
|
|
95
87
|
BasePegaDxilMySearchbox.args = {
|
|
88
|
+
datasource: configProps.datasource,
|
|
96
89
|
label: configProps.label,
|
|
97
90
|
helperText: configProps.helperText,
|
|
98
91
|
placeholder: configProps.placeholder,
|
|
92
|
+
parameters: {},
|
|
99
93
|
isTableFormatter: false,
|
|
100
94
|
testId: configProps.testId,
|
|
101
95
|
readOnly: configProps.readOnly,
|
|
@@ -645,12 +645,14 @@ function PegaDxilMySearchbox(props: PegaDxilMySearchboxProps) {
|
|
|
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 PegaDxilMySearchbox(props: PegaDxilMySearchboxProps) {
|
|
|
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 PegaDxilMySearchbox(props: PegaDxilMySearchboxProps) {
|
|
|
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 PegaDxilMySearchbox(props: PegaDxilMySearchboxProps) {
|
|
|
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 PegaDxilMySearchbox(props: PegaDxilMySearchboxProps) {
|
|
|
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 PegaDxilMySearchbox(props: PegaDxilMySearchboxProps) {
|
|
|
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
|
});
|