@pega/dx-component-builder-sdk 0.1.30 → 0.1.32
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/pega-dx-component-builder-sdk-0.1.31.tgz +0 -0
- package/src/constants.js +5 -0
- package/src/tasks/create/templates/SDK-React/template/DETAILS/demo.stories.jsx.mustache +49 -487
- package/src/tasks/create/templates/SDK-React/template/DETAILS/index.tsx.mustache +70 -26
- package/src/tasks/create/templates/SDK-React/template/DETAILS/mock.stories.js.mustache +281 -21
- package/src/tasks/create/templates/SDK-React/template/DETAILS-region/demo.stories.jsx.mustache +42 -1076
- package/src/tasks/create/templates/SDK-React/template/DETAILS-region/index.tsx.mustache +67 -31
- package/src/tasks/create/templates/SDK-React/template/DETAILS-region/mock.stories.js.mustache +281 -25
- package/src/tasks/create/templates/SDK-React/template/FORM/demo.stories.jsx.mustache +17 -2
- package/src/tasks/create/templates/SDK-React/template/FORM/index.tsx.mustache +22 -22
- package/src/tasks/create/templates/SDK-React/template/FORM/utils.ts.mustache +76 -0
- package/src/tasks/create/templates/SDK-React/template/PAGE/demo.stories.jsx.mustache +1 -1
- package/src/tasks/create/templates/SDK-React/widget/PAGE-CASE/demo.stories.jsx.mustache +8 -1
- package/src/tasks/create/templates/SDK-React/widget/PAGE-CASE/index.tsx.mustache +37 -11
- package/src/tasks/delete/helper.js +13 -1
- package/src/tasks/delete-all/helper.js +13 -1
- package/src/tasks/map/map.js +3 -2
- package/src/tasks/publish-all/index.js +2 -5
- package/src/util.js +22 -7
|
@@ -1,45 +1,89 @@
|
|
|
1
|
+
import React, { createElement } from "react";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
import Grid from "@material-ui/core/Grid";
|
|
4
|
+
import FieldGroup from "@pega/react-sdk-components/lib/components/designSystemExtension/FieldGroup";
|
|
5
|
+
import createPConnectComponent from "@pega/react-sdk-components/lib/bridge/react_pconnect";
|
|
1
6
|
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import Grid from '@material-ui/core/Grid';
|
|
5
|
-
import DetailsFields from '@pega/react-sdk-components/lib/components/designSystemExtension/DetailsFields';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import Styled{{COMPONENT_CLASS_NAME}}Wrapper from './styles';
|
|
9
|
-
|
|
7
|
+
// eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
|
|
8
|
+
import Styled{{COMPONENT_CLASS_NAME}}Wrapper from "./styles";
|
|
10
9
|
|
|
11
10
|
// Duplicated runtime code from React SDK
|
|
12
11
|
|
|
13
12
|
// props passed in combination of props from property panel (config.json) and run time props from Constellation
|
|
14
13
|
// any default values in config.pros should be set in defaultProps at bottom of this file
|
|
15
14
|
export default function {{COMPONENT_CLASS_NAME}}(props) {
|
|
16
|
-
const {
|
|
17
|
-
|
|
15
|
+
const { label, showLabel, getPConnect, showHighlightedData } = props;
|
|
16
|
+
|
|
17
|
+
// Get the inherited props from the parent to determine label settings
|
|
18
|
+
const propsToUse = { label, showLabel, ...getPConnect().getInheritedProps() };
|
|
19
|
+
|
|
20
|
+
// Set display mode prop and re-create the children so this part of the dom tree renders
|
|
21
|
+
// in a readonly (display) mode instead of a editable
|
|
22
|
+
getPConnect().setInheritedProp("displayMode", "LABELS_LEFT");
|
|
23
|
+
getPConnect().setInheritedProp("readOnly", true);
|
|
24
|
+
const children = getPConnect()
|
|
25
|
+
.getChildren()
|
|
26
|
+
.map((configObject, index) =>
|
|
27
|
+
createElement(createPConnectComponent(), {
|
|
28
|
+
...configObject,
|
|
29
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
30
|
+
key: index.toString(),
|
|
31
|
+
})
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
// Set up highlighted data to pass in return if is set to show, need raw metadata to pass to createComponent
|
|
35
|
+
let highlightedDataArr = [];
|
|
36
|
+
if (showHighlightedData) {
|
|
37
|
+
const { highlightedData = [] } = getPConnect().getRawMetadata().config;
|
|
38
|
+
highlightedDataArr = highlightedData.map((field) => {
|
|
39
|
+
field.config.displayMode = "STACKED_LARGE_VAL";
|
|
40
|
+
|
|
41
|
+
// Mark as status display when using pyStatusWork
|
|
42
|
+
if (field.config.value === "@P .pyStatusWork") {
|
|
43
|
+
field.type = "TextInput";
|
|
44
|
+
field.config.displayAsStatus = true;
|
|
45
|
+
}
|
|
18
46
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const theChildrenOfChild = theChildPConn.getChildren();
|
|
22
|
-
arFields.push(theChildrenOfChild);
|
|
47
|
+
return getPConnect().createComponent(field);
|
|
48
|
+
});
|
|
23
49
|
}
|
|
24
50
|
|
|
51
|
+
{{! pick new delimiteres for mustache }}
|
|
52
|
+
{{=<% %>=}}
|
|
53
|
+
|
|
25
54
|
return (
|
|
26
|
-
<
|
|
27
|
-
|
|
28
|
-
<Grid container spacing={1}>
|
|
29
|
-
|
|
30
|
-
<
|
|
31
|
-
|
|
55
|
+
<FieldGroup name={propsToUse.showLabel ? propsToUse.label : ""}>
|
|
56
|
+
{showHighlightedData && highlightedDataArr.length > 0 && (
|
|
57
|
+
<Grid container spacing={1} style={{ padding: "0 0 1em" }}>
|
|
58
|
+
{highlightedDataArr.map((child, i) => (
|
|
59
|
+
<Grid item xs={12} key={`hf-${i + 1}`}>
|
|
60
|
+
{child}
|
|
61
|
+
</Grid>
|
|
62
|
+
))}
|
|
32
63
|
</Grid>
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
64
|
+
)}
|
|
65
|
+
<Grid container spacing={1}>
|
|
66
|
+
{children.map((child, i) => (
|
|
67
|
+
<Grid item xs={12} key={`r-${i + 1}`}>
|
|
68
|
+
{child}
|
|
69
|
+
</Grid>
|
|
70
|
+
))}
|
|
71
|
+
</Grid>
|
|
72
|
+
</FieldGroup>
|
|
73
|
+
);
|
|
37
74
|
}
|
|
38
75
|
|
|
39
|
-
{{
|
|
76
|
+
<%={{ }}=%> {{! revert delimiteres for mustache }}
|
|
40
77
|
|
|
78
|
+
{{COMPONENT_CLASS_NAME}}.defaultProps = {
|
|
79
|
+
label: undefined,
|
|
80
|
+
showLabel: true,
|
|
81
|
+
showHighlightedData: false,
|
|
41
82
|
};
|
|
42
83
|
|
|
43
84
|
{{COMPONENT_CLASS_NAME}}.propTypes = {
|
|
44
|
-
|
|
85
|
+
showLabel: PropTypes.bool,
|
|
86
|
+
label: PropTypes.string,
|
|
87
|
+
getPConnect: PropTypes.func.isRequired,
|
|
88
|
+
showHighlightedData: PropTypes.bool,
|
|
45
89
|
};
|
|
@@ -1,34 +1,294 @@
|
|
|
1
1
|
const operatorDetails = {
|
|
2
2
|
data: {
|
|
3
|
-
pzLoadTime:
|
|
4
|
-
pzPageNameHash:
|
|
3
|
+
pzLoadTime: "January 18, 2023 10:33:19 AM EST",
|
|
4
|
+
pzPageNameHash: "_pa1519192551088960pz",
|
|
5
5
|
pyOperatorInfo: {
|
|
6
|
-
pyUserName:
|
|
7
|
-
pyPosition:
|
|
8
|
-
pyImageInsKey:
|
|
6
|
+
pyUserName: "french DigV2",
|
|
7
|
+
pyPosition: "",
|
|
8
|
+
pyImageInsKey: "",
|
|
9
9
|
pySkills: [
|
|
10
10
|
{
|
|
11
|
-
pySkillName:
|
|
12
|
-
pzIndexOwnerKey:
|
|
13
|
-
pySkillRating: 0
|
|
14
|
-
}
|
|
11
|
+
pySkillName: "",
|
|
12
|
+
pzIndexOwnerKey: "DATA-ADMIN-OPERATOR-ID FRENCHTEST.DIGV2",
|
|
13
|
+
pySkillRating: 0,
|
|
14
|
+
},
|
|
15
15
|
],
|
|
16
|
-
pyReportToUserName:
|
|
17
|
-
pyReportTo:
|
|
18
|
-
pyOrganization:
|
|
19
|
-
pyTitle:
|
|
20
|
-
pyLabel:
|
|
21
|
-
pyEmailAddress:
|
|
22
|
-
pyTelephone:
|
|
23
|
-
}
|
|
16
|
+
pyReportToUserName: "",
|
|
17
|
+
pyReportTo: "",
|
|
18
|
+
pyOrganization: "DXIL",
|
|
19
|
+
pyTitle: "",
|
|
20
|
+
pyLabel: "frenchTest.DigV2",
|
|
21
|
+
pyEmailAddress: "User@DigV2",
|
|
22
|
+
pyTelephone: "",
|
|
23
|
+
},
|
|
24
24
|
},
|
|
25
25
|
status: 200,
|
|
26
|
-
statusText:
|
|
26
|
+
statusText: "",
|
|
27
27
|
headers: {
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
"content-length": "435",
|
|
29
|
+
"content-type": "application/json;charset=UTF-8",
|
|
30
30
|
},
|
|
31
|
-
request: {}
|
|
31
|
+
request: {},
|
|
32
32
|
};
|
|
33
33
|
|
|
34
34
|
export default operatorDetails;
|
|
35
|
+
|
|
36
|
+
export const pyReviewRaw = {
|
|
37
|
+
name: "pyReview",
|
|
38
|
+
type: "View",
|
|
39
|
+
config: {
|
|
40
|
+
template: "Details",
|
|
41
|
+
ruleClass: "MyCo-MyCompon-Work-MyComponents",
|
|
42
|
+
showLabel: true,
|
|
43
|
+
label: "@L Details",
|
|
44
|
+
localeReference: "@LR MYCO-MYCOMPON-WORK-MYCOMPONENTS!VIEW!PYREVIEW",
|
|
45
|
+
showHighlightedData: true,
|
|
46
|
+
highlightedData: [
|
|
47
|
+
{
|
|
48
|
+
type: "TextInput",
|
|
49
|
+
config: {
|
|
50
|
+
value: "@P .pyStatusWork",
|
|
51
|
+
label: "@L Work Status",
|
|
52
|
+
displayMode: "STACKED_LARGE_VAL",
|
|
53
|
+
displayAsStatus: true,
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
type: "TextInput",
|
|
58
|
+
config: {
|
|
59
|
+
value: "@P .pyID",
|
|
60
|
+
label: "@L Case ID",
|
|
61
|
+
displayMode: "STACKED_LARGE_VAL",
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
type: "DateTime",
|
|
66
|
+
config: {
|
|
67
|
+
value: "@P .pxCreateDateTime",
|
|
68
|
+
label: "@L Create date/time",
|
|
69
|
+
displayMode: "STACKED_LARGE_VAL",
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
type: "UserReference",
|
|
74
|
+
config: {
|
|
75
|
+
label: "@L Create Operator",
|
|
76
|
+
value: "@USER .pxCreateOperator",
|
|
77
|
+
placeholder: "Select...",
|
|
78
|
+
displayMode: "STACKED_LARGE_VAL",
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
],
|
|
82
|
+
inheritedProps: [
|
|
83
|
+
{
|
|
84
|
+
prop: "label",
|
|
85
|
+
value: "@L Details",
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
prop: "showLabel",
|
|
89
|
+
value: true,
|
|
90
|
+
},
|
|
91
|
+
],
|
|
92
|
+
},
|
|
93
|
+
children: [
|
|
94
|
+
{
|
|
95
|
+
name: "A",
|
|
96
|
+
type: "Region",
|
|
97
|
+
getPConnect: () => {
|
|
98
|
+
return {
|
|
99
|
+
getRawMetadata: () => {
|
|
100
|
+
return pyReviewRaw.children[0];
|
|
101
|
+
},
|
|
102
|
+
};
|
|
103
|
+
},
|
|
104
|
+
children: [
|
|
105
|
+
{
|
|
106
|
+
readOnly: undefined,
|
|
107
|
+
placeholder: "First Name",
|
|
108
|
+
value: "John",
|
|
109
|
+
label: "First Name",
|
|
110
|
+
hasSuggestions: false,
|
|
111
|
+
displayMode: "LABELS_LEFT",
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
readOnly: undefined,
|
|
115
|
+
placeholder: "Middle Name",
|
|
116
|
+
value: "",
|
|
117
|
+
label: "Middle Name",
|
|
118
|
+
hasSuggestions: false,
|
|
119
|
+
displayMode: "LABELS_LEFT",
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
readOnly: undefined,
|
|
123
|
+
placeholder: "Last Name",
|
|
124
|
+
value: "Doe",
|
|
125
|
+
label: "Last Name",
|
|
126
|
+
hasSuggestions: false,
|
|
127
|
+
displayMode: "LABELS_LEFT",
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
value: "john@doe.com",
|
|
131
|
+
label: "Email",
|
|
132
|
+
required: true,
|
|
133
|
+
testId: "CE8AE9DA5B7CD6C3DF2929543A9AF92D",
|
|
134
|
+
hasSuggestions: false,
|
|
135
|
+
displayMode: "LABELS_LEFT",
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
readOnly: undefined,
|
|
139
|
+
value: "+16397975093",
|
|
140
|
+
label: "Phone",
|
|
141
|
+
displayMode: "LABELS_LEFT",
|
|
142
|
+
hasSuggestions: false,
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
readOnly: undefined,
|
|
146
|
+
placeholder: "Price",
|
|
147
|
+
value: "90.99",
|
|
148
|
+
label: "Price",
|
|
149
|
+
hasSuggestions: false,
|
|
150
|
+
displayMode: "LABELS_LEFT",
|
|
151
|
+
getPConnect: () => {
|
|
152
|
+
return {
|
|
153
|
+
getActionsApi: () => {/* nothing */},
|
|
154
|
+
getStateProps: () => {
|
|
155
|
+
return {
|
|
156
|
+
value: "",
|
|
157
|
+
};
|
|
158
|
+
},
|
|
159
|
+
getComponentName: () => {
|
|
160
|
+
return "currency";
|
|
161
|
+
},
|
|
162
|
+
};
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
readOnly: undefined,
|
|
167
|
+
value: "100 Mbps",
|
|
168
|
+
label: "Internet Plan",
|
|
169
|
+
hasSuggestions: false,
|
|
170
|
+
displayMode: "LABELS_LEFT",
|
|
171
|
+
getPConnect: () => {
|
|
172
|
+
return {
|
|
173
|
+
getActionsApi: () => {/* nothing */},
|
|
174
|
+
getStateProps: () => {
|
|
175
|
+
return {
|
|
176
|
+
value: "",
|
|
177
|
+
};
|
|
178
|
+
},
|
|
179
|
+
getComponentName: () => {
|
|
180
|
+
return "radio";
|
|
181
|
+
},
|
|
182
|
+
getConfigProps: () => {
|
|
183
|
+
return {};
|
|
184
|
+
},
|
|
185
|
+
getDataObject: () => {
|
|
186
|
+
return {};
|
|
187
|
+
},
|
|
188
|
+
};
|
|
189
|
+
},
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
caseOpConfig: {
|
|
193
|
+
label: "Update operator",
|
|
194
|
+
createLabel: "Created",
|
|
195
|
+
updateLabel: "Updated",
|
|
196
|
+
updateDateTime: "2023-03-10T12:53:04.670Z",
|
|
197
|
+
createDateTime: "2023-03-10T12:52:20.054Z",
|
|
198
|
+
updateOperator: {
|
|
199
|
+
userId: "User.DigV2",
|
|
200
|
+
userName: "User DigV2",
|
|
201
|
+
},
|
|
202
|
+
createOperator: {
|
|
203
|
+
userId: "User.DigV2",
|
|
204
|
+
userName: "User DigV2",
|
|
205
|
+
},
|
|
206
|
+
},
|
|
207
|
+
},
|
|
208
|
+
],
|
|
209
|
+
},
|
|
210
|
+
],
|
|
211
|
+
classID: "MyCo-MyCompon-Work-MyComponents",
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
export const pyReviewResolved = {
|
|
215
|
+
readOnly: true,
|
|
216
|
+
template: "Details",
|
|
217
|
+
ruleClass: "MyCo-MyCompon-Work-MyComponents",
|
|
218
|
+
showLabel: true,
|
|
219
|
+
label: "Details",
|
|
220
|
+
localeReference: "MYCO-MYCOMPON-WORK-MYCOMPONENTS!VIEW!PYREVIEW",
|
|
221
|
+
showHighlightedData: true,
|
|
222
|
+
highlightedData: [
|
|
223
|
+
{
|
|
224
|
+
type: "TextInput",
|
|
225
|
+
config: {
|
|
226
|
+
value: "New",
|
|
227
|
+
label: "Work Status",
|
|
228
|
+
displayMode: "STACKED_LARGE_VAL",
|
|
229
|
+
displayAsStatus: true,
|
|
230
|
+
},
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
type: "TextInput",
|
|
234
|
+
config: {
|
|
235
|
+
value: "M-1002",
|
|
236
|
+
label: "Case ID",
|
|
237
|
+
displayMode: "STACKED_LARGE_VAL",
|
|
238
|
+
},
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
type: "DateTime",
|
|
242
|
+
config: {
|
|
243
|
+
value: "2022-12-11T20:06:27.232Z",
|
|
244
|
+
label: "Create date/time",
|
|
245
|
+
displayMode: "STACKED_LARGE_VAL",
|
|
246
|
+
},
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
type: "UserReference",
|
|
250
|
+
config: {
|
|
251
|
+
label: "Create Operator",
|
|
252
|
+
value: {
|
|
253
|
+
userId: "conns",
|
|
254
|
+
userName: "Sara Connor",
|
|
255
|
+
},
|
|
256
|
+
placeholder: "Select...",
|
|
257
|
+
displayMode: "STACKED_LARGE_VAL",
|
|
258
|
+
},
|
|
259
|
+
},
|
|
260
|
+
],
|
|
261
|
+
displayMode: "LABELS_LEFT",
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
export const regionChildrenResolved = [
|
|
265
|
+
{
|
|
266
|
+
readOnly: true,
|
|
267
|
+
value: "",
|
|
268
|
+
label: "SLA Deadline",
|
|
269
|
+
displayMode: "LABELS_LEFT",
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
readOnly: true,
|
|
273
|
+
value: "",
|
|
274
|
+
label: "SLA Goal",
|
|
275
|
+
displayMode: "LABELS_LEFT",
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
readOnly: true,
|
|
279
|
+
value: "",
|
|
280
|
+
label: "SLA Start Time",
|
|
281
|
+
listType: "associated",
|
|
282
|
+
datasource: [
|
|
283
|
+
{
|
|
284
|
+
key: "AssignmentCreation",
|
|
285
|
+
value: "The creation time of the Assignment",
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
key: "CurrentTime",
|
|
289
|
+
value: "Current Date Time",
|
|
290
|
+
},
|
|
291
|
+
],
|
|
292
|
+
displayMode: "LABELS_LEFT",
|
|
293
|
+
},
|
|
294
|
+
];
|