@pega/custom-dx-components 0.24.12 → 0.24.14
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/build-all/helper.js +6 -0
- package/src/tasks/build-comp/helper.js +8 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS/{DetailsRender.tsx → DetailsRender.tsx.mustache} +7 -10
- package/src/tasks/create/templates/Constellation/Template/DETAILS/{HighlightRender.tsx → HighlightRender.tsx.mustache} +12 -13
- package/src/tasks/create/templates/Constellation/Template/DETAILS/demo.stories.tsx.mustache +27 -7
- package/src/tasks/create/templates/Constellation/Template/DETAILS/index.tsx.mustache +26 -33
- package/src/tasks/create/templates/Constellation/Template/DETAILS/mock.ts.mustache +13 -14
- package/src/tasks/create/templates/Constellation/Template/DETAILS/styles.ts.mustache +16 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/{DetailsRender.tsx → DetailsRender.tsx.mustache} +7 -10
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/{HighlightRender.tsx → HighlightRender.tsx.mustache} +12 -13
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/demo.stories.tsx.mustache +45 -10
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/index.tsx.mustache +19 -41
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/mock.ts.mustache +13 -10
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/styles.ts.mustache +15 -0
- package/src/tasks/create/templates/Constellation/Template/PAGE/localizations.json.mustache +4 -2
- package/src/tasks/create/templates/Constellation/Widget/PAGE/demo.stories.tsx.mustache +5 -5
- package/src/tasks/create/templates/Constellation/Widget/PAGE/index.tsx.mustache +1 -1
- package/src/tasks/create/templates/Launchpad/Widget/PAGE/demo.stories.tsx.mustache +1 -1
- package/src/tasks/create/templates/Launchpad/Widget/PAGE/index.tsx.mustache +1 -1
- package/src/tasks/init/template/package.json.mustache +1 -1
- package/src/tasks/publish/helper.js +6 -0
- package/src/tasks/publish-all/helper.js +6 -0
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDetails/DetailsRender.tsx +4 -10
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDetails/HighlightRender.tsx +9 -13
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDetails/demo.stories.tsx +27 -7
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDetails/index.tsx +26 -33
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDetails/mock.ts +13 -14
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDetails/styles.ts +16 -0
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPage/localizations.json +4 -2
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPageWidget/demo.stories.tsx +5 -5
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPageWidget/index.tsx +1 -1
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTwoColumnDetails/DetailsRender.tsx +4 -10
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTwoColumnDetails/HighlightRender.tsx +9 -13
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTwoColumnDetails/demo.stories.tsx +45 -10
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTwoColumnDetails/index.tsx +19 -41
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTwoColumnDetails/mock.ts +13 -10
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTwoColumnDetails/styles.ts +15 -0
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDetails/DetailsRender.tsx +4 -10
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDetails/HighlightRender.tsx +9 -13
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDetails/demo.stories.tsx +27 -7
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDetails/index.tsx +26 -33
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDetails/mock.ts +13 -14
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDetails/styles.ts +16 -0
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPage/localizations.json +4 -2
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPageWidget/demo.stories.tsx +1 -1
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPageWidget/index.tsx +1 -1
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnDetails/DetailsRender.tsx +4 -10
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnDetails/HighlightRender.tsx +9 -13
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnDetails/demo.stories.tsx +45 -10
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnDetails/index.tsx +19 -41
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnDetails/mock.ts +13 -10
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnDetails/styles.ts +15 -0
package/package.json
CHANGED
|
@@ -56,11 +56,17 @@ export const zipComponent = async (componentKey) => {
|
|
|
56
56
|
const srcDirectory = await getComponentDirectoryPath(componentKey);
|
|
57
57
|
const buildDirectory = await path.join(path.resolve(), 'dist/components', componentKey);
|
|
58
58
|
const configJson = `${srcDirectory}/config.json`;
|
|
59
|
+
const localizationJson = `${srcDirectory}/localizations.json`;
|
|
59
60
|
|
|
60
61
|
const zip = new AdmZip();
|
|
61
62
|
|
|
62
63
|
zip.addLocalFolder(srcDirectory, 'src/');
|
|
63
64
|
zip.addLocalFile(configJson);
|
|
65
|
+
|
|
66
|
+
if (fs.existsSync(localizationJson)) {
|
|
67
|
+
zip.addLocalFile(localizationJson);
|
|
68
|
+
}
|
|
69
|
+
|
|
64
70
|
zip.addLocalFolder(buildDirectory);
|
|
65
71
|
const zipContent = zip.toBuffer().toString('base64');
|
|
66
72
|
|
|
@@ -46,13 +46,21 @@ export const zipComponent = async (componentKey) => {
|
|
|
46
46
|
const buildDirectory = await path.join(path.resolve(), 'dist/components', componentKey);
|
|
47
47
|
const configJson = `${srcDirectory}/config.json`;
|
|
48
48
|
|
|
49
|
+
const localizationJson = `${srcDirectory}/localizations.json`;
|
|
50
|
+
|
|
49
51
|
const zip = new AdmZip();
|
|
50
52
|
|
|
51
53
|
zip.addLocalFolder(srcDirectory, 'src/');
|
|
52
54
|
zip.addLocalFile(configJson);
|
|
55
|
+
|
|
56
|
+
if (fs.existsSync(localizationJson)) {
|
|
57
|
+
zip.addLocalFile(localizationJson);
|
|
58
|
+
}
|
|
59
|
+
|
|
53
60
|
zip.addLocalFolder(buildDirectory);
|
|
54
61
|
const zipContent = zip.toBuffer().toString('base64');
|
|
55
62
|
|
|
63
|
+
|
|
56
64
|
const configContent = Buffer.from(fs.readFileSync(`${srcDirectory}/config.json`)).toString();
|
|
57
65
|
if (fs.existsSync('dist/components')) {
|
|
58
66
|
fs.rm('dist/components', { recursive: true }, err => {
|
|
@@ -13,7 +13,7 @@ const DetailsRender = (props: DetailsRenderProps) => {
|
|
|
13
13
|
|
|
14
14
|
const displayCompArr: ReactElement[] = [];
|
|
15
15
|
|
|
16
|
-
Object.values(kids).forEach((value: any) => {
|
|
16
|
+
Object.values(kids).forEach((value: any, i :number) => {
|
|
17
17
|
const { type } = value.getPConnect().getRawMetadata();
|
|
18
18
|
const { hideLabel, variant, testId, label } = value
|
|
19
19
|
.getPConnect()
|
|
@@ -21,6 +21,7 @@ const DetailsRender = (props: DetailsRenderProps) => {
|
|
|
21
21
|
|
|
22
22
|
let displayComp;
|
|
23
23
|
const key = JSON.stringify(value.getPConnect());
|
|
24
|
+
const key1 = key.concat(`-${i}`);
|
|
24
25
|
|
|
25
26
|
if (type === 'reference') {
|
|
26
27
|
const refElement = value.getPConnect().getComponent();
|
|
@@ -30,23 +31,19 @@ const DetailsRender = (props: DetailsRenderProps) => {
|
|
|
30
31
|
const element = value.getPConnect().getComponent();
|
|
31
32
|
const displayEl = <Fragment key={key}>{element}</Fragment>;
|
|
32
33
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
columnGap: '0'
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
// const myEl = <div>boo</div>;
|
|
34
|
+
{{! pick new delimiters for mustache }}
|
|
35
|
+
{{=<% %>=}}
|
|
40
36
|
displayComp = (
|
|
41
|
-
<Fragment key={
|
|
37
|
+
<Fragment key={key1}>
|
|
42
38
|
<FieldValueList
|
|
43
|
-
style={
|
|
39
|
+
style={{ columnGap: '0'}}
|
|
44
40
|
variant={hideLabel ? 'stacked' : variant}
|
|
45
41
|
data-testid={testId}
|
|
46
42
|
fields={[{ id: '1', name: hideLabel ? '' : label, value: displayEl }]}
|
|
47
43
|
/>
|
|
48
44
|
</Fragment>
|
|
49
45
|
);
|
|
46
|
+
<%={{ }}=%> {{! revert delimiters for mustache }}
|
|
50
47
|
|
|
51
48
|
displayCompArr.push(displayComp);
|
|
52
49
|
}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { FieldValueList, Text } from '@pega/cosmos-react-core';
|
|
4
|
+
import type { PConnProps } from './PConnProps';
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
interface HighlightRenderProps extends PConnProps {
|
|
7
|
+
field?: any;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const HighlightRender = (props: HighlightRenderProps) => {
|
|
11
|
+
const { getPConnect, field } = props;
|
|
8
12
|
|
|
9
13
|
field.config['displayMode'] = 'DISPLAY_ONLY';
|
|
10
14
|
|
|
@@ -16,20 +20,14 @@ const HighlightRender = (data: any) => {
|
|
|
16
20
|
|
|
17
21
|
const configProps = getPConnect().resolveConfigProps(field.config);
|
|
18
22
|
|
|
19
|
-
//
|
|
20
|
-
|
|
23
|
+
// @ts-ignore
|
|
21
24
|
const reactField = getPConnect().createComponent(field);
|
|
22
|
-
// const reactField = field.getPConnect().getComponent();
|
|
23
|
-
|
|
24
|
-
const styles = {
|
|
25
|
-
myWidth: {
|
|
26
|
-
width: 'auto'
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
25
|
|
|
30
26
|
return (
|
|
27
|
+
{{! pick new delimiters for mustache }}
|
|
28
|
+
{{=<% %>=}}
|
|
31
29
|
<FieldValueList
|
|
32
|
-
style={
|
|
30
|
+
style={{ width: 'auto' }}
|
|
33
31
|
variant='stacked'
|
|
34
32
|
data-testid={field.testId}
|
|
35
33
|
fields={[
|
|
@@ -44,6 +42,7 @@ const HighlightRender = (data: any) => {
|
|
|
44
42
|
}
|
|
45
43
|
]}
|
|
46
44
|
/>
|
|
45
|
+
<%={{ }}=%> {{! revert delimiters for mustache }}
|
|
47
46
|
);
|
|
48
47
|
};
|
|
49
48
|
|
|
@@ -20,6 +20,10 @@ const meta: Meta<typeof {{COMPONENT_CLASS_NAME}}> = {
|
|
|
20
20
|
export default meta;
|
|
21
21
|
type Story = StoryObj<typeof {{COMPONENT_CLASS_NAME}}>;
|
|
22
22
|
|
|
23
|
+
const Region = props => {
|
|
24
|
+
return <></>;
|
|
25
|
+
};
|
|
26
|
+
|
|
23
27
|
const renderField = resolvedProps => {
|
|
24
28
|
const {
|
|
25
29
|
displayAsStatus = false,
|
|
@@ -124,20 +128,36 @@ export const Base{{COMPONENT_CLASS_NAME}}: Story = args => {
|
|
|
124
128
|
setInheritedProp: () => {
|
|
125
129
|
/* nothing */
|
|
126
130
|
},
|
|
127
|
-
resolveConfigProps:
|
|
128
|
-
|
|
131
|
+
resolveConfigProps: config => {
|
|
132
|
+
return config;
|
|
129
133
|
}
|
|
130
134
|
};
|
|
131
135
|
}
|
|
132
136
|
};
|
|
133
137
|
|
|
134
|
-
const regionAChildren = pyReviewRaw.children[0].children.map(child => {
|
|
135
|
-
return props.getPConnect().createComponent(child);
|
|
136
|
-
});
|
|
137
|
-
|
|
138
138
|
return (
|
|
139
139
|
<>
|
|
140
|
-
<{{COMPONENT_CLASS_NAME}} {...props} {...args}>
|
|
140
|
+
<{{COMPONENT_CLASS_NAME}} {...props} {...args}>
|
|
141
|
+
<Region
|
|
142
|
+
{...{
|
|
143
|
+
getPConnect: () => ({
|
|
144
|
+
setInheritedProp: () => {},
|
|
145
|
+
getChildren: () =>
|
|
146
|
+
pyReviewRaw.children[0].children.map((child, index) => {
|
|
147
|
+
return {
|
|
148
|
+
getPConnect: () => ({
|
|
149
|
+
getRawMetadata: () => pyReviewRaw.children[0].children[index],
|
|
150
|
+
getConfigProps: () => {},
|
|
151
|
+
resolveConfigProps: () => regionChildrenResolved[index],
|
|
152
|
+
getComponent: config =>
|
|
153
|
+
props.getPConnect().createComponent(pyReviewRaw.children[0].children[index])
|
|
154
|
+
})
|
|
155
|
+
};
|
|
156
|
+
})
|
|
157
|
+
})
|
|
158
|
+
}}
|
|
159
|
+
/>
|
|
160
|
+
</{{COMPONENT_CLASS_NAME}}>
|
|
141
161
|
</>
|
|
142
162
|
);
|
|
143
163
|
};
|
|
@@ -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 Styled{{COMPONENT_CLASS_NAME}}Wrapper from './styles';
|
|
7
|
+
import Styled{{COMPONENT_CLASS_NAME}}Wrapper, { StyledDetailsGridContainer, StyledHighlightedFieldsHrLine } from './styles';
|
|
8
8
|
|
|
9
9
|
// includes in bundle
|
|
10
10
|
import { getAllFields } from './utils';
|
|
@@ -21,33 +21,30 @@ interface {{COMPONENT_CLASS_NAME}}Props extends PConnFieldProps {
|
|
|
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) {
|
|
23
23
|
|
|
24
|
-
const { getPConnect,
|
|
24
|
+
const { getPConnect, label, showLabel = true, showHighlightedData = false } = props;
|
|
25
25
|
const propsToUse = { label, showLabel, ...getPConnect().getInheritedProps() };
|
|
26
26
|
|
|
27
|
-
//
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
kid.props.getPConnect().setInheritedProp('readOnly', true);
|
|
32
|
-
kid.props.getPConnect().setInheritedProp('displayMode', 'DISPLAY_ONLY');
|
|
27
|
+
// storybook doesn't get children of 1 as an array of 1
|
|
28
|
+
let { children } = props;
|
|
29
|
+
if (!Array.isArray(children)) {
|
|
30
|
+
children = Children.toArray(children);
|
|
33
31
|
}
|
|
34
32
|
|
|
33
|
+
// update children with readonly
|
|
34
|
+
Children.toArray(children).forEach(child => {
|
|
35
|
+
// @ts-ignore
|
|
36
|
+
child.props.getPConnect().setInheritedProp('readOnly', true);
|
|
37
|
+
// @ts-ignore
|
|
38
|
+
child.props.getPConnect().setInheritedProp('displayMode', 'DISPLAY_ONLY');
|
|
39
|
+
});
|
|
40
|
+
|
|
35
41
|
const numRegions = getAllFields(getPConnect)?.length;
|
|
36
42
|
const gridRepeat = "repeat(".concat(numRegions).concat(", 1fr)");
|
|
37
|
-
|
|
38
|
-
|
|
43
|
+
|
|
44
|
+
const gridContainer: GridContainerProps = { colGap: 0 };
|
|
39
45
|
gridContainer.cols = gridRepeat;
|
|
40
|
-
// @ts-ignore
|
|
41
46
|
gridContainer.alignItems = 'start';
|
|
42
47
|
|
|
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
48
|
// Set up highlighted data to pass in return if is set to show, need raw metadata to pass to createComponent
|
|
52
49
|
let highlightedDataArr = [];
|
|
53
50
|
if (showHighlightedData) {
|
|
@@ -55,17 +52,10 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
|
|
|
55
52
|
const { highlightedData = [] } = getPConnect().getRawMetadata().config;
|
|
56
53
|
// @ts-ignore
|
|
57
54
|
highlightedDataArr = highlightedData.map((field) => {
|
|
58
|
-
|
|
59
|
-
return <HighlightRender field={field} props={props} />;
|
|
55
|
+
return <HighlightRender field={field} getPConnect={props.getPConnect} />;
|
|
60
56
|
});
|
|
61
57
|
}
|
|
62
58
|
|
|
63
|
-
const hrStyle = {
|
|
64
|
-
line: {
|
|
65
|
-
margin: '0.75rem 0',
|
|
66
|
-
opacity: '50%'
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
59
|
|
|
70
60
|
return (
|
|
71
61
|
<Styled{{COMPONENT_CLASS_NAME}}Wrapper>
|
|
@@ -79,15 +69,18 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
|
|
|
79
69
|
container={{ direction: 'row', alignItems: 'normal', colGap: 10 }}
|
|
80
70
|
data-testid={`highlighted-column-count-${numRegions}`}
|
|
81
71
|
>
|
|
82
|
-
{highlightedDataArr.map((child:
|
|
72
|
+
{highlightedDataArr.map((child: ReactElement, i: number) => (
|
|
83
73
|
<Fragment key={`hf-${i + 1}`}>{child}</Fragment>
|
|
84
74
|
))}
|
|
85
75
|
</Flex>
|
|
86
|
-
<
|
|
76
|
+
<StyledHighlightedFieldsHrLine />
|
|
87
77
|
</>
|
|
88
78
|
)}
|
|
89
|
-
<Grid
|
|
90
|
-
|
|
79
|
+
<Grid
|
|
80
|
+
as={StyledDetailsGridContainer}
|
|
81
|
+
container={gridContainer}
|
|
82
|
+
data-testid={`column-count-${numRegions}`} >
|
|
83
|
+
{children.map((child: ReactElement, i: number) => (
|
|
91
84
|
|
|
92
85
|
<Flex
|
|
93
86
|
// @ts-ignore
|
|
@@ -17,7 +17,7 @@ export const pyReviewRaw = {
|
|
|
17
17
|
config: {
|
|
18
18
|
value: '@P .pyStatusWork',
|
|
19
19
|
label: '@L Work Status',
|
|
20
|
-
|
|
20
|
+
hideLabel: true,
|
|
21
21
|
displayAsStatus: true,
|
|
22
22
|
key: 'pyStatusWork'
|
|
23
23
|
}
|
|
@@ -27,7 +27,7 @@ export const pyReviewRaw = {
|
|
|
27
27
|
config: {
|
|
28
28
|
value: '@P .pyID',
|
|
29
29
|
label: '@L Case ID',
|
|
30
|
-
|
|
30
|
+
hideLabel: true,
|
|
31
31
|
key: 'pyID'
|
|
32
32
|
}
|
|
33
33
|
},
|
|
@@ -36,7 +36,7 @@ export const pyReviewRaw = {
|
|
|
36
36
|
config: {
|
|
37
37
|
value: '@P .pxCreateDateTime',
|
|
38
38
|
label: '@L Create date/time',
|
|
39
|
-
|
|
39
|
+
hideLabel: true,
|
|
40
40
|
key: 'pxCreateDateTime'
|
|
41
41
|
}
|
|
42
42
|
},
|
|
@@ -44,9 +44,9 @@ export const pyReviewRaw = {
|
|
|
44
44
|
type: 'UserReference',
|
|
45
45
|
config: {
|
|
46
46
|
label: '@L Create Operator',
|
|
47
|
+
hideLabel: true,
|
|
47
48
|
value: '@USER .pxCreateOperator',
|
|
48
49
|
placeholder: 'Select...',
|
|
49
|
-
displayMode: 'STACKED_LARGE_VAL',
|
|
50
50
|
key: 'pxCreateOperator'
|
|
51
51
|
}
|
|
52
52
|
}
|
|
@@ -120,7 +120,6 @@ export const pyReviewResolved = {
|
|
|
120
120
|
config: {
|
|
121
121
|
value: 'New',
|
|
122
122
|
label: 'Work Status',
|
|
123
|
-
displayMode: 'STACKED_LARGE_VAL',
|
|
124
123
|
displayAsStatus: true
|
|
125
124
|
}
|
|
126
125
|
},
|
|
@@ -128,16 +127,14 @@ export const pyReviewResolved = {
|
|
|
128
127
|
type: 'TextInput',
|
|
129
128
|
config: {
|
|
130
129
|
value: 'M-1002',
|
|
131
|
-
label: 'Case ID'
|
|
132
|
-
displayMode: 'STACKED_LARGE_VAL'
|
|
130
|
+
label: 'Case ID'
|
|
133
131
|
}
|
|
134
132
|
},
|
|
135
133
|
{
|
|
136
134
|
type: 'DateTime',
|
|
137
135
|
config: {
|
|
138
136
|
value: '2022-12-11T20:06:27.232Z',
|
|
139
|
-
label: 'Create date/time'
|
|
140
|
-
displayMode: 'STACKED_LARGE_VAL'
|
|
137
|
+
label: 'Create date/time'
|
|
141
138
|
}
|
|
142
139
|
},
|
|
143
140
|
{
|
|
@@ -148,8 +145,7 @@ export const pyReviewResolved = {
|
|
|
148
145
|
userId: 'conns',
|
|
149
146
|
userName: 'Sara Connor'
|
|
150
147
|
},
|
|
151
|
-
placeholder: 'Select...'
|
|
152
|
-
displayMode: 'STACKED_LARGE_VAL'
|
|
148
|
+
placeholder: 'Select...'
|
|
153
149
|
}
|
|
154
150
|
}
|
|
155
151
|
],
|
|
@@ -159,22 +155,25 @@ export const pyReviewResolved = {
|
|
|
159
155
|
export const regionChildrenResolved = [
|
|
160
156
|
{
|
|
161
157
|
readOnly: true,
|
|
162
|
-
value: '',
|
|
158
|
+
value: 'Deadline',
|
|
163
159
|
label: 'SLA Deadline',
|
|
160
|
+
hideLabel: true,
|
|
164
161
|
displayMode: 'LABELS_LEFT',
|
|
165
162
|
key: 'SLA Deadline'
|
|
166
163
|
},
|
|
167
164
|
{
|
|
168
165
|
readOnly: true,
|
|
169
|
-
value: '',
|
|
166
|
+
value: 'Goal',
|
|
170
167
|
label: 'SLA Goal',
|
|
168
|
+
hideLabel: true,
|
|
171
169
|
displayMode: 'LABELS_LEFT',
|
|
172
170
|
key: 'SLA Goal'
|
|
173
171
|
},
|
|
174
172
|
{
|
|
175
173
|
readOnly: true,
|
|
176
|
-
value: '',
|
|
174
|
+
value: 'Start Time',
|
|
177
175
|
label: 'SLA Start Time',
|
|
176
|
+
hideLabel: true,
|
|
178
177
|
listType: 'associated',
|
|
179
178
|
datasource: [
|
|
180
179
|
{
|
|
@@ -6,3 +6,19 @@ 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
|
+
|
|
17
|
+
export const StyledHighlightedFieldsHrLine = styled.hr(() => {
|
|
18
|
+
return css`
|
|
19
|
+
line: {
|
|
20
|
+
margin: '0.75rem 0';
|
|
21
|
+
opacity: '50%'
|
|
22
|
+
}
|
|
23
|
+
`;
|
|
24
|
+
});
|
|
@@ -13,7 +13,7 @@ const DetailsRender = (props: DetailsRenderProps) => {
|
|
|
13
13
|
|
|
14
14
|
const displayCompArr: ReactElement[] = [];
|
|
15
15
|
|
|
16
|
-
Object.values(kids).forEach((value: any) => {
|
|
16
|
+
Object.values(kids).forEach((value: any, i :number) => {
|
|
17
17
|
const { type } = value.getPConnect().getRawMetadata();
|
|
18
18
|
const { hideLabel, variant, testId, label } = value
|
|
19
19
|
.getPConnect()
|
|
@@ -21,6 +21,7 @@ const DetailsRender = (props: DetailsRenderProps) => {
|
|
|
21
21
|
|
|
22
22
|
let displayComp;
|
|
23
23
|
const key = JSON.stringify(value.getPConnect());
|
|
24
|
+
const key1 = key.concat(`-${i}`);
|
|
24
25
|
|
|
25
26
|
if (type === 'reference') {
|
|
26
27
|
const refElement = value.getPConnect().getComponent();
|
|
@@ -30,23 +31,19 @@ const DetailsRender = (props: DetailsRenderProps) => {
|
|
|
30
31
|
const element = value.getPConnect().getComponent();
|
|
31
32
|
const displayEl = <Fragment key={key}>{element}</Fragment>;
|
|
32
33
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
columnGap: '0'
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
// const myEl = <div>boo</div>;
|
|
34
|
+
{{! pick new delimiters for mustache }}
|
|
35
|
+
{{=<% %>=}}
|
|
40
36
|
displayComp = (
|
|
41
|
-
<Fragment key={
|
|
37
|
+
<Fragment key={key1}>
|
|
42
38
|
<FieldValueList
|
|
43
|
-
style={
|
|
39
|
+
style={{ columnGap: '0'}}
|
|
44
40
|
variant={hideLabel ? 'stacked' : variant}
|
|
45
41
|
data-testid={testId}
|
|
46
42
|
fields={[{ id: '1', name: hideLabel ? '' : label, value: displayEl }]}
|
|
47
43
|
/>
|
|
48
44
|
</Fragment>
|
|
49
45
|
);
|
|
46
|
+
<%={{ }}=%> {{! revert delimiters for mustache }}
|
|
50
47
|
|
|
51
48
|
displayCompArr.push(displayComp);
|
|
52
49
|
}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { FieldValueList, Text } from '@pega/cosmos-react-core';
|
|
4
|
+
import type { PConnProps } from './PConnProps';
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
interface HighlightRenderProps extends PConnProps {
|
|
7
|
+
field?: any;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const HighlightRender = (props: HighlightRenderProps) => {
|
|
11
|
+
const { getPConnect, field } = props;
|
|
8
12
|
|
|
9
13
|
field.config['displayMode'] = 'DISPLAY_ONLY';
|
|
10
14
|
|
|
@@ -16,20 +20,14 @@ const HighlightRender = (data: any) => {
|
|
|
16
20
|
|
|
17
21
|
const configProps = getPConnect().resolveConfigProps(field.config);
|
|
18
22
|
|
|
19
|
-
//
|
|
20
|
-
|
|
23
|
+
// @ts-ignore
|
|
21
24
|
const reactField = getPConnect().createComponent(field);
|
|
22
|
-
// const reactField = field.getPConnect().getComponent();
|
|
23
|
-
|
|
24
|
-
const styles = {
|
|
25
|
-
myWidth: {
|
|
26
|
-
width: 'auto'
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
25
|
|
|
30
26
|
return (
|
|
27
|
+
{{! pick new delimiters for mustache }}
|
|
28
|
+
{{=<% %>=}}
|
|
31
29
|
<FieldValueList
|
|
32
|
-
style={
|
|
30
|
+
style={{ width: 'auto' }}
|
|
33
31
|
variant='stacked'
|
|
34
32
|
data-testid={field.testId}
|
|
35
33
|
fields={[
|
|
@@ -44,6 +42,7 @@ const HighlightRender = (data: any) => {
|
|
|
44
42
|
}
|
|
45
43
|
]}
|
|
46
44
|
/>
|
|
45
|
+
<%={{ }}=%> {{! revert delimiters for mustache }}
|
|
47
46
|
);
|
|
48
47
|
};
|
|
49
48
|
|
package/src/tasks/create/templates/Constellation/Template/DETAILS-region/demo.stories.tsx.mustache
CHANGED
|
@@ -18,6 +18,11 @@ const meta: Meta<typeof {{COMPONENT_CLASS_NAME}}> = {
|
|
|
18
18
|
|
|
19
19
|
export default meta;
|
|
20
20
|
type Story = StoryObj<typeof {{COMPONENT_CLASS_NAME}}>;
|
|
21
|
+
|
|
22
|
+
const Region = props => {
|
|
23
|
+
return <></>;
|
|
24
|
+
};
|
|
25
|
+
|
|
21
26
|
const renderField = resolvedProps => {
|
|
22
27
|
const {
|
|
23
28
|
displayAsStatus = false,
|
|
@@ -122,24 +127,54 @@ export const Base{{COMPONENT_CLASS_NAME}}: Story = args => {
|
|
|
122
127
|
setInheritedProp: () => {
|
|
123
128
|
/* nothing */
|
|
124
129
|
},
|
|
125
|
-
resolveConfigProps:
|
|
126
|
-
|
|
130
|
+
resolveConfigProps: config => {
|
|
131
|
+
return config;
|
|
127
132
|
}
|
|
128
133
|
};
|
|
129
134
|
}
|
|
130
135
|
};
|
|
131
136
|
|
|
132
|
-
const regionAChildren = pyReviewRaw.children[0].children.map(child => {
|
|
133
|
-
return props.getPConnect().createComponent(child);
|
|
134
|
-
});
|
|
135
|
-
const regionBChildren = pyReviewRaw.children[1].children.map(child => {
|
|
136
|
-
return props.getPConnect().createComponent(child);
|
|
137
|
-
});
|
|
138
137
|
|
|
139
138
|
return (
|
|
140
139
|
<{{COMPONENT_CLASS_NAME}} {...props} {...args}>
|
|
141
|
-
|
|
142
|
-
|
|
140
|
+
<Region
|
|
141
|
+
{...{
|
|
142
|
+
getPConnect: () => ({
|
|
143
|
+
setInheritedProp: () => {},
|
|
144
|
+
getChildren: () =>
|
|
145
|
+
pyReviewRaw.children[0].children.map((child, index) => {
|
|
146
|
+
return {
|
|
147
|
+
getPConnect: () => ({
|
|
148
|
+
getRawMetadata: () => pyReviewRaw.children[0].children[index],
|
|
149
|
+
getConfigProps: () => {},
|
|
150
|
+
resolveConfigProps: () => regionChildrenResolved[index],
|
|
151
|
+
getComponent: config =>
|
|
152
|
+
props.getPConnect().createComponent(pyReviewRaw.children[0].children[index])
|
|
153
|
+
})
|
|
154
|
+
};
|
|
155
|
+
})
|
|
156
|
+
})
|
|
157
|
+
}}
|
|
158
|
+
/>
|
|
159
|
+
<Region
|
|
160
|
+
{...{
|
|
161
|
+
getPConnect: () => ({
|
|
162
|
+
setInheritedProp: () => {},
|
|
163
|
+
getChildren: () =>
|
|
164
|
+
pyReviewRaw.children[1].children.map((child, index) => {
|
|
165
|
+
return {
|
|
166
|
+
getPConnect: () => ({
|
|
167
|
+
getRawMetadata: () => pyReviewRaw.children[1].children[index],
|
|
168
|
+
getConfigProps: () => {},
|
|
169
|
+
resolveConfigProps: () => regionChildrenResolved[index],
|
|
170
|
+
getComponent: config =>
|
|
171
|
+
props.getPConnect().createComponent(pyReviewRaw.children[1].children[index])
|
|
172
|
+
})
|
|
173
|
+
};
|
|
174
|
+
})
|
|
175
|
+
})
|
|
176
|
+
}}
|
|
177
|
+
/>
|
|
143
178
|
</{{COMPONENT_CLASS_NAME}}>
|
|
144
179
|
);
|
|
145
180
|
};
|