@pega/custom-dx-components 0.24.10 → 0.24.12
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/create/templates/Constellation/Field/Icon-Button-URL/index.tsx.mustache +35 -12
- package/src/tasks/create/templates/Constellation/Template/DETAILS/index.tsx.mustache +7 -3
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/index.tsx.mustache +6 -3
- package/src/tasks/create/templates/Constellation/Template/FORM/DetailsRender.tsx +2 -1
- package/src/tasks/create/templates/Constellation/Template/FORM/index.tsx.mustache +1 -1
- package/src/tasks/create/templates/Constellation/Template/FORM-region/DetailsRender.tsx +2 -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/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDetails/index.tsx +7 -3
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyForm/DetailsRender.tsx +2 -1
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyForm/index.tsx +1 -1
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyIconButtonURL/index.tsx +35 -12
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTwoColumnDetails/index.tsx +6 -3
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTwoColumnForm/DetailsRender.tsx +2 -1
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDetails/index.tsx +7 -3
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyForm/DetailsRender.tsx +2 -1
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyForm/index.tsx +1 -1
- 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 +42 -23
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyIconButtonURL/mock.ts +1 -1
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPageWidget/demo.stories.tsx +12 -12
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPageWidget/index.tsx +5 -5
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnDetails/index.tsx +6 -3
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnForm/DetailsRender.tsx +2 -1
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{COMPONENT_KEY}}",
|
|
3
|
+
"label": "{{COMPONENT_LABEL}}",
|
|
4
|
+
"description": "{{DESCRIPTION}}",
|
|
5
|
+
"organization": "{{ORGANIZATION}}",
|
|
6
|
+
"version": "{{VERSION}}",
|
|
7
|
+
"library": "{{LIBRARY}}",
|
|
8
|
+
"allowedApplications": {{{ALLOWEDAPPS}}},
|
|
9
|
+
"componentKey": "{{COMPONENT_KEY}}",
|
|
10
|
+
"type": "{{TYPE}}",
|
|
11
|
+
"subtype": {{{SUB_TYPE}}},
|
|
12
|
+
"icon": "OneColumnPage.svg",
|
|
13
|
+
"properties": [
|
|
14
|
+
{
|
|
15
|
+
"name": "description",
|
|
16
|
+
"label": "Description",
|
|
17
|
+
"format": "TEXT",
|
|
18
|
+
"defaultValue": "We've launched a brand new experience to accelerate your workflow. Check out the guides to help you get the most of Cosmos."
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"name": "whatsnewlink",
|
|
22
|
+
"label": "What's new link",
|
|
23
|
+
"format": "TEXT",
|
|
24
|
+
"defaultValue": "https://design.pega.com"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"name": "image",
|
|
28
|
+
"label": "Image link",
|
|
29
|
+
"format": "TEXT",
|
|
30
|
+
"defaultValue": "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzOSAxMSI+PHRpdGxlPlBlZ2EgdGV4dC1vbmx5IGxvZ288L3RpdGxlPjxwYXRoIHN0eWxlPSJmaWxsLW9wYWNpdHk6IC4yNTsiIGZpbGw9IiNmZmYiIGQ9Ik03LjcyIDMuODJjMCAyLjI1LTEuNzggMy40MS00IDMuNDFoLTEuNnYzSDBWLjQyaDMuOTRjMi4zNiAwIDMuNzggMS4zOSAzLjc4IDMuNHptLTQtMS40N2gtMS42djNoMS43QTEuNDcgMS40NyAwIDAgMCA1LjUgMy44MmMwLS45MS0uNjUtMS40Ny0xLjc1LTEuNDd6bTcuNjggNS45MWg1LjN2Mkg5LjI5Vi40Mmg3LjM4djEuOTNoLTUuMjR2Mmg0LjI0djEuOWgtNC4yNHpNMjMuMTggMGE1IDUgMCAwIDEgMy41NyAxLjI4TDI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",
|
|
35
|
+
"defaultValue": "@DATASOURCE D_pyAnnouncements.pxResults",
|
|
36
|
+
"format": "DATASOURCE",
|
|
37
|
+
"required": true,
|
|
38
|
+
"properties": [
|
|
39
|
+
{
|
|
40
|
+
"name": "name",
|
|
41
|
+
"label": "Label",
|
|
42
|
+
"defaultValue": "@P .pyLabel"
|
|
43
|
+
}
|
|
44
|
+
]
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"label": "Conditions",
|
|
48
|
+
"format": "GROUP",
|
|
49
|
+
"properties": [
|
|
50
|
+
{
|
|
51
|
+
"name": "visibility",
|
|
52
|
+
"label": "Visibility",
|
|
53
|
+
"format": "VISIBILITY"
|
|
54
|
+
}
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
],
|
|
58
|
+
"defaultConfig": {}
|
|
59
|
+
}
|
|
@@ -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></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 PHRpdGxlPlBlZ2EgdGV4dC1vbmx5IGxvZ288L3RpdGxlPjxwYXRoIHN0eWxlPSJmaWxsLW9wYWNpdHk6IC4yNTsiIGZpbGw9IiNmZmYiIGQ9Ik03LjcyIDMuODJjMCAyLjI1LTEuNzggMy40MS00IDMuNDFoLTEuNnYzSDBWLjQyaDMuOTRjMi4zNiAwIDMuNzggMS4zOSAzLjc4IDMuNHptLTQtMS40N2gt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MMzcgMS4yOGgtLjF2LjI5em0uMTMtLjQ0aC4yM2EuMjYuMjYgMCAwIDAgLjA3LS4wOWgtLjA2Yy0uMDUtLjE3LS4wNS0uMTctLjEzLS4xN2gtLjF6Ii8 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.12",
|
|
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",
|
|
@@ -34,7 +34,7 @@ function PegaDxilMyDetails(props: PegaDxilMyDetailsProps) {
|
|
|
34
34
|
|
|
35
35
|
const numRegions = getAllFields(getPConnect)?.length;
|
|
36
36
|
const gridRepeat = "repeat(".concat(numRegions).concat(", 1fr)");
|
|
37
|
-
const gridContainer = {
|
|
37
|
+
const gridContainer = { colGap: 0, 'margin-line-start': 0 };
|
|
38
38
|
// @ts-ignore
|
|
39
39
|
gridContainer.cols = gridRepeat;
|
|
40
40
|
// @ts-ignore
|
|
@@ -86,8 +86,12 @@ function PegaDxilMyDetails(props: PegaDxilMyDetailsProps) {
|
|
|
86
86
|
)}
|
|
87
87
|
<Grid container={gridContainer} data-testid={`column-count-${numRegions}`} >
|
|
88
88
|
{children.map((child: any, i: number) => (
|
|
89
|
-
|
|
90
|
-
<Flex
|
|
89
|
+
|
|
90
|
+
<Flex
|
|
91
|
+
// @ts-ignore
|
|
92
|
+
container={{ direction: 'column', alignItems: 'normal', colGap: 0, rowGap: 1.5 }}
|
|
93
|
+
key={`r-${i + 1}`}
|
|
94
|
+
>
|
|
91
95
|
<DetailsRender child={child} />
|
|
92
96
|
</Flex>
|
|
93
97
|
))}
|
|
@@ -27,7 +27,7 @@ function PegaDxilMyForm(props: PegaDxilMyFormProps) {
|
|
|
27
27
|
if (readOnly && readOnly === true && displayMode && displayMode === 'DISPLAY_ONLY') {
|
|
28
28
|
const numRegions = '1';
|
|
29
29
|
const gridRepeat = 'repeat('.concat(numRegions).concat(', 1fr)');
|
|
30
|
-
const gridContainer = { colGap: 0 };
|
|
30
|
+
const gridContainer = { colGap: 0, 'margin-line-start': 0 };
|
|
31
31
|
// @ts-ignore
|
|
32
32
|
gridContainer.cols = gridRepeat;
|
|
33
33
|
|
|
@@ -6,7 +6,8 @@ import {
|
|
|
6
6
|
registerIcon,
|
|
7
7
|
Table,
|
|
8
8
|
Label,
|
|
9
|
-
Link
|
|
9
|
+
Link,
|
|
10
|
+
URLDisplay
|
|
10
11
|
} from '@pega/cosmos-react-core';
|
|
11
12
|
import type { PConnFieldProps } from './PConnProps';
|
|
12
13
|
|
|
@@ -26,20 +27,32 @@ interface PegaDxilMyIconButtonUrlProps extends PConnFieldProps {
|
|
|
26
27
|
countryCode: string;
|
|
27
28
|
}
|
|
28
29
|
|
|
30
|
+
export const textFormatter = (value: string) => {
|
|
31
|
+
const displayComponent = (
|
|
32
|
+
<URLDisplay target='_blank' value={value} displayText={value} variant='link' />
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
return displayComponent;
|
|
36
|
+
};
|
|
37
|
+
|
|
29
38
|
// *************
|
|
30
|
-
// This component is meant to be an example of usage (Icon, Button, etc.) and NOT meant to be
|
|
39
|
+
// This component is meant to be an example of usage (Icon, Button, Link, etc.) and NOT meant to be
|
|
31
40
|
// used "as is"
|
|
32
41
|
//
|
|
33
42
|
// In this example, Icon is shown on its own and inside a Button
|
|
34
43
|
// Though an Icon can have an "onClick" event is it recommended if you want to click on it,
|
|
35
|
-
// to put it in a Button (shown below), so you can have a tooltip and hover style
|
|
44
|
+
// to put it in a Button (shown below), so you can have a tooltip and hover style or put it
|
|
45
|
+
// in a Link (shown below) as a URL.
|
|
36
46
|
//
|
|
37
|
-
//
|
|
38
|
-
// table below. The table
|
|
47
|
+
// For the button, the click will get a list of states for a given country and display in a
|
|
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.
|
|
39
50
|
//
|
|
40
|
-
// Globe icon is an icon placed in a
|
|
41
|
-
// the
|
|
42
|
-
// another icon, so with "icon" specified in the
|
|
51
|
+
// Globe icon is an icon placed in a Link element. The Link element to use an icon internally. (NOTE: In general
|
|
52
|
+
// the Link element shows the open icon to the left of the link text, but here we are using
|
|
53
|
+
// another icon, so with "icon" specified in the Link element, the open icon doesn't show)
|
|
54
|
+
// Link elements do not handle bad urls well, so we have a simple validator to prevent the Link element
|
|
55
|
+
// from getting most bad urls.
|
|
43
56
|
//
|
|
44
57
|
// NOTE: because icons have to be imported and registered, you can NOT put the icon name
|
|
45
58
|
// inside the config.json and let the user pick it, if it is not already part of your
|
|
@@ -49,10 +62,10 @@ interface PegaDxilMyIconButtonUrlProps extends PConnFieldProps {
|
|
|
49
62
|
// props passed in combination of props from property panel (config.json) and run time props from Constellation
|
|
50
63
|
// any default values in config.pros should be set in defaultProps at bottom of this file
|
|
51
64
|
function PegaDxilMyIconButtonUrl(props: PegaDxilMyIconButtonUrlProps) {
|
|
52
|
-
const { value, countryCode = 'USA', getPConnect, testId } = props;
|
|
65
|
+
const { value, displayMode, countryCode = 'USA', getPConnect, testId } = props;
|
|
53
66
|
const [statelist, setStatelist] = useState([]);
|
|
54
67
|
const [showTable, setShowTable] = useState(false);
|
|
55
|
-
const [validUrl, setValidUrl] = useState('');
|
|
68
|
+
const [validUrl, setValidUrl] = useState('about:blank');
|
|
56
69
|
const PConnect = getPConnect();
|
|
57
70
|
|
|
58
71
|
// IMPORTANT: need to register icons used in camel case
|
|
@@ -70,7 +83,7 @@ function PegaDxilMyIconButtonUrl(props: PegaDxilMyIconButtonUrlProps) {
|
|
|
70
83
|
setShowTable(prevShowTable => !prevShowTable);
|
|
71
84
|
}
|
|
72
85
|
|
|
73
|
-
// check if url is valid
|
|
86
|
+
// check if url is valid (simple)
|
|
74
87
|
function validateUrl(href: string) {
|
|
75
88
|
return /^(?:(?:(?:https?|ftp):)?\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})))(?::\d{2,5})?(?:[/?#]\S*)?$/i.test(
|
|
76
89
|
href
|
|
@@ -83,11 +96,13 @@ function PegaDxilMyIconButtonUrl(props: PegaDxilMyIconButtonUrlProps) {
|
|
|
83
96
|
// For example: Since the value is the property field,
|
|
84
97
|
// it could be entered from another component and thus as it is
|
|
85
98
|
// entered (typed in), it won't be valid until it is all entered.
|
|
99
|
+
// NOTE: can't have a blank value for the url as the Link element will error out
|
|
100
|
+
// in App studio preview
|
|
86
101
|
useEffect(() => {
|
|
87
102
|
if (validateUrl(value)) {
|
|
88
103
|
setValidUrl(value);
|
|
89
104
|
} else {
|
|
90
|
-
setValidUrl('');
|
|
105
|
+
setValidUrl('about:blank');
|
|
91
106
|
}
|
|
92
107
|
}, [value]);
|
|
93
108
|
|
|
@@ -126,6 +141,14 @@ function PegaDxilMyIconButtonUrl(props: PegaDxilMyIconButtonUrlProps) {
|
|
|
126
141
|
}
|
|
127
142
|
}, [PConnect, countryCode, showTable]);
|
|
128
143
|
|
|
144
|
+
// when DISPLAY_ONLY, in this example we will just show the URL.
|
|
145
|
+
if (displayMode === 'DISPLAY_ONLY') {
|
|
146
|
+
const displayComp = textFormatter(validUrl);
|
|
147
|
+
return (
|
|
148
|
+
<StyledPegaDxilMyIconButtonUrlWrapper> {displayComp} </StyledPegaDxilMyIconButtonUrlWrapper>
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
|
|
129
152
|
return (
|
|
130
153
|
<StyledPegaDxilMyIconButtonUrlWrapper>
|
|
131
154
|
<div style={{ display: 'flex' }} data-testid={testId}>
|
package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTwoColumnDetails/index.tsx
CHANGED
|
@@ -34,7 +34,7 @@ function PegaDxilMyTwoColumnDetails(props: PegaDxilMyTwoColumnDetailsProps) {
|
|
|
34
34
|
|
|
35
35
|
const numRegions = getAllFields(getPConnect)?.length;
|
|
36
36
|
const gridRepeat = "repeat(".concat(numRegions).concat(", 1fr)");
|
|
37
|
-
const gridContainer = {
|
|
37
|
+
const gridContainer = { colGap: 0, 'margin-line-start': 0 };
|
|
38
38
|
// @ts-ignore
|
|
39
39
|
gridContainer.cols = gridRepeat;
|
|
40
40
|
// @ts-ignore
|
|
@@ -93,8 +93,11 @@ function PegaDxilMyTwoColumnDetails(props: PegaDxilMyTwoColumnDetailsProps) {
|
|
|
93
93
|
)}
|
|
94
94
|
<Grid container={gridContainer} data-testid={`column-count-${numRegions}`} >
|
|
95
95
|
{children.map((child: any, i: number) => (
|
|
96
|
-
|
|
97
|
-
|
|
96
|
+
<Flex
|
|
97
|
+
// @ts-ignore
|
|
98
|
+
container={{ direction: 'column', alignItems: 'normal', colGap: 0, rowGap: 1.5 }}
|
|
99
|
+
key={`r-${i + 1}`}
|
|
100
|
+
>
|
|
98
101
|
<DetailsRender child={child} />
|
|
99
102
|
</Flex>
|
|
100
103
|
))}
|
|
@@ -34,7 +34,7 @@ function PegaDxilMyDetails(props: PegaDxilMyDetailsProps) {
|
|
|
34
34
|
|
|
35
35
|
const numRegions = getAllFields(getPConnect)?.length;
|
|
36
36
|
const gridRepeat = "repeat(".concat(numRegions).concat(", 1fr)");
|
|
37
|
-
const gridContainer = {
|
|
37
|
+
const gridContainer = { colGap: 0, 'margin-line-start': 0 };
|
|
38
38
|
// @ts-ignore
|
|
39
39
|
gridContainer.cols = gridRepeat;
|
|
40
40
|
// @ts-ignore
|
|
@@ -86,8 +86,12 @@ function PegaDxilMyDetails(props: PegaDxilMyDetailsProps) {
|
|
|
86
86
|
)}
|
|
87
87
|
<Grid container={gridContainer} data-testid={`column-count-${numRegions}`} >
|
|
88
88
|
{children.map((child: any, i: number) => (
|
|
89
|
-
|
|
90
|
-
<Flex
|
|
89
|
+
|
|
90
|
+
<Flex
|
|
91
|
+
// @ts-ignore
|
|
92
|
+
container={{ direction: 'column', alignItems: 'normal', colGap: 0, rowGap: 1.5 }}
|
|
93
|
+
key={`r-${i + 1}`}
|
|
94
|
+
>
|
|
91
95
|
<DetailsRender child={child} />
|
|
92
96
|
</Flex>
|
|
93
97
|
))}
|
|
@@ -27,7 +27,7 @@ function PegaDxilMyForm(props: PegaDxilMyFormProps) {
|
|
|
27
27
|
if (readOnly && readOnly === true && displayMode && displayMode === 'DISPLAY_ONLY') {
|
|
28
28
|
const numRegions = '1';
|
|
29
29
|
const gridRepeat = 'repeat('.concat(numRegions).concat(', 1fr)');
|
|
30
|
-
const gridContainer = { colGap: 0 };
|
|
30
|
+
const gridContainer = { colGap: 0, 'margin-line-start': 0 };
|
|
31
31
|
// @ts-ignore
|
|
32
32
|
gridContainer.cols = gridRepeat;
|
|
33
33
|
|
|
@@ -11,38 +11,6 @@
|
|
|
11
11
|
"subtype": "Text-URL",
|
|
12
12
|
"icon": "images/pz-url-active.svg",
|
|
13
13
|
"properties": [
|
|
14
|
-
{
|
|
15
|
-
"format": "SELECT",
|
|
16
|
-
"name": "countryCode",
|
|
17
|
-
"label": "Country code",
|
|
18
|
-
"defaultValue": "USA",
|
|
19
|
-
"source": [
|
|
20
|
-
{
|
|
21
|
-
"key": "USA",
|
|
22
|
-
"value": "United States"
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
"key": "CAN",
|
|
26
|
-
"value": "Canada"
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
"key": "AUS",
|
|
30
|
-
"value": "Australia"
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
"key": "JPN",
|
|
34
|
-
"value": "Japan"
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
"key": "IND",
|
|
38
|
-
"value": "India"
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
"key": "TUR",
|
|
42
|
-
"value": "Turkey"
|
|
43
|
-
}
|
|
44
|
-
]
|
|
45
|
-
},
|
|
46
14
|
{
|
|
47
15
|
"label": "Advanced",
|
|
48
16
|
"format": "GROUP",
|
package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyIconButtonURL/demo.stories.tsx
CHANGED
|
@@ -19,19 +19,19 @@ if (!window.PCore) {
|
|
|
19
19
|
window.PCore = {};
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
const
|
|
22
|
+
const countrylistData = {
|
|
23
23
|
data: [
|
|
24
24
|
{
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
Name: 'United States of America',
|
|
26
|
+
ShortName: 'USA'
|
|
27
27
|
},
|
|
28
28
|
{
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
Name: 'Canada',
|
|
30
|
+
ShortName: 'CAN'
|
|
31
31
|
},
|
|
32
32
|
{
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
Name: 'Mexico',
|
|
34
|
+
ShortName: 'MEX'
|
|
35
35
|
}
|
|
36
36
|
]
|
|
37
37
|
};
|
|
@@ -40,7 +40,7 @@ window.PCore.getDataPageUtils = () => {
|
|
|
40
40
|
return {
|
|
41
41
|
getDataAsync: () => {
|
|
42
42
|
return new Promise(resolve => {
|
|
43
|
-
resolve(
|
|
43
|
+
resolve(countrylistData);
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
46
|
};
|
|
@@ -49,7 +49,6 @@ window.PCore.getDataPageUtils = () => {
|
|
|
49
49
|
export const BasePegaDxilMyIconButtonUrl: Story = args => {
|
|
50
50
|
|
|
51
51
|
const props = {
|
|
52
|
-
countryCode: configProps.countryCode,
|
|
53
52
|
getPConnect: () => {
|
|
54
53
|
return {
|
|
55
54
|
getValue: value => {
|
|
@@ -95,5 +94,5 @@ export const BasePegaDxilMyIconButtonUrl: Story = args => {
|
|
|
95
94
|
};
|
|
96
95
|
|
|
97
96
|
BasePegaDxilMyIconButtonUrl.args = {
|
|
98
|
-
|
|
97
|
+
|
|
99
98
|
};
|