@pega/dx-component-builder-sdk 0.1.30 → 0.1.31
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 +1 -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,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable react/no-unused-prop-types */
|
|
1
2
|
import React, {useState} from "react";
|
|
2
3
|
import PropTypes from "prop-types";
|
|
3
4
|
import TextField from '@material-ui/core/TextField';
|
|
@@ -31,25 +32,33 @@ const useStyles = makeStyles((theme) => ({
|
|
|
31
32
|
// any default values in config.pros should be set in defaultProps at bottom of this file
|
|
32
33
|
export default function {{COMPONENT_CLASS_NAME}}(props) {
|
|
33
34
|
// const componentName = "Operator";
|
|
34
|
-
const {
|
|
35
|
+
const {
|
|
36
|
+
label,
|
|
37
|
+
createLabel,
|
|
38
|
+
updateLabel,
|
|
39
|
+
createOperator,
|
|
40
|
+
updateOperator,
|
|
41
|
+
createDateTime,
|
|
42
|
+
updateDateTime
|
|
43
|
+
} = props;
|
|
35
44
|
const classes = useStyles();
|
|
36
45
|
|
|
37
|
-
const fieldLabel =
|
|
46
|
+
const fieldLabel = label.toLowerCase();
|
|
38
47
|
let caseOpLabel = "---";
|
|
39
48
|
let caseOpName = "---";
|
|
40
49
|
let caseOpId = "";
|
|
41
50
|
let caseTime = null;
|
|
42
51
|
|
|
43
52
|
if (fieldLabel === "create operator") {
|
|
44
|
-
caseOpLabel =
|
|
45
|
-
caseOpName =
|
|
46
|
-
caseTime =
|
|
47
|
-
caseOpId =
|
|
53
|
+
caseOpLabel = createLabel;
|
|
54
|
+
caseOpName = createOperator.userName;
|
|
55
|
+
caseTime = createDateTime;
|
|
56
|
+
caseOpId = createOperator.userId;
|
|
48
57
|
} else if (fieldLabel === "update operator") {
|
|
49
|
-
caseOpLabel =
|
|
50
|
-
caseOpName =
|
|
51
|
-
caseTime =
|
|
52
|
-
caseOpId =
|
|
58
|
+
caseOpLabel = updateLabel;
|
|
59
|
+
caseOpName = updateOperator.userName;
|
|
60
|
+
caseTime = updateDateTime;
|
|
61
|
+
caseOpId = updateOperator.userId;
|
|
53
62
|
}
|
|
54
63
|
|
|
55
64
|
// Popover-related
|
|
@@ -204,8 +213,25 @@ export default function {{COMPONENT_CLASS_NAME}}(props) {
|
|
|
204
213
|
}
|
|
205
214
|
|
|
206
215
|
{{COMPONENT_CLASS_NAME}}.defaultProps = {
|
|
216
|
+
createLabel: null,
|
|
217
|
+
updateLabel: null,
|
|
218
|
+
createOperator: null,
|
|
219
|
+
updateOperator: null,
|
|
220
|
+
createDateTime: null,
|
|
221
|
+
updateDateTime: null
|
|
207
222
|
};
|
|
208
223
|
|
|
209
224
|
{{COMPONENT_CLASS_NAME}}.propTypes = {
|
|
210
|
-
|
|
225
|
+
getPConnect: PropTypes.func.isRequired,
|
|
226
|
+
label: PropTypes.string,
|
|
227
|
+
createLabel: PropTypes.string,
|
|
228
|
+
updateLabel: PropTypes.string,
|
|
229
|
+
resolveLabel: PropTypes.string,
|
|
230
|
+
createOperator: PropTypes.objectOf(PropTypes.any),
|
|
231
|
+
updateOperator: PropTypes.objectOf(PropTypes.any),
|
|
232
|
+
resolveOperator: PropTypes.objectOf(PropTypes.any),
|
|
233
|
+
createDateTime: PropTypes.string,
|
|
234
|
+
updateDateTime: PropTypes.string,
|
|
235
|
+
resolveDateTime: PropTypes.string,
|
|
236
|
+
hideLabel: PropTypes.bool
|
|
211
237
|
};
|
|
@@ -19,6 +19,18 @@ export const SOURCE_OF_COMPONENT_TYPES = {
|
|
|
19
19
|
LOCAL: 'Local'
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
+
export const visualLCCategory = (category) => {
|
|
23
|
+
|
|
24
|
+
switch (category) {
|
|
25
|
+
case CATEGORY_CONSTELLATION :
|
|
26
|
+
return "custom-".concat(category.toLowerCase());
|
|
27
|
+
case CATEGORY_CUSTOM :
|
|
28
|
+
case CATEGORY_OVERRIDE :
|
|
29
|
+
return category.toLowerCase().concat("-sdk");
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return category.toLowerCase();
|
|
33
|
+
}
|
|
22
34
|
|
|
23
35
|
export const getDeleteComponentsQuestions = async (options, sourceOfComponentsOption) => {
|
|
24
36
|
const defaultPegaServerConfig = await getPegaServerConfig();
|
|
@@ -83,7 +95,7 @@ export const deleteLocalComponents = async (sourceOfComponents, category = CATEG
|
|
|
83
95
|
}
|
|
84
96
|
}
|
|
85
97
|
} else {
|
|
86
|
-
const categoryLC = category
|
|
98
|
+
const categoryLC = visualLCCategory(category);
|
|
87
99
|
console.log(chalk.bold.redBright(`No ${categoryLC} components in ${sourceOfComponents}`));
|
|
88
100
|
}
|
|
89
101
|
};
|
|
@@ -20,6 +20,18 @@ export const SOURCE_OF_COMPONENT_TYPES = {
|
|
|
20
20
|
LOCAL: 'Local'
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
+
export const visualLCCategory = (category) => {
|
|
24
|
+
|
|
25
|
+
switch (category) {
|
|
26
|
+
case CATEGORY_CONSTELLATION :
|
|
27
|
+
return "custom-".concat(category.toLowerCase());
|
|
28
|
+
case CATEGORY_CUSTOM :
|
|
29
|
+
case CATEGORY_OVERRIDE :
|
|
30
|
+
return category.toLowerCase().concat("-sdk");
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return category.toLowerCase();
|
|
34
|
+
}
|
|
23
35
|
|
|
24
36
|
export const getDeleteComponentsQuestions = async (options, sourceOfComponentsOption) => {
|
|
25
37
|
const defaultPegaServerConfig = await getPegaServerConfig();
|
|
@@ -93,7 +105,7 @@ export const deleteLocalComponents = async (sourceOfComponents, category = CATEG
|
|
|
93
105
|
}
|
|
94
106
|
}
|
|
95
107
|
} else {
|
|
96
|
-
const categoryLC = category
|
|
108
|
+
const categoryLC = visualLCCategory(category);
|
|
97
109
|
console.log(chalk.bold.redBright(`No ${categoryLC} components in ${sourceOfComponents}`));
|
|
98
110
|
}
|
|
99
111
|
};
|
package/src/tasks/map/map.js
CHANGED
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
CATEGORY_CUSTOM,
|
|
15
15
|
CATEGORY_CONSTELLATION,
|
|
16
16
|
COMPONENT_DIRECTORY_PREFIX_CUSTOM,
|
|
17
|
+
COMPONENT_DIRECTORY_SUFFIX_SDK,
|
|
17
18
|
DXCB_CONFIG
|
|
18
19
|
} from '../../constants.js';
|
|
19
20
|
|
|
@@ -25,7 +26,7 @@ export const updateComponentMap = async (componentKey, category = CATEGORY_CUSTO
|
|
|
25
26
|
|
|
26
27
|
const pegaConfigJsonPath = path.join(path.resolve(), SDK_CONFIG_JSON_FILENAME);
|
|
27
28
|
const pegaLocalComponentMapPath = path.join(path.resolve(), SDK_LOCAL_COMPONENT_MAP_FILENAME);
|
|
28
|
-
const categoryDirectory = (category === CATEGORY_CONSTELLATION) ? join("/", COMPONENT_DIRECTORY_PREFIX_CUSTOM + category.toLowerCase()) : join("/", category.toLowerCase());
|
|
29
|
+
const categoryDirectory = (category === CATEGORY_CONSTELLATION) ? join("/", COMPONENT_DIRECTORY_PREFIX_CUSTOM + category.toLowerCase()) : join("/", category.toLowerCase() + COMPONENT_DIRECTORY_SUFFIX_SDK);
|
|
29
30
|
|
|
30
31
|
const componentNameNoPrefix = removeComponentPrefix(componentKey);
|
|
31
32
|
const componentName = convertIntoPascalCase(componentNameNoPrefix);
|
|
@@ -68,7 +69,7 @@ export const updateComponentMap = async (componentKey, category = CATEGORY_CUSTO
|
|
|
68
69
|
|
|
69
70
|
export const deleteFromComponentMap = async (componentKey, category = CATEGORY_CUSTOM) => {
|
|
70
71
|
const pegaLocalComponentMapPath = path.join(path.resolve(), SDK_LOCAL_COMPONENT_MAP_FILENAME);
|
|
71
|
-
const categoryDirectory = (category === CATEGORY_CONSTELLATION) ? join("/", COMPONENT_DIRECTORY_PREFIX_CUSTOM + category.toLowerCase()) : join("/", category.toLowerCase());
|
|
72
|
+
const categoryDirectory = (category === CATEGORY_CONSTELLATION) ? join("/", COMPONENT_DIRECTORY_PREFIX_CUSTOM + category.toLowerCase()) : join("/", category.toLowerCase() + COMPONENT_DIRECTORY_SUFFIX_SDK);
|
|
72
73
|
const pegaConfigJsonPath = path.join(path.resolve(), SDK_CONFIG_JSON_FILENAME);
|
|
73
74
|
|
|
74
75
|
const componentNameNoPrefix = removeComponentPrefix(componentKey);
|
|
@@ -176,12 +176,9 @@ export default async options => {
|
|
|
176
176
|
|
|
177
177
|
await myCustomTasks.run().catch(err => {
|
|
178
178
|
console.log(chalk.bold.red(err.toString()));
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
179
|
+
});
|
|
182
180
|
}
|
|
183
181
|
|
|
184
|
-
|
|
185
182
|
}
|
|
186
183
|
else {
|
|
187
184
|
for (var index in components) {
|
|
@@ -192,7 +189,7 @@ export default async options => {
|
|
|
192
189
|
|
|
193
190
|
await myOverrideTasks.run().catch(err => {
|
|
194
191
|
console.log(chalk.bold.red(err.toString()));
|
|
195
|
-
|
|
192
|
+
});
|
|
196
193
|
}
|
|
197
194
|
|
|
198
195
|
}
|
package/src/util.js
CHANGED
|
@@ -33,6 +33,7 @@ import {
|
|
|
33
33
|
CATEGORY_OVERRIDE,
|
|
34
34
|
CATEGORY_CONSTELLATION,
|
|
35
35
|
COMPONENT_DIRECTORY_PREFIX_CUSTOM,
|
|
36
|
+
COMPONENT_DIRECTORY_SUFFIX_SDK,
|
|
36
37
|
DXCB_COMPONENT_DEFAULTS,
|
|
37
38
|
SERVER_CONFIG,
|
|
38
39
|
SERVER_REST_URL
|
|
@@ -55,10 +56,23 @@ export const checkPathAccess = async (path, options = {}) => {
|
|
|
55
56
|
}
|
|
56
57
|
};
|
|
57
58
|
|
|
59
|
+
export const visualLCCategory = (category) => {
|
|
60
|
+
|
|
61
|
+
switch (category) {
|
|
62
|
+
case CATEGORY_CONSTELLATION :
|
|
63
|
+
return "custom-".concat(category.toLowerCase());
|
|
64
|
+
case CATEGORY_CUSTOM :
|
|
65
|
+
case CATEGORY_OVERRIDE :
|
|
66
|
+
return category.toLowerCase().concat("-sdk");
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return category.toLowerCase();
|
|
70
|
+
}
|
|
71
|
+
|
|
58
72
|
export const deleteLocalComponent = async (componentKey, category = CATEGORY_CUSTOM) => {
|
|
59
73
|
const currentDirectory = process.cwd();
|
|
60
74
|
const pegaConfigJsonPath = join(currentDirectory, SDK_CONFIG_JSON_FILENAME);
|
|
61
|
-
const categoryDirectory = (category === CATEGORY_CONSTELLATION) ? join("/", COMPONENT_DIRECTORY_PREFIX_CUSTOM + category.toLowerCase()) : join("/", category.toLowerCase());
|
|
75
|
+
const categoryDirectory = (category === CATEGORY_CONSTELLATION) ? join("/", COMPONENT_DIRECTORY_PREFIX_CUSTOM + category.toLowerCase()) : join("/", category.toLowerCase() + COMPONENT_DIRECTORY_SUFFIX_SDK);
|
|
62
76
|
|
|
63
77
|
await checkPathAccess(pegaConfigJsonPath);
|
|
64
78
|
|
|
@@ -76,14 +90,15 @@ export const deleteLocalComponent = async (componentKey, category = CATEGORY_CUS
|
|
|
76
90
|
throw err;
|
|
77
91
|
}
|
|
78
92
|
|
|
79
|
-
const sCat = (category
|
|
93
|
+
const sCat = visualLCCategory(category);
|
|
80
94
|
console.log(`${chalk.red.bold(componentKey)} is deleted from Local ${sCat} `);
|
|
81
95
|
|
|
82
96
|
|
|
83
97
|
});
|
|
84
98
|
}
|
|
85
99
|
else {
|
|
86
|
-
|
|
100
|
+
const categoryLC = visualLCCategory(category);
|
|
101
|
+
console.log(`${chalk.red.bold(componentKey)} is NOT FOUND from Local ${categoryLC} `);
|
|
87
102
|
}
|
|
88
103
|
};
|
|
89
104
|
|
|
@@ -165,7 +180,7 @@ export const getOptionsSource = (options) => {
|
|
|
165
180
|
export const getComponents = async (showSeparator = false, category = CATEGORY_CUSTOM) => {
|
|
166
181
|
const currentDirectory = process.cwd();
|
|
167
182
|
const pegaConfigJsonPath = join(currentDirectory, SDK_CONFIG_JSON_FILENAME);
|
|
168
|
-
const categoryDirectory = (category === CATEGORY_CONSTELLATION) ? join("/", COMPONENT_DIRECTORY_PREFIX_CUSTOM + category.toLowerCase()) : join("/", category.toLowerCase());
|
|
183
|
+
const categoryDirectory = (category === CATEGORY_CONSTELLATION) ? join("/", COMPONENT_DIRECTORY_PREFIX_CUSTOM + category.toLowerCase()) : join("/", category.toLowerCase() + COMPONENT_DIRECTORY_SUFFIX_SDK);
|
|
169
184
|
|
|
170
185
|
await checkPathAccess(pegaConfigJsonPath);
|
|
171
186
|
|
|
@@ -262,7 +277,7 @@ export const getDirectoryFiles = async (directory) => {
|
|
|
262
277
|
export const getComponentsObj = async (showSeparator = false, category = CATEGORY_CUSTOM) => {
|
|
263
278
|
const currentDirectory = process.cwd();
|
|
264
279
|
const pegaConfigJsonPath = join(currentDirectory, SDK_CONFIG_JSON_FILENAME);
|
|
265
|
-
const categoryDirectory = (category === CATEGORY_CONSTELLATION) ? join("/", COMPONENT_DIRECTORY_PREFIX_CUSTOM + category.toLowerCase()) : join("/", category.toLowerCase());
|
|
280
|
+
const categoryDirectory = (category === CATEGORY_CONSTELLATION) ? join("/", COMPONENT_DIRECTORY_PREFIX_CUSTOM + category.toLowerCase()) : join("/", category.toLowerCase() + COMPONENT_DIRECTORY_SUFFIX_SDK);
|
|
266
281
|
|
|
267
282
|
await checkPathAccess(pegaConfigJsonPath);
|
|
268
283
|
|
|
@@ -415,7 +430,7 @@ export const getSubComponentsAndDir = async (directory, type) => {
|
|
|
415
430
|
export const getComponentsAndSubDirectory = async (category = CATEGORY_CUSTOM) => {
|
|
416
431
|
const currentDirectory = process.cwd();
|
|
417
432
|
const pegaConfigJsonPath = join(currentDirectory, SDK_CONFIG_JSON_FILENAME);
|
|
418
|
-
const categoryDirectory = (category === CATEGORY_CONSTELLATION) ? join("/", COMPONENT_DIRECTORY_PREFIX_CUSTOM + category.toLowerCase()) : join("/", category.toLowerCase());
|
|
433
|
+
const categoryDirectory = (category === CATEGORY_CONSTELLATION) ? join("/", COMPONENT_DIRECTORY_PREFIX_CUSTOM + category.toLowerCase()) : join("/", category.toLowerCase() + COMPONENT_DIRECTORY_SUFFIX_SDK);
|
|
419
434
|
|
|
420
435
|
await checkPathAccess(pegaConfigJsonPath);
|
|
421
436
|
|
|
@@ -484,7 +499,7 @@ export const getComponentDefaults = async () => {
|
|
|
484
499
|
export const getComponentDirectoryPath = async (componentKey, category = CATEGORY_CUSTOM) => {
|
|
485
500
|
const currentDirectory = process.cwd();
|
|
486
501
|
const pegaConfigJsonPath = join(currentDirectory, SDK_CONFIG_JSON_FILENAME);
|
|
487
|
-
const categoryDirectory = (category === CATEGORY_CONSTELLATION) ? join("/", COMPONENT_DIRECTORY_PREFIX_CUSTOM + category.toLowerCase()) : join("/", category.toLowerCase());
|
|
502
|
+
const categoryDirectory = (category === CATEGORY_CONSTELLATION) ? join("/", COMPONENT_DIRECTORY_PREFIX_CUSTOM + category.toLowerCase()) : join("/", category.toLowerCase() + COMPONENT_DIRECTORY_SUFFIX_SDK);
|
|
488
503
|
|
|
489
504
|
await checkPathAccess(pegaConfigJsonPath);
|
|
490
505
|
|