@pega/custom-dx-components 0.24.11 → 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/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/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_MyPageWidget/demo.stories.tsx +12 -12
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPageWidget/index.tsx +5 -5
package/package.json
CHANGED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import {PConnect } from '@pega/pcore-pconnect-typedefs';
|
|
2
|
+
|
|
3
|
+
// PConnProps.d.ts
|
|
4
|
+
// This gives us a place to have each component (which is most DX Components) that is
|
|
5
|
+
// expected to have a getPConnect extend its props (from BaseProps)
|
|
6
|
+
// such that every component will be expected to have a getPConnect() function
|
|
7
|
+
// that returns a PConnect object. (new/better way of doing .propTypes).
|
|
8
|
+
// This PConnProps can be extended to include other props that we know are in every component
|
|
9
|
+
export interface PConnProps {
|
|
10
|
+
// getPConnect should exist for every C11n component. (add @ts-ignore in special cases where it isn't)
|
|
11
|
+
getPConnect: () => typeof PConnect;
|
|
12
|
+
|
|
13
|
+
// Allow any/all other key/value pairs in the BaseProps for now
|
|
14
|
+
// TODO: refine which other props are always expected for various component
|
|
15
|
+
// types and consider further interface "subclassing". For example, we may
|
|
16
|
+
// want to create a "BasePropsForm" that gives guidance on required, readonly, etc.
|
|
17
|
+
// and any other props that every Form component expects.
|
|
18
|
+
// For example, see the PConnFieldProps below.
|
|
19
|
+
// NOTE: if you uncomment the line below, the PConnProps type will allow
|
|
20
|
+
// otherwise undefined types to appear. This can be helpful for debugging
|
|
21
|
+
// or when adding new components whose types aren't yet known.
|
|
22
|
+
// [key: string]: any;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
// PConnFieldProps extends PConnProps to bring in the common properties that are
|
|
27
|
+
// associated with most field components (ex: Dropdown, TextInput, etc.) in the
|
|
28
|
+
// components/field directory
|
|
29
|
+
export interface PConnFieldProps extends PConnProps {
|
|
30
|
+
label: string,
|
|
31
|
+
required: boolean,
|
|
32
|
+
disabled: boolean,
|
|
33
|
+
value: any,
|
|
34
|
+
validatemessage: string,
|
|
35
|
+
status?: string,
|
|
36
|
+
onChange?: any,
|
|
37
|
+
onBlur?: any,
|
|
38
|
+
readOnly: boolean,
|
|
39
|
+
testId: string,
|
|
40
|
+
helperText: string,
|
|
41
|
+
displayMode?: string,
|
|
42
|
+
hideLabel: boolean,
|
|
43
|
+
placeholder?: string,
|
|
44
|
+
fieldMetadata?: any,
|
|
45
|
+
additionalProps?: any
|
|
46
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
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": "images/pz-url-active.svg",
|
|
13
|
+
"properties": [
|
|
14
|
+
{
|
|
15
|
+
"label": "Advanced",
|
|
16
|
+
"format": "GROUP",
|
|
17
|
+
"collapsible": true,
|
|
18
|
+
"properties": [
|
|
19
|
+
{
|
|
20
|
+
"name": "testId",
|
|
21
|
+
"label": "Test ID",
|
|
22
|
+
"format": "TEXT",
|
|
23
|
+
"ignorePattern": "[^-_\\p{N}\\p{L}]",
|
|
24
|
+
"includeAnnotations": false
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
],
|
|
29
|
+
"defaultConfig": {
|
|
30
|
+
"label": "@L $this.label"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
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
|
+
import { stateProps, configProps } from './mock';
|
|
8
|
+
|
|
9
|
+
const meta: Meta<typeof {{COMPONENT_CLASS_NAME}}> = {
|
|
10
|
+
title: '{{COMPONENT_CLASS_NAME}}',
|
|
11
|
+
component: {{COMPONENT_CLASS_NAME}},
|
|
12
|
+
excludeStories: /.*Data$/
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default meta;
|
|
16
|
+
type Story = StoryObj<typeof {{COMPONENT_CLASS_NAME}}>;
|
|
17
|
+
|
|
18
|
+
if (!window.PCore) {
|
|
19
|
+
window.PCore = {};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const countrylistData = {
|
|
23
|
+
data: [
|
|
24
|
+
{
|
|
25
|
+
Name: 'United States of America',
|
|
26
|
+
ShortName: 'USA'
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
Name: 'Canada',
|
|
30
|
+
ShortName: 'CAN'
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
Name: 'Mexico',
|
|
34
|
+
ShortName: 'MEX'
|
|
35
|
+
}
|
|
36
|
+
]
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
window.PCore.getDataPageUtils = () => {
|
|
40
|
+
return {
|
|
41
|
+
getDataAsync: () => {
|
|
42
|
+
return new Promise(resolve => {
|
|
43
|
+
resolve(countrylistData);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export const Base{{COMPONENT_CLASS_NAME}}: Story = args => {
|
|
50
|
+
|
|
51
|
+
const props = {
|
|
52
|
+
getPConnect: () => {
|
|
53
|
+
return {
|
|
54
|
+
getValue: value => {
|
|
55
|
+
return value;
|
|
56
|
+
},
|
|
57
|
+
getContextName: () => {
|
|
58
|
+
return 'app/primary_1';
|
|
59
|
+
},
|
|
60
|
+
getLocalizedValue: value => {
|
|
61
|
+
return value;
|
|
62
|
+
},
|
|
63
|
+
getActionsApi: () => {
|
|
64
|
+
return {
|
|
65
|
+
updateFieldValue: () => {
|
|
66
|
+
/* nothing */
|
|
67
|
+
},
|
|
68
|
+
triggerFieldChange: () => {
|
|
69
|
+
/* nothing */
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
},
|
|
73
|
+
ignoreSuggestion: () => {
|
|
74
|
+
/* nothing */
|
|
75
|
+
},
|
|
76
|
+
acceptSuggestion: () => {
|
|
77
|
+
/* nothing */
|
|
78
|
+
},
|
|
79
|
+
setInheritedProps: () => {
|
|
80
|
+
/* nothing */
|
|
81
|
+
},
|
|
82
|
+
resolveConfigProps: () => {
|
|
83
|
+
/* nothing */
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
return (
|
|
90
|
+
<>
|
|
91
|
+
<{{COMPONENT_CLASS_NAME}} {...props} {...args} />
|
|
92
|
+
</>
|
|
93
|
+
);
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
Base{{COMPONENT_CLASS_NAME}}.args = {
|
|
97
|
+
|
|
98
|
+
};
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Icon,
|
|
4
|
+
Button,
|
|
5
|
+
withConfiguration,
|
|
6
|
+
registerIcon,
|
|
7
|
+
Table,
|
|
8
|
+
Label,
|
|
9
|
+
Link,
|
|
10
|
+
URLDisplay
|
|
11
|
+
} from '@pega/cosmos-react-core';
|
|
12
|
+
import type { PConnFieldProps } from './PConnProps';
|
|
13
|
+
|
|
14
|
+
// IMPORTANT
|
|
15
|
+
// To use Icons, need to individually import the icon file form @pega/cosmos-react-core (see path below)
|
|
16
|
+
// Icons filename is kabab case (file-name), where as the icon you import is camel case (fileName)
|
|
17
|
+
// Icons need to be registered (camel case), and then used (kabab case)
|
|
18
|
+
import * as listNumber from '@pega/cosmos-react-core/lib/components/Icon/icons/list-number.icon';
|
|
19
|
+
import * as arrowRight from '@pega/cosmos-react-core/lib/components/Icon/icons/arrow-right.icon';
|
|
20
|
+
import * as globe from '@pega/cosmos-react-core/lib/components/Icon/icons/globe.icon';
|
|
21
|
+
|
|
22
|
+
import Styled{{COMPONENT_CLASS_NAME}}Wrapper from './styles';
|
|
23
|
+
|
|
24
|
+
// interface for props
|
|
25
|
+
interface {{COMPONENT_CLASS_NAME}}Props extends PConnFieldProps {
|
|
26
|
+
// If any, enter additional props that only exist on TextInput here
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export const textFormatter = (value: string) => {
|
|
30
|
+
const displayComponent = (
|
|
31
|
+
<URLDisplay target='_blank' value={value} displayText={value} variant='link' />
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
return displayComponent;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
// *************
|
|
38
|
+
// This component is meant to be an example of usage (Icon, Button, Link, etc.) and NOT meant to be
|
|
39
|
+
// used "as is"
|
|
40
|
+
//
|
|
41
|
+
// In this example, Icon is shown on its own and inside a Button
|
|
42
|
+
// Though an Icon can have an "onClick" event is it recommended if you want to click on it,
|
|
43
|
+
// to put it in a Button (shown below), so you can have a tooltip and hover style or put it
|
|
44
|
+
// in a Link (shown below) as a URL.
|
|
45
|
+
//
|
|
46
|
+
// For the button, the click will get a list of countries and display in a table
|
|
47
|
+
//
|
|
48
|
+
// Globe icon is an icon placed in a Link element. The Link element to use an icon internally. (NOTE: In general
|
|
49
|
+
// the Link element shows the open icon to the left of the link text, but here we are using
|
|
50
|
+
// another icon, so with "icon" specified in the Link element, the open icon doesn't show)
|
|
51
|
+
// Link elements do not handle bad urls well, so we have a simple validator to prevent the Link element
|
|
52
|
+
// from getting most bad urls.
|
|
53
|
+
//
|
|
54
|
+
// NOTE: because icons have to be imported and registered, you can NOT put the icon name
|
|
55
|
+
// inside the config.json and let the user pick it, if it is not already part of your
|
|
56
|
+
// import and registration (can't be done on the fly)
|
|
57
|
+
// **************
|
|
58
|
+
|
|
59
|
+
// props passed in combination of props from property panel (config.json) and run time props from Constellation
|
|
60
|
+
// any default values in config.pros should be set in defaultProps at bottom of this file
|
|
61
|
+
function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
|
|
62
|
+
const { value, displayMode, getPConnect, testId } = props;
|
|
63
|
+
const [statelist, setStatelist] = useState([]);
|
|
64
|
+
const [showTable, setShowTable] = useState(false);
|
|
65
|
+
const [validUrl, setValidUrl] = useState('about:blank');
|
|
66
|
+
const PConnect = getPConnect();
|
|
67
|
+
|
|
68
|
+
// IMPORTANT: need to register icons used in camel case
|
|
69
|
+
registerIcon(listNumber, arrowRight, globe);
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
// setting up columns for the work list table
|
|
73
|
+
const columns = [
|
|
74
|
+
{ renderer: 'countryName', label: PConnect.getLocalizedValue('Country Name', '', '') },
|
|
75
|
+
{ renderer: 'shortName', label: PConnect.getLocalizedValue('Abbreviation', '', '') }
|
|
76
|
+
];
|
|
77
|
+
|
|
78
|
+
// toggle showing table and getting table data
|
|
79
|
+
function showHideTable() {
|
|
80
|
+
setShowTable(prevShowTable => !prevShowTable);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// check if url is valid (simple)
|
|
84
|
+
function validateUrl(href: string) {
|
|
85
|
+
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(
|
|
86
|
+
href
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// Testing to see if value entered is valid url, if not can't use it.
|
|
91
|
+
// Reason for this code is that you can NOT pass to Link component
|
|
92
|
+
// a bad url, or it will error out.
|
|
93
|
+
// For example: Since the value is the property field,
|
|
94
|
+
// it could be entered from another component and thus as it is
|
|
95
|
+
// entered (typed in), it won't be valid until it is all entered.
|
|
96
|
+
// NOTE: can't have a blank value for the url as the Link element will error out
|
|
97
|
+
// in App studio preview
|
|
98
|
+
useEffect(() => {
|
|
99
|
+
if (validateUrl(value)) {
|
|
100
|
+
setValidUrl(value);
|
|
101
|
+
} else {
|
|
102
|
+
setValidUrl('about:blank');
|
|
103
|
+
}
|
|
104
|
+
}, [value]);
|
|
105
|
+
|
|
106
|
+
// going to get data for worklist to put into a table
|
|
107
|
+
// data comes from calling a PCore function to get
|
|
108
|
+
// get data from a data page and a PConnect function
|
|
109
|
+
// to get getContextName
|
|
110
|
+
useEffect(() => {
|
|
111
|
+
const dataViewName = 'CountryList';
|
|
112
|
+
const context = PConnect.getContextName();
|
|
113
|
+
const params = { };
|
|
114
|
+
|
|
115
|
+
// only retrieve table data if table is shown
|
|
116
|
+
if (showTable) {
|
|
117
|
+
PCore.getDataPageUtils()
|
|
118
|
+
.getDataAsync(dataViewName, context, params, null, null)
|
|
119
|
+
// @ts-ignore
|
|
120
|
+
.then((response: any) => {
|
|
121
|
+
// table requires an index or will get setExtraStackFrame error
|
|
122
|
+
setStatelist(
|
|
123
|
+
response.data.map((entry: any, index: number) => {
|
|
124
|
+
// mapping the data into the column names
|
|
125
|
+
// MUST have an id/index or will get a setExtraStackFrame error
|
|
126
|
+
// put a key in the table
|
|
127
|
+
return {
|
|
128
|
+
countryName: entry.Name,
|
|
129
|
+
shortName: entry.ShortName,
|
|
130
|
+
id: index
|
|
131
|
+
};
|
|
132
|
+
})
|
|
133
|
+
);
|
|
134
|
+
})
|
|
135
|
+
.catch((error: any) => {
|
|
136
|
+
console.log(error);
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
}, [PConnect, showTable]);
|
|
140
|
+
|
|
141
|
+
// when DISPLAY_ONLY, in this example we will just show the URL.
|
|
142
|
+
if (displayMode === 'DISPLAY_ONLY') {
|
|
143
|
+
const displayComp = textFormatter(validUrl);
|
|
144
|
+
return (
|
|
145
|
+
<Styled{{COMPONENT_CLASS_NAME}}Wrapper> {displayComp} </Styled{{COMPONENT_CLASS_NAME}}Wrapper>
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
return (
|
|
150
|
+
<Styled{{COMPONENT_CLASS_NAME}}Wrapper>
|
|
151
|
+
{{! pick new delimiters for mustache }}
|
|
152
|
+
{{=<% %>=}}
|
|
153
|
+
<div style={{ display: 'flex' }} data-testid={testId}>
|
|
154
|
+
<Icon
|
|
155
|
+
style={{ height: '1.5rem', width: '1.5rem' }}
|
|
156
|
+
// icon name is kabab case
|
|
157
|
+
name='arrow-right'
|
|
158
|
+
role='img'
|
|
159
|
+
aria-label='arrow right'
|
|
160
|
+
/>
|
|
161
|
+
<Label style={{ margin: '0.1rem' }}>
|
|
162
|
+
{' '}
|
|
163
|
+
{PConnect.getLocalizedValue('List of countries', '', '')}{' '}
|
|
164
|
+
</Label>
|
|
165
|
+
<Button
|
|
166
|
+
icon
|
|
167
|
+
label={PConnect.getLocalizedValue('Click to show/hide country list', '', '')}
|
|
168
|
+
variant='link'
|
|
169
|
+
compact={false}
|
|
170
|
+
onClick={showHideTable}
|
|
171
|
+
>
|
|
172
|
+
<Icon
|
|
173
|
+
style={{ height: '1.5rem', width: '1.5rem' }}
|
|
174
|
+
// icon name is kabab case
|
|
175
|
+
name='list-number'
|
|
176
|
+
role='img'
|
|
177
|
+
aria-label='numbered list'
|
|
178
|
+
/>
|
|
179
|
+
</Button>
|
|
180
|
+
<Link href={validUrl} variant='link' label={validUrl} icon>
|
|
181
|
+
<Icon
|
|
182
|
+
style={{ height: '1.5rem', width: '1.5rem' }}
|
|
183
|
+
// icon name is kabab case
|
|
184
|
+
name='globe'
|
|
185
|
+
role='img'
|
|
186
|
+
aria-label='open link'
|
|
187
|
+
/>
|
|
188
|
+
</Link>
|
|
189
|
+
</div>
|
|
190
|
+
{showTable && (
|
|
191
|
+
<Table
|
|
192
|
+
title={PConnect.getLocalizedValue('State list', '', '')}
|
|
193
|
+
columns={columns}
|
|
194
|
+
data={statelist}
|
|
195
|
+
/>
|
|
196
|
+
)}
|
|
197
|
+
<%={{ }}=%> {{! revert delimiters for mustache }}
|
|
198
|
+
</Styled{{COMPONENT_CLASS_NAME}}Wrapper>
|
|
199
|
+
);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
export default withConfiguration({{COMPONENT_CLASS_NAME}});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<svg width="100px" height="70px" viewBox="0 0 100 70" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
3
|
+
<title>1 col </title>
|
|
4
|
+
<defs>
|
|
5
|
+
<rect id="path-1" x="0" y="0" width="100" height="70"></rect>
|
|
6
|
+
</defs>
|
|
7
|
+
<g id="Concepts" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
|
8
|
+
<g id="Templates" transform="translate(-98.000000, -108.000000)">
|
|
9
|
+
<g id="Change-template" transform="translate(42.000000, 36.000000)">
|
|
10
|
+
<g id="1-col-" transform="translate(56.000000, 72.000000)">
|
|
11
|
+
<mask id="mask-2" fill="white">
|
|
12
|
+
<use xlink:href="#path-1"></use>
|
|
13
|
+
</mask>
|
|
14
|
+
<rect stroke="#A5A8BC" stroke-width="0.5" x="0.25" y="0.25" width="99.5" height="69.5"></rect>
|
|
15
|
+
<g id="white" mask="url(#mask-2)" fill="#FFFFFF">
|
|
16
|
+
<g transform="translate(3.000000, 3.000000)" id="Rectangle">
|
|
17
|
+
<rect x="0" y="0" width="94" height="66.5"></rect>
|
|
18
|
+
</g>
|
|
19
|
+
</g>
|
|
20
|
+
<g id="gray" mask="url(#mask-2)" fill="#8084A7">
|
|
21
|
+
<g transform="translate(6.000000, 6.000000)" id="Rectangle">
|
|
22
|
+
<rect x="0" y="-2.84217094e-14" width="88" height="77.8"></rect>
|
|
23
|
+
</g>
|
|
24
|
+
</g>
|
|
25
|
+
<g id="labels" mask="url(#mask-2)" font-family="OpenSans-Semibold, Open Sans" font-size="11" font-weight="500">
|
|
26
|
+
<g transform="translate(44.000000, 17.000000)" id="A">
|
|
27
|
+
<text>
|
|
28
|
+
<tspan x="0.75" y="12" fill="#FFFFFF">A</tspan>
|
|
29
|
+
</text>
|
|
30
|
+
</g>
|
|
31
|
+
</g>
|
|
32
|
+
</g>
|
|
33
|
+
</g>
|
|
34
|
+
</g>
|
|
35
|
+
</g>
|
|
36
|
+
</svg>
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import {PConnect } from '@pega/pcore-pconnect-typedefs';
|
|
2
|
+
|
|
3
|
+
// PConnProps.d.ts
|
|
4
|
+
// This gives us a place to have each component (which is most DX Components) that is
|
|
5
|
+
// expected to have a getPConnect extend its props (from BaseProps)
|
|
6
|
+
// such that every component will be expected to have a getPConnect() function
|
|
7
|
+
// that returns a PConnect object. (new/better way of doing .propTypes).
|
|
8
|
+
// This PConnProps can be extended to include other props that we know are in every component
|
|
9
|
+
export interface PConnProps {
|
|
10
|
+
// getPConnect should exist for every C11n component. (add @ts-ignore in special cases where it isn't)
|
|
11
|
+
getPConnect: () => typeof PConnect;
|
|
12
|
+
|
|
13
|
+
// Allow any/all other key/value pairs in the BaseProps for now
|
|
14
|
+
// TODO: refine which other props are always expected for various component
|
|
15
|
+
// types and consider further interface "subclassing". For example, we may
|
|
16
|
+
// want to create a "BasePropsForm" that gives guidance on required, readonly, etc.
|
|
17
|
+
// and any other props that every Form component expects.
|
|
18
|
+
// For example, see the PConnFieldProps below.
|
|
19
|
+
// NOTE: if you uncomment the line below, the PConnProps type will allow
|
|
20
|
+
// otherwise undefined types to appear. This can be helpful for debugging
|
|
21
|
+
// or when adding new components whose types aren't yet known.
|
|
22
|
+
// [key: string]: any;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
// PConnFieldProps extends PConnProps to bring in the common properties that are
|
|
27
|
+
// associated with most field components (ex: Dropdown, TextInput, etc.) in the
|
|
28
|
+
// components/field directory
|
|
29
|
+
export interface PConnFieldProps extends PConnProps {
|
|
30
|
+
label: string,
|
|
31
|
+
required: boolean,
|
|
32
|
+
disabled: boolean,
|
|
33
|
+
value: any,
|
|
34
|
+
validatemessage: string,
|
|
35
|
+
status?: string,
|
|
36
|
+
onChange?: any,
|
|
37
|
+
onBlur?: any,
|
|
38
|
+
readOnly: boolean,
|
|
39
|
+
testId: string,
|
|
40
|
+
helperText: string,
|
|
41
|
+
displayMode?: string,
|
|
42
|
+
hideLabel: boolean,
|
|
43
|
+
placeholder?: string,
|
|
44
|
+
fieldMetadata?: any,
|
|
45
|
+
additionalProps?: any
|
|
46
|
+
}
|
|
@@ -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+PHRpdGxlPlBlZ2EgdGV4dC1vbmx5IGxvZ288L3RpdGxlPjxwYXRoIHN0eWxlPSJmaWxsLW9wYWNpdHk6IC4yNTsiIGZpbGw9IiNmZmYiIGQ9Ik03LjcyIDMuODJjMCAyLjI1LTEuNzggMy40MS00IDMuNDFoLTEuNnYzSDBWLjQyaDMuOTRjMi4zNiAwIDMuNzggMS4zOSAzLjc4IDMuNHptLTQtMS40N2gtMS42djNoMS43QTEuNDcgMS40NyAwIDAgMCA1LjUgMy44MmMwLS45MS0uNjUtMS40Ny0xLjc1LTEuNDd6bTcuNjggNS45MWg1LjN2Mkg5LjI5Vi40Mmg3LjM4djEuOTNoLTUuMjR2Mmg0LjI0djEuOWgtNC4yNHpNMjMuMTggMGE1IDUgMCAwIDEgMy41NyAxLjI4TDI1LjYzIDIuOGEzLjc4IDMuNzggMCAwIDAtMS4wNS0uNjNBNC4zMiA0LjMyIDAgMCAwIDIzLjMxIDIgMy4xNyAzLjE3IDAgMCAwIDIwIDUuMjdhMy4xNiAzLjE2IDAgMCAwIDEgMi4zOSAzLjA3IDMuMDcgMCAwIDAgMi4xNy44NCA0LjYgNC42IDAgMCAwIDIuMDktLjVWNi4xOWgtMi4yVjQuMzhoNC4yNXY0LjU2YTUuNDEgNS40MSAwIDAgMS00LjA4IDEuNTdBNS4zNSA1LjM1IDAgMCAxIDE5LjQzIDlhNS4wNSA1LjA1IDAgMCAxLTEuNTYtMy43NCA1LjIxIDUuMjEgMCAwIDEgMS41Ni0zLjc2QTUuMzEgNS4zMSAwIDAgMSAyMy4xOCAwem0xMS4yOS40Mmw0LjEzIDkuNzloLTIuMjVMMzUuNDggOGgtNC4wNmwtLjkgMi4xOGgtMi4yTDMyLjUxLjQyem0uMjUgNS43MkwzMy40NCAzbC0xLjI5IDMuMTR6bTMtNWEuNzEuNzEgMCAwIDEtLjc0Ljc1LjcxLjcxIDAgMCAxLS43My0uNzUuNzMuNzMgMCAwIDEgLjc1LS43Mi43Mi43MiAwIDAgMSAuNzUuNzF6TTM3IC41M2EuNTkuNTkgMCAwIDAtLjYuNi42MS42MSAwIDEgMCAxLjIxIDAgLjYuNiAwIDAgMC0uNjEtLjZ6bS0uMjQgMVYuNzFIMzdjLjEyIDAgLjE4LjA2LjI1LjA2YS4yMS4yMSAwIDAgMSAuMDcuMTguMTkuMTkgMCAwIDEtLjA3LjE4cy0uMDcuMDgtLjEzLjA4bC4yNi4zNmgtLjJMMzcgMS4yOGgtLjF2LjI5em0uMTMtLjQ0aC4yM2EuMjYuMjYgMCAwIDAgLjA3LS4wOWgtLjA2Yy0uMDUtLjE3LS4wNS0uMTctLjEzLS4xN2gtLjF6Ii8+PC9zdmc+"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"name": "datasource",
|
|
34
|
+
"label": "Data source for details",
|
|
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 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.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",
|
|
@@ -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
|
};
|
|
@@ -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
|
};
|
|
@@ -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
|
})
|