@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
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
|
|
2
|
+
/* eslint-disable react/jsx-no-useless-fragment */
|
|
3
|
+
// @ts-nocheck
|
|
4
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
5
|
+
|
|
6
|
+
import {{COMPONENT_CLASS_NAME}} from './index';
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
import configProps from './mock';
|
|
10
|
+
|
|
11
|
+
const meta: Meta<typeof {{COMPONENT_CLASS_NAME}}> = {
|
|
12
|
+
title: '{{COMPONENT_CLASS_NAME}}',
|
|
13
|
+
component: {{COMPONENT_CLASS_NAME}},
|
|
14
|
+
excludeStories: /.*Data$/
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export default meta;
|
|
18
|
+
type Story = StoryObj<typeof {{COMPONENT_CLASS_NAME}}>;
|
|
19
|
+
|
|
20
|
+
if (!window.PCore) {
|
|
21
|
+
window.PCore = {};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const worklistData = {
|
|
25
|
+
data: [
|
|
26
|
+
{
|
|
27
|
+
CaseName: 'Loan',
|
|
28
|
+
BusinessID: ' A-8002',
|
|
29
|
+
ProcessName: 'New',
|
|
30
|
+
TaskName: 'Details'
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
CaseName: 'Loan',
|
|
34
|
+
BusinessID: ' A-7001',
|
|
35
|
+
ProcessName: 'Open',
|
|
36
|
+
TaskName: 'Info'
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
CaseName: 'Loan',
|
|
40
|
+
BusinessID: ' A-9000',
|
|
41
|
+
ProcessName: 'Open',
|
|
42
|
+
TaskName: 'Amount'
|
|
43
|
+
}
|
|
44
|
+
]
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
window.PCore.getDataPageUtils = () => {
|
|
48
|
+
return {
|
|
49
|
+
getDataAsync: () => {
|
|
50
|
+
return new Promise(resolve => {
|
|
51
|
+
resolve(worklistData);
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
export const Base{{COMPONENT_CLASS_NAME}}: Story = args => {
|
|
60
|
+
|
|
61
|
+
const props = {
|
|
62
|
+
image: configProps.image,
|
|
63
|
+
getPConnect: () => {
|
|
64
|
+
return {
|
|
65
|
+
getValue: value => {
|
|
66
|
+
return value;
|
|
67
|
+
},
|
|
68
|
+
getContextName: () => {
|
|
69
|
+
return 'app/primary_1';
|
|
70
|
+
},
|
|
71
|
+
getLocalizedValue: value => {
|
|
72
|
+
return value;
|
|
73
|
+
},
|
|
74
|
+
getActionsApi: () => {
|
|
75
|
+
return {
|
|
76
|
+
updateFieldValue: () => {
|
|
77
|
+
/* nothing */
|
|
78
|
+
},
|
|
79
|
+
triggerFieldChange: () => {
|
|
80
|
+
/* nothing */
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
},
|
|
84
|
+
ignoreSuggestion: () => {
|
|
85
|
+
/* nothing */
|
|
86
|
+
},
|
|
87
|
+
acceptSuggestion: () => {
|
|
88
|
+
/* nothing */
|
|
89
|
+
},
|
|
90
|
+
setInheritedProps: () => {
|
|
91
|
+
/* nothing */
|
|
92
|
+
},
|
|
93
|
+
resolveConfigProps: () => {
|
|
94
|
+
/* nothing */
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
return (
|
|
101
|
+
<>
|
|
102
|
+
<{{COMPONENT_CLASS_NAME}} {...props} {...args} />
|
|
103
|
+
</>
|
|
104
|
+
);
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
Base{{COMPONENT_CLASS_NAME}}.args = {
|
|
108
|
+
header: configProps.header,
|
|
109
|
+
description: configProps.description,
|
|
110
|
+
whatsnewlink: configProps.whatsnewlink,
|
|
111
|
+
datasource: configProps.datasource,
|
|
112
|
+
};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
import { withConfiguration, Table } from '@pega/cosmos-react-core';
|
|
3
|
+
import { AppAnnouncement as PegaAppAnnouncement } from '@pega/cosmos-react-work';
|
|
4
|
+
import type { PConnFieldProps } from './PConnProps';
|
|
5
|
+
|
|
6
|
+
import Styled{{COMPONENT_CLASS_NAME}}Wrapper from './styles';
|
|
7
|
+
|
|
8
|
+
// interface for props
|
|
9
|
+
interface {{COMPONENT_CLASS_NAME}}Props extends PConnFieldProps {
|
|
10
|
+
// If any, enter additional props that only exist on TextInput here
|
|
11
|
+
datasource: Array<any>;
|
|
12
|
+
header: string;
|
|
13
|
+
description: string;
|
|
14
|
+
whatsnewlink: string;
|
|
15
|
+
image: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// props passed in combination of props from property panel (config.json) and run time props from Constellation
|
|
19
|
+
// any default values in config.pros should be set in defaultProps at bottom of this file
|
|
20
|
+
function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
|
|
21
|
+
|
|
22
|
+
const { header, description, datasource = [], whatsnewlink, image, getPConnect } = props;
|
|
23
|
+
const [worklist, setWorklist] = useState([]);
|
|
24
|
+
const PConnect = getPConnect();
|
|
25
|
+
let details = [];
|
|
26
|
+
// @ts-ignore
|
|
27
|
+
if (datasource && datasource.source) {
|
|
28
|
+
// @ts-ignore
|
|
29
|
+
details = datasource.source.map((item) => {
|
|
30
|
+
return item.name;
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// setting up columns for the work list table
|
|
35
|
+
const columns = [
|
|
36
|
+
{ renderer: 'caseType', label: PConnect.getLocalizedValue('Case type', '', '') },
|
|
37
|
+
{ renderer: 'insKey', label: PConnect.getLocalizedValue('Key', '', '') },
|
|
38
|
+
{ renderer: 'status', label: PConnect.getLocalizedValue('Status', '', '') },
|
|
39
|
+
{ renderer: 'stage', label: PConnect.getLocalizedValue('Stage', '', '') }
|
|
40
|
+
];
|
|
41
|
+
|
|
42
|
+
// going to get data for worklist to put into a table
|
|
43
|
+
// data comes from calling a PCore function to get
|
|
44
|
+
// get data from a data page and a PConnect function
|
|
45
|
+
// to get getContextName
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
const dataViewName = 'MyWorkList';
|
|
48
|
+
const context = PConnect.getContextName();
|
|
49
|
+
|
|
50
|
+
PCore.getDataPageUtils()
|
|
51
|
+
.getDataAsync(dataViewName, context, {}, null, null)
|
|
52
|
+
// @ts-ignore
|
|
53
|
+
.then((response: any) => {
|
|
54
|
+
// table requires an index or will get setExtraStackFrame error
|
|
55
|
+
setWorklist(
|
|
56
|
+
response.data.map((entry: any, index: number) => {
|
|
57
|
+
// mapping the data into the column names
|
|
58
|
+
// MUST have an id/index or will get a setExtraStackFrame error
|
|
59
|
+
// put a key in the table
|
|
60
|
+
return {
|
|
61
|
+
caseType: entry.CaseName,
|
|
62
|
+
insKey: entry.BusinessID,
|
|
63
|
+
status: entry.ProcessName,
|
|
64
|
+
stage: entry.TaskName,
|
|
65
|
+
id: index
|
|
66
|
+
};
|
|
67
|
+
})
|
|
68
|
+
);
|
|
69
|
+
})
|
|
70
|
+
.catch((error: any) => {
|
|
71
|
+
console.log(error);
|
|
72
|
+
});
|
|
73
|
+
}, [PConnect]);
|
|
74
|
+
|
|
75
|
+
return (
|
|
76
|
+
<Styled{{COMPONENT_CLASS_NAME}}Wrapper>
|
|
77
|
+
<PegaAppAnnouncement
|
|
78
|
+
heading={header}
|
|
79
|
+
description={description}
|
|
80
|
+
details={details}
|
|
81
|
+
whatsNewLink={whatsnewlink}
|
|
82
|
+
image={image.replace(/ /g, '+')}
|
|
83
|
+
/>
|
|
84
|
+
<br />
|
|
85
|
+
<Table
|
|
86
|
+
title={PConnect.getLocalizedValue('Work list', '', '')}
|
|
87
|
+
columns={columns}
|
|
88
|
+
data={worklist}
|
|
89
|
+
/>
|
|
90
|
+
</Styled{{COMPONENT_CLASS_NAME}}Wrapper>
|
|
91
|
+
);
|
|
92
|
+
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export default withConfiguration({{COMPONENT_CLASS_NAME}});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
const configProps = {
|
|
4
|
+
label: 'App announcement',
|
|
5
|
+
header: 'Announcements',
|
|
6
|
+
description: 'Welcome to MediaCo Application for testing SDK frameworks.',
|
|
7
|
+
whatsnewlink: 'https://design.pega.com',
|
|
8
|
+
image:
|
|
9
|
+
'data:image/svg xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzOSAxMSI PHRpdGxlPlBlZ2EgdGV4dC1vbmx5IGxvZ288L3RpdGxlPjxwYXRoIHN0eWxlPSJmaWxsLW9wYWNpdHk6IC4yNTsiIGZpbGw9IiNmZmYiIGQ9Ik03LjcyIDMuODJjMCAyLjI1LTEuNzggMy40MS00IDMuNDFoLTEuNnYzSDBWLjQyaDMuOTRjMi4zNiAwIDMuNzggMS4zOSAzLjc4IDMuNHptLTQtMS40N2gtMS42djNoMS43QTEuNDcgMS40NyAwIDAgMCA1LjUgMy44MmMwLS45MS0uNjUtMS40Ny0xLjc1LTEuNDd6bTcuNjggNS45MWg1LjN2Mkg5LjI5Vi40Mmg3LjM4djEuOTNoLTUuMjR2Mmg0LjI0djEuOWgtNC4yNHpNMjMuMTggMGE1IDUgMCAwIDEgMy41NyAxLjI4TDI1LjYzIDIuOGEzLjc4IDMuNzggMCAwIDAtMS4wNS0uNjNBNC4zMiA0LjMyIDAgMCAwIDIzLjMxIDIgMy4xNyAzLjE3IDAgMCAwIDIwIDUuMjdhMy4xNiAzLjE2IDAgMCAwIDEgMi4zOSAzLjA3IDMuMDcgMCAwIDAgMi4xNy44NCA0LjYgNC42IDAgMCAwIDIuMDktLjVWNi4xOWgtMi4yVjQuMzhoNC4yNXY0LjU2YTUuNDEgNS40MSAwIDAgMS00LjA4IDEuNTdBNS4zNSA1LjM1IDAgMCAxIDE5LjQzIDlhNS4wNSA1LjA1IDAgMCAxLTEuNTYtMy43NCA1LjIxIDUuMjEgMCAwIDEgMS41Ni0zLjc2QTUuMzEgNS4zMSAwIDAgMSAyMy4xOCAwem0xMS4yOS40Mmw0LjEzIDkuNzloLTIuMjVMMzUuNDggOGgtNC4wNmwtLjkgMi4xOGgtMi4yTDMyLjUxLjQyem0uMjUgNS43MkwzMy40NCAzbC0xLjI5IDMuMTR6bTMtNWEuNzEuNzEgMCAwIDEtLjc0Ljc1LjcxLjcxIDAgMCAxLS43My0uNzUuNzMuNzMgMCAwIDEgLjc1LS43Mi43Mi43MiAwIDAgMSAuNzUuNzF6TTM3IC41M2EuNTkuNTkgMCAwIDAtLjYuNi42MS42MSAwIDEgMCAxLjIxIDAgLjYuNiAwIDAgMC0uNjEtLjZ6bS0uMjQgMVYuNzFIMzdjLjEyIDAgLjE4LjA2LjI1LjA2YS4yMS4yMSAwIDAgMSAuMDcuMTguMTkuMTkgMCAwIDEtLjA3LjE4cy0uMDcuMDgtLjEzLjA4bC4yNi4zNmgtLjJMMzcgMS4yOGgtLjF2LjI5em0uMTMtLjQ0aC4yM2EuMjYuMjYgMCAwIDAgLjA3LS4wOWgtLjA2Yy0uMDUtLjE3LS4wNS0uMTctLjEzLS4xN2gtLjF6Ii8 PC9zdmc ',
|
|
10
|
+
datasource: {
|
|
11
|
+
source: [
|
|
12
|
+
{
|
|
13
|
+
name: 'New React based UI rendering'
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
name: 'Support for followers and recents'
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
name: 'New authoring experience'
|
|
20
|
+
}
|
|
21
|
+
],
|
|
22
|
+
fields: {}
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
export default configProps;
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
71
|
"@pega/configs": "^0.6.0",
|
|
72
|
-
"@pega/custom-dx-components": "0.24.
|
|
72
|
+
"@pega/custom-dx-components": "0.24.13",
|
|
73
73
|
"@pega/pcore-pconnect-typedefs": "~3.0.0",
|
|
74
74
|
"@storybook/addon-actions": "^7.6.7",
|
|
75
75
|
"@storybook/addon-essentials": "^7.6.7",
|
|
@@ -84,11 +84,17 @@ export const zipComponent = async componentKey => {
|
|
|
84
84
|
const srcDirectory = await getComponentDirectoryPath(componentKey);
|
|
85
85
|
const buildDirectory = await path.join(path.resolve(), 'dist/components', componentKey);
|
|
86
86
|
const configJson = `${srcDirectory}/config.json`;
|
|
87
|
+
const localizationJson = `${srcDirectory}/localizations.json`;
|
|
87
88
|
|
|
88
89
|
const zip = new AdmZip();
|
|
89
90
|
|
|
90
91
|
zip.addLocalFolder(srcDirectory, 'src/');
|
|
91
92
|
zip.addLocalFile(configJson);
|
|
93
|
+
|
|
94
|
+
if (fs.existsSync(localizationJson)) {
|
|
95
|
+
zip.addLocalFile(localizationJson);
|
|
96
|
+
}
|
|
97
|
+
|
|
92
98
|
zip.addLocalFolder(buildDirectory);
|
|
93
99
|
const zipContent = zip.toBuffer().toString('base64');
|
|
94
100
|
|
|
@@ -70,11 +70,17 @@ export const zipComponent = async componentKey => {
|
|
|
70
70
|
const srcDirectory = await getComponentDirectoryPath(componentKey);
|
|
71
71
|
const buildDirectory = await path.join(path.resolve(), 'dist/components', componentKey);
|
|
72
72
|
const configJson = `${srcDirectory}/config.json`;
|
|
73
|
+
const localizationJson = `${srcDirectory}/localizations.json`;
|
|
73
74
|
|
|
74
75
|
const zip = new AdmZip();
|
|
75
76
|
|
|
76
77
|
zip.addLocalFolder(srcDirectory, 'src/');
|
|
77
78
|
zip.addLocalFile(configJson);
|
|
79
|
+
|
|
80
|
+
if (fs.existsSync(localizationJson)) {
|
|
81
|
+
zip.addLocalFile(localizationJson);
|
|
82
|
+
}
|
|
83
|
+
|
|
78
84
|
zip.addLocalFolder(buildDirectory);
|
|
79
85
|
const zipContent = zip.toBuffer().toString('base64');
|
|
80
86
|
|
package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDetails/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/Constellation/Pega_DXIL_MyDetails/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/Constellation/Pega_DXIL_MyDetails/demo.stories.tsx
CHANGED
|
@@ -20,6 +20,10 @@ const meta: Meta<typeof PegaDxilMyDetails> = {
|
|
|
20
20
|
export default meta;
|
|
21
21
|
type Story = StoryObj<typeof PegaDxilMyDetails>;
|
|
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 BasePegaDxilMyDetails: 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
|
-
<PegaDxilMyDetails {...props} {...args}>
|
|
140
|
+
<PegaDxilMyDetails {...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
|
+
</PegaDxilMyDetails>
|
|
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 StyledPegaDxilMyDetailsWrapper from './styles';
|
|
7
|
+
import StyledPegaDxilMyDetailsWrapper, { StyledDetailsGridContainer, StyledHighlightedFieldsHrLine } from './styles';
|
|
8
8
|
|
|
9
9
|
// includes in bundle
|
|
10
10
|
import { getAllFields } from './utils';
|
|
@@ -21,33 +21,30 @@ interface PegaDxilMyDetailsProps extends PConnFieldProps {
|
|
|
21
21
|
// any default values in config.pros should be set in defaultProps at bottom of this file
|
|
22
22
|
function PegaDxilMyDetails(props: PegaDxilMyDetailsProps) {
|
|
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 PegaDxilMyDetails(props: PegaDxilMyDetailsProps) {
|
|
|
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
|
<StyledPegaDxilMyDetailsWrapper>
|
|
@@ -77,15 +67,18 @@ function PegaDxilMyDetails(props: PegaDxilMyDetailsProps) {
|
|
|
77
67
|
container={{ direction: 'row', alignItems: 'normal', colGap: 10 }}
|
|
78
68
|
data-testid={`highlighted-column-count-${numRegions}`}
|
|
79
69
|
>
|
|
80
|
-
{highlightedDataArr.map((child:
|
|
70
|
+
{highlightedDataArr.map((child: ReactElement, i: number) => (
|
|
81
71
|
<Fragment key={`hf-${i + 1}`}>{child}</Fragment>
|
|
82
72
|
))}
|
|
83
73
|
</Flex>
|
|
84
|
-
<
|
|
74
|
+
<StyledHighlightedFieldsHrLine />
|
|
85
75
|
</>
|
|
86
76
|
)}
|
|
87
|
-
<Grid
|
|
88
|
-
|
|
77
|
+
<Grid
|
|
78
|
+
as={StyledDetailsGridContainer}
|
|
79
|
+
container={gridContainer}
|
|
80
|
+
data-testid={`column-count-${numRegions}`} >
|
|
81
|
+
{children.map((child: ReactElement, i: number) => (
|
|
89
82
|
|
|
90
83
|
<Flex
|
|
91
84
|
// @ts-ignore
|
|
@@ -17,6 +17,7 @@ export const pyReviewRaw = {
|
|
|
17
17
|
config: {
|
|
18
18
|
value: '@P .pyStatusWork',
|
|
19
19
|
label: '@L Work Status',
|
|
20
|
+
hideLabel: false,
|
|
20
21
|
displayMode: 'STACKED_LARGE_VAL',
|
|
21
22
|
displayAsStatus: true,
|
|
22
23
|
key: 'pyStatusWork'
|
|
@@ -27,6 +28,7 @@ export const pyReviewRaw = {
|
|
|
27
28
|
config: {
|
|
28
29
|
value: '@P .pyID',
|
|
29
30
|
label: '@L Case ID',
|
|
31
|
+
hideLabel: false,
|
|
30
32
|
displayMode: 'STACKED_LARGE_VAL',
|
|
31
33
|
key: 'pyID'
|
|
32
34
|
}
|
|
@@ -36,6 +38,7 @@ export const pyReviewRaw = {
|
|
|
36
38
|
config: {
|
|
37
39
|
value: '@P .pxCreateDateTime',
|
|
38
40
|
label: '@L Create date/time',
|
|
41
|
+
hideLabel: false,
|
|
39
42
|
displayMode: 'STACKED_LARGE_VAL',
|
|
40
43
|
key: 'pxCreateDateTime'
|
|
41
44
|
}
|
|
@@ -44,6 +47,7 @@ export const pyReviewRaw = {
|
|
|
44
47
|
type: 'UserReference',
|
|
45
48
|
config: {
|
|
46
49
|
label: '@L Create Operator',
|
|
50
|
+
hideLabel: false,
|
|
47
51
|
value: '@USER .pxCreateOperator',
|
|
48
52
|
placeholder: 'Select...',
|
|
49
53
|
displayMode: 'STACKED_LARGE_VAL',
|
|
@@ -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
|
+
});
|
package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPageWidget/demo.stories.tsx
CHANGED
|
@@ -97,11 +97,11 @@ export const BasePegaDxilMyPageWidget: Story = args => {
|
|
|
97
97
|
}
|
|
98
98
|
};
|
|
99
99
|
|
|
100
|
-
return (
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
100
|
+
return (
|
|
101
|
+
<>
|
|
102
|
+
<PegaDxilMyPageWidget {...props} {...args} />
|
|
103
|
+
</>
|
|
104
|
+
);
|
|
105
105
|
};
|
|
106
106
|
|
|
107
107
|
BasePegaDxilMyPageWidget.args = {
|
|
@@ -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 }]}
|