@pega/custom-dx-components 0.24.11 → 0.24.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +4 -0
- 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 +4 -0
- 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/Field/Icon-Button-URL/PConnProps.d.ts.mustache +46 -0
- package/src/tasks/create/templates/Launchpad/Field/Icon-Button-URL/config.json.mustache +32 -0
- package/src/tasks/create/templates/Launchpad/Field/Icon-Button-URL/demo.stories.tsx.mustache +98 -0
- package/src/tasks/create/templates/Launchpad/Field/Icon-Button-URL/index.tsx.mustache +203 -0
- package/src/tasks/create/templates/Launchpad/Field/Icon-Button-URL/mock.ts.mustache +5 -0
- package/src/tasks/create/templates/Launchpad/Field/Icon-Button-URL/styles.ts.mustache +8 -0
- package/src/tasks/create/templates/Launchpad/Widget/PAGE/OneColumnPage.svg +36 -0
- package/src/tasks/create/templates/Launchpad/Widget/PAGE/PConnProps.d.ts.mustache +46 -0
- package/src/tasks/create/templates/Launchpad/Widget/PAGE/config.json.mustache +59 -0
- package/src/tasks/create/templates/Launchpad/Widget/PAGE/demo.stories.tsx.mustache +112 -0
- package/src/tasks/create/templates/Launchpad/Widget/PAGE/index.tsx.mustache +95 -0
- package/src/tasks/create/templates/Launchpad/Widget/PAGE/mock.ts.mustache +25 -0
- package/src/tasks/create/templates/Launchpad/Widget/PAGE/styles.ts.mustache +8 -0
- 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 +4 -0
- 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 +4 -0
- 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 +4 -0
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDetails/styles.ts +16 -0
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyIconButtonURL/config.json +0 -32
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyIconButtonURL/demo.stories.tsx +9 -10
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyIconButtonURL/index.tsx +11 -15
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyIconButtonURL/mock.ts +1 -1
- 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 +13 -13
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPageWidget/index.tsx +6 -6
- 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 +4 -0
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnDetails/styles.ts +15 -0
|
@@ -24,7 +24,6 @@ import StyledPegaDxilMyIconButtonUrlWrapper from './styles';
|
|
|
24
24
|
// interface for props
|
|
25
25
|
interface PegaDxilMyIconButtonUrlProps extends PConnFieldProps {
|
|
26
26
|
// If any, enter additional props that only exist on TextInput here
|
|
27
|
-
countryCode: string;
|
|
28
27
|
}
|
|
29
28
|
|
|
30
29
|
export const textFormatter = (value: string) => {
|
|
@@ -44,9 +43,7 @@ export const textFormatter = (value: string) => {
|
|
|
44
43
|
// to put it in a Button (shown below), so you can have a tooltip and hover style or put it
|
|
45
44
|
// in a Link (shown below) as a URL.
|
|
46
45
|
//
|
|
47
|
-
// For the button, the click will get a list of
|
|
48
|
-
// table below. The table display will toggle with the click of the button icon. Example shows
|
|
49
|
-
// how to handle click, retrieve data from PCore and display it.
|
|
46
|
+
// For the button, the click will get a list of countries and display in a table
|
|
50
47
|
//
|
|
51
48
|
// Globe icon is an icon placed in a Link element. The Link element to use an icon internally. (NOTE: In general
|
|
52
49
|
// the Link element shows the open icon to the left of the link text, but here we are using
|
|
@@ -62,7 +59,7 @@ export const textFormatter = (value: string) => {
|
|
|
62
59
|
// props passed in combination of props from property panel (config.json) and run time props from Constellation
|
|
63
60
|
// any default values in config.pros should be set in defaultProps at bottom of this file
|
|
64
61
|
function PegaDxilMyIconButtonUrl(props: PegaDxilMyIconButtonUrlProps) {
|
|
65
|
-
const { value, displayMode,
|
|
62
|
+
const { value, displayMode, getPConnect, testId } = props;
|
|
66
63
|
const [statelist, setStatelist] = useState([]);
|
|
67
64
|
const [showTable, setShowTable] = useState(false);
|
|
68
65
|
const [validUrl, setValidUrl] = useState('about:blank');
|
|
@@ -74,8 +71,8 @@ function PegaDxilMyIconButtonUrl(props: PegaDxilMyIconButtonUrlProps) {
|
|
|
74
71
|
|
|
75
72
|
// setting up columns for the work list table
|
|
76
73
|
const columns = [
|
|
77
|
-
{ renderer: '
|
|
78
|
-
{ renderer: '
|
|
74
|
+
{ renderer: 'countryName', label: PConnect.getLocalizedValue('Country Name', '', '') },
|
|
75
|
+
{ renderer: 'shortName', label: PConnect.getLocalizedValue('Abbreviation', '', '') }
|
|
79
76
|
];
|
|
80
77
|
|
|
81
78
|
// toggle showing table and getting table data
|
|
@@ -111,9 +108,9 @@ function PegaDxilMyIconButtonUrl(props: PegaDxilMyIconButtonUrlProps) {
|
|
|
111
108
|
// get data from a data page and a PConnect function
|
|
112
109
|
// to get getContextName
|
|
113
110
|
useEffect(() => {
|
|
114
|
-
const dataViewName = '
|
|
111
|
+
const dataViewName = 'CountryList';
|
|
115
112
|
const context = PConnect.getContextName();
|
|
116
|
-
const params = {
|
|
113
|
+
const params = { };
|
|
117
114
|
|
|
118
115
|
// only retrieve table data if table is shown
|
|
119
116
|
if (showTable) {
|
|
@@ -128,8 +125,8 @@ function PegaDxilMyIconButtonUrl(props: PegaDxilMyIconButtonUrlProps) {
|
|
|
128
125
|
// MUST have an id/index or will get a setExtraStackFrame error
|
|
129
126
|
// put a key in the table
|
|
130
127
|
return {
|
|
131
|
-
|
|
132
|
-
|
|
128
|
+
countryName: entry.Name,
|
|
129
|
+
shortName: entry.ShortName,
|
|
133
130
|
id: index
|
|
134
131
|
};
|
|
135
132
|
})
|
|
@@ -139,7 +136,7 @@ function PegaDxilMyIconButtonUrl(props: PegaDxilMyIconButtonUrlProps) {
|
|
|
139
136
|
console.log(error);
|
|
140
137
|
});
|
|
141
138
|
}
|
|
142
|
-
}, [PConnect,
|
|
139
|
+
}, [PConnect, showTable]);
|
|
143
140
|
|
|
144
141
|
// when DISPLAY_ONLY, in this example we will just show the URL.
|
|
145
142
|
if (displayMode === 'DISPLAY_ONLY') {
|
|
@@ -161,12 +158,11 @@ function PegaDxilMyIconButtonUrl(props: PegaDxilMyIconButtonUrlProps) {
|
|
|
161
158
|
/>
|
|
162
159
|
<Label style={{ margin: '0.1rem' }}>
|
|
163
160
|
{' '}
|
|
164
|
-
{PConnect.getLocalizedValue('
|
|
165
|
-
{PConnect.getLocalizedValue(`${countryCode}`, '', '')}{' '}
|
|
161
|
+
{PConnect.getLocalizedValue('List of countries', '', '')}{' '}
|
|
166
162
|
</Label>
|
|
167
163
|
<Button
|
|
168
164
|
icon
|
|
169
|
-
label={PConnect.getLocalizedValue('Click to show/hide
|
|
165
|
+
label={PConnect.getLocalizedValue('Click to show/hide country list', '', '')}
|
|
170
166
|
variant='link'
|
|
171
167
|
compact={false}
|
|
172
168
|
onClick={showHideTable}
|
|
@@ -24,22 +24,22 @@ if (!window.PCore) {
|
|
|
24
24
|
const worklistData = {
|
|
25
25
|
data: [
|
|
26
26
|
{
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
CaseName: 'Loan',
|
|
28
|
+
BusinessID: ' A-8002',
|
|
29
|
+
ProcessName: 'New',
|
|
30
|
+
TaskName: 'Details'
|
|
31
31
|
},
|
|
32
32
|
{
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
CaseName: 'Loan',
|
|
34
|
+
BusinessID: ' A-7001',
|
|
35
|
+
ProcessName: 'Open',
|
|
36
|
+
TaskName: 'Info'
|
|
37
37
|
},
|
|
38
38
|
{
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
CaseName: 'Loan',
|
|
40
|
+
BusinessID: ' A-9000',
|
|
41
|
+
ProcessName: 'Open',
|
|
42
|
+
TaskName: 'Amount'
|
|
43
43
|
}
|
|
44
44
|
]
|
|
45
45
|
};
|
|
@@ -97,7 +97,7 @@ export const BasePegaDxilMyPageWidget: Story = args => {
|
|
|
97
97
|
}
|
|
98
98
|
};
|
|
99
99
|
|
|
100
|
-
return (
|
|
100
|
+
return (
|
|
101
101
|
<>
|
|
102
102
|
<PegaDxilMyPageWidget {...props} {...args} />
|
|
103
103
|
</>
|
|
@@ -44,7 +44,7 @@ function PegaDxilMyPageWidget(props: PegaDxilMyPageWidgetProps) {
|
|
|
44
44
|
// get data from a data page and a PConnect function
|
|
45
45
|
// to get getContextName
|
|
46
46
|
useEffect(() => {
|
|
47
|
-
const dataViewName = '
|
|
47
|
+
const dataViewName = 'MyWorkList';
|
|
48
48
|
const context = PConnect.getContextName();
|
|
49
49
|
|
|
50
50
|
PCore.getDataPageUtils()
|
|
@@ -58,10 +58,10 @@ function PegaDxilMyPageWidget(props: PegaDxilMyPageWidgetProps) {
|
|
|
58
58
|
// MUST have an id/index or will get a setExtraStackFrame error
|
|
59
59
|
// put a key in the table
|
|
60
60
|
return {
|
|
61
|
-
caseType: entry.
|
|
62
|
-
insKey: entry.
|
|
63
|
-
status: entry.
|
|
64
|
-
stage: entry.
|
|
61
|
+
caseType: entry.CaseName,
|
|
62
|
+
insKey: entry.BusinessID,
|
|
63
|
+
status: entry.ProcessName,
|
|
64
|
+
stage: entry.TaskName,
|
|
65
65
|
id: index
|
|
66
66
|
};
|
|
67
67
|
})
|
|
@@ -81,7 +81,7 @@ function PegaDxilMyPageWidget(props: PegaDxilMyPageWidgetProps) {
|
|
|
81
81
|
whatsNewLink={whatsnewlink}
|
|
82
82
|
image={image.replace(/ /g, '+')}
|
|
83
83
|
/>
|
|
84
|
-
<br
|
|
84
|
+
<br />
|
|
85
85
|
<Table
|
|
86
86
|
title={PConnect.getLocalizedValue('Work list', '', '')}
|
|
87
87
|
columns={columns}
|
package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnDetails/DetailsRender.tsx
CHANGED
|
@@ -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,17 +31,10 @@ const DetailsRender = (props: DetailsRenderProps) => {
|
|
|
30
31
|
const element = value.getPConnect().getComponent();
|
|
31
32
|
const displayEl = <Fragment key={key}>{element}</Fragment>;
|
|
32
33
|
|
|
33
|
-
const fvlStyle = {
|
|
34
|
-
myColGap: {
|
|
35
|
-
columnGap: '0'
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
// const myEl = <div>boo</div>;
|
|
40
34
|
displayComp = (
|
|
41
|
-
<Fragment key={
|
|
35
|
+
<Fragment key={key1}>
|
|
42
36
|
<FieldValueList
|
|
43
|
-
style={
|
|
37
|
+
style={{ columnGap: '0'}}
|
|
44
38
|
variant={hideLabel ? 'stacked' : variant}
|
|
45
39
|
data-testid={testId}
|
|
46
40
|
fields={[{ id: '1', name: hideLabel ? '' : label, value: displayEl }]}
|
package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnDetails/HighlightRender.tsx
CHANGED
|
@@ -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,12 @@ 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 (
|
|
31
27
|
<FieldValueList
|
|
32
|
-
style={
|
|
28
|
+
style={{ width: 'auto' }}
|
|
33
29
|
variant='stacked'
|
|
34
30
|
data-testid={field.testId}
|
|
35
31
|
fields={[
|
package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnDetails/demo.stories.tsx
CHANGED
|
@@ -18,6 +18,11 @@ const meta: Meta<typeof PegaDxilMyTwoColumnDetails> = {
|
|
|
18
18
|
|
|
19
19
|
export default meta;
|
|
20
20
|
type Story = StoryObj<typeof PegaDxilMyTwoColumnDetails>;
|
|
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 BasePegaDxilMyTwoColumnDetails: 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
|
<PegaDxilMyTwoColumnDetails {...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
|
</PegaDxilMyTwoColumnDetails>
|
|
144
179
|
);
|
|
145
180
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Fragment } from 'react';
|
|
2
|
-
import { Grid, Flex, FieldGroup, withConfiguration } from '@pega/cosmos-react-core';
|
|
1
|
+
import { Fragment, Children, ReactElement } from 'react';
|
|
2
|
+
import { Grid, Flex, FieldGroup, withConfiguration, GridContainerProps } from '@pega/cosmos-react-core';
|
|
3
3
|
import type { PConnFieldProps } from './PConnProps';
|
|
4
4
|
import DetailsRender from './DetailsRender';
|
|
5
5
|
import HighlightRender from './HighlightRender';
|
|
6
6
|
|
|
7
|
-
import StyledPegaDxilMyTwoColumnDetailsWrapper from './styles';
|
|
7
|
+
import StyledPegaDxilMyTwoColumnDetailsWrapper, { StyledDetailsGridContainer, StyledHighlightedFieldsHrLine } from './styles';
|
|
8
8
|
|
|
9
9
|
// includes in bundle
|
|
10
10
|
import { getAllFields } from './utils';
|
|
@@ -14,40 +14,31 @@ interface PegaDxilMyTwoColumnDetailsProps extends PConnFieldProps {
|
|
|
14
14
|
// If any, enter additional props that only exist on TextInput here
|
|
15
15
|
showLabel: boolean;
|
|
16
16
|
showHighlightedData: boolean;
|
|
17
|
-
children:
|
|
17
|
+
children: ReactElement[];
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
// props passed in combination of props from property panel (config.json) and run time props from Constellation
|
|
21
21
|
// any default values in config.pros should be set in defaultProps at bottom of this file
|
|
22
22
|
function PegaDxilMyTwoColumnDetails(props: PegaDxilMyTwoColumnDetailsProps) {
|
|
23
23
|
|
|
24
|
-
const { getPConnect,
|
|
24
|
+
const { getPConnect, label, children, showLabel = true, showHighlightedData = false } = props;
|
|
25
25
|
const propsToUse = { label, showLabel, ...getPConnect().getInheritedProps() };
|
|
26
26
|
|
|
27
27
|
// update children with readonly
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
28
|
+
Children.toArray(children).forEach(child => {
|
|
29
|
+
// @ts-ignore
|
|
30
|
+
child.props.getPConnect().setInheritedProp('readOnly', true);
|
|
31
|
+
// @ts-ignore
|
|
32
|
+
child.props.getPConnect().setInheritedProp('displayMode', 'DISPLAY_ONLY');
|
|
33
|
+
});
|
|
34
34
|
|
|
35
35
|
const numRegions = getAllFields(getPConnect)?.length;
|
|
36
36
|
const gridRepeat = "repeat(".concat(numRegions).concat(", 1fr)");
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
|
|
38
|
+
const gridContainer: GridContainerProps = { colGap: 0 };
|
|
39
39
|
gridContainer.cols = gridRepeat;
|
|
40
|
-
// @ts-ignore
|
|
41
40
|
gridContainer.alignItems = 'start';
|
|
42
41
|
|
|
43
|
-
const gridHighlightContainer = { "gap": 2};
|
|
44
|
-
// @ts-ignore
|
|
45
|
-
gridHighlightContainer.cols = gridRepeat;
|
|
46
|
-
// @ts-ignore
|
|
47
|
-
gridHighlightContainer.alignItems = 'flex-start';
|
|
48
|
-
// @ts-ignore
|
|
49
|
-
gridHighlightContainer.pad = [0, 0, 2, 0];
|
|
50
|
-
|
|
51
42
|
// Set up highlighted data to pass in return if is set to show, need raw metadata to pass to createComponent
|
|
52
43
|
let highlightedDataArr = [];
|
|
53
44
|
if (showHighlightedData) {
|
|
@@ -55,26 +46,10 @@ function PegaDxilMyTwoColumnDetails(props: PegaDxilMyTwoColumnDetailsProps) {
|
|
|
55
46
|
const { highlightedData = [] } = getPConnect().getRawMetadata().config;
|
|
56
47
|
// @ts-ignore
|
|
57
48
|
highlightedDataArr = highlightedData.map((field) => {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
// // Mark as status display when using pyStatusWork
|
|
61
|
-
// if (field.config.value === '@P .pyStatusWork') {
|
|
62
|
-
// field.type = 'TextInput';
|
|
63
|
-
// field.config.displayAsStatus = true;
|
|
64
|
-
// }
|
|
65
|
-
// // @ts-ignore
|
|
66
|
-
// return getPConnect().createComponent(field);
|
|
67
|
-
return <HighlightRender field={field} props={props} />;
|
|
49
|
+
return <HighlightRender field={field} getPConnect={props.getPConnect} />;
|
|
68
50
|
});
|
|
69
51
|
}
|
|
70
52
|
|
|
71
|
-
const hrStyle = {
|
|
72
|
-
line: {
|
|
73
|
-
margin: '0.75rem 0',
|
|
74
|
-
opacity: '50%'
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
|
|
78
53
|
return (
|
|
79
54
|
<StyledPegaDxilMyTwoColumnDetailsWrapper>
|
|
80
55
|
<FieldGroup name={propsToUse.showLabel ? propsToUse.label : ''}>
|
|
@@ -88,10 +63,13 @@ function PegaDxilMyTwoColumnDetails(props: PegaDxilMyTwoColumnDetailsProps) {
|
|
|
88
63
|
<Fragment key={`hf-${i + 1}`}>{child}</Fragment>
|
|
89
64
|
))}
|
|
90
65
|
</Flex>
|
|
91
|
-
<
|
|
66
|
+
<StyledHighlightedFieldsHrLine />
|
|
92
67
|
</>
|
|
93
68
|
)}
|
|
94
|
-
<Grid
|
|
69
|
+
<Grid
|
|
70
|
+
as={StyledDetailsGridContainer}
|
|
71
|
+
container={gridContainer}
|
|
72
|
+
data-testid={`column-count-${numRegions}`} >
|
|
95
73
|
{children.map((child: any, i: number) => (
|
|
96
74
|
<Flex
|
|
97
75
|
// @ts-ignore
|
|
@@ -16,6 +16,7 @@ export const pyReviewRaw = {
|
|
|
16
16
|
config: {
|
|
17
17
|
value: '@P .pyStatusWork',
|
|
18
18
|
label: '@L Work Status',
|
|
19
|
+
hideLabel: false,
|
|
19
20
|
displayMode: 'STACKED_LARGE_VAL',
|
|
20
21
|
displayAsStatus: true,
|
|
21
22
|
key: 'pyStatusWork'
|
|
@@ -26,6 +27,7 @@ export const pyReviewRaw = {
|
|
|
26
27
|
config: {
|
|
27
28
|
value: '@P .pyID',
|
|
28
29
|
label: '@L Case ID',
|
|
30
|
+
hideLabel: false,
|
|
29
31
|
displayMode: 'STACKED_LARGE_VAL',
|
|
30
32
|
key: 'pyID'
|
|
31
33
|
}
|
|
@@ -35,6 +37,7 @@ export const pyReviewRaw = {
|
|
|
35
37
|
config: {
|
|
36
38
|
value: '@P .pxCreateDateTime',
|
|
37
39
|
label: '@L Create date/time',
|
|
40
|
+
hideLabel: false,
|
|
38
41
|
displayMode: 'STACKED_LARGE_VAL',
|
|
39
42
|
key: 'pxCreateDateTime'
|
|
40
43
|
}
|
|
@@ -43,6 +46,7 @@ export const pyReviewRaw = {
|
|
|
43
46
|
type: 'UserReference',
|
|
44
47
|
config: {
|
|
45
48
|
label: '@L Create Operator',
|
|
49
|
+
hideLabel: false,
|
|
46
50
|
value: '@USER .pxCreateOperator',
|
|
47
51
|
placeholder: 'Select...',
|
|
48
52
|
displayMode: 'STACKED_LARGE_VAL',
|
|
@@ -6,3 +6,18 @@ export default styled.div(() => {
|
|
|
6
6
|
margin: 0px 0;
|
|
7
7
|
`;
|
|
8
8
|
});
|
|
9
|
+
|
|
10
|
+
export const StyledDetailsGridContainer = styled.div(() => {
|
|
11
|
+
return css`
|
|
12
|
+
margin-line-start: 1;
|
|
13
|
+
`;
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export const StyledHighlightedFieldsHrLine = styled.hr(() => {
|
|
17
|
+
return css`
|
|
18
|
+
line: {
|
|
19
|
+
margin: '0.75rem 0';
|
|
20
|
+
opacity: '50%'
|
|
21
|
+
}
|
|
22
|
+
`;
|
|
23
|
+
});
|