@pega/dx-component-builder-sdk 0.1.16 → 0.1.17
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/cli.js +6 -0
- package/src/constants.js +13 -17
- package/src/tasks/build-all/helper.js +76 -0
- package/src/tasks/build-all/index.js +121 -0
- package/src/tasks/create/index.js +52 -60
- package/src/tasks/create/templates/Constellation/Field/Boolean/demo.stories.jsx.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Field/Date/demo.stories.jsx.mustache +11 -6
- package/src/tasks/create/templates/Constellation/Field/DateTime/demo.stories.jsx.mustache +11 -7
- package/src/tasks/create/templates/Constellation/Field/Decimal/demo.stories.jsx.mustache +7 -7
- package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/demo.stories.jsx.mustache +9 -8
- package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/demo.stories.jsx.mustache +7 -7
- package/src/tasks/create/templates/Constellation/Field/Integer/demo.stories.jsx.mustache +7 -7
- package/src/tasks/create/templates/Constellation/Field/Picklist/demo.stories.jsx.mustache +16 -10
- package/src/tasks/create/templates/Constellation/Field/Text/demo.stories.jsx.mustache +9 -7
- package/src/tasks/create/templates/Constellation/Field/Text-Email/demo.stories.jsx.mustache +8 -8
- package/src/tasks/create/templates/Constellation/Field/Text-Input/demo.stories.jsx.mustache +7 -7
- package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/demo.stories.jsx.mustache +7 -7
- package/src/tasks/create/templates/Constellation/Field/Text-Phone/demo.stories.jsx.mustache +6 -6
- package/src/tasks/create/templates/Constellation/Field/Text-Phone/index.jsx.mustache +1 -1
- package/src/tasks/create/templates/Constellation/Field/Text-URL/demo.stories.jsx.mustache +6 -6
- package/src/tasks/create/templates/Constellation/Field/Text-URL/index.jsx.mustache +1 -1
- package/src/tasks/create/templates/Constellation/Field/Text-URL/{text-url.js.mustache → text-url.jsx.mustache} +2 -1
- package/src/tasks/create/templates/Constellation/Field/TimeofDay/demo.stories.jsx.mustache +10 -5
- package/src/tasks/create/templates/Constellation/Template/DETAILS/demo.stories.jsx.mustache +59 -51
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/demo.stories.jsx.mustache +64 -59
- package/src/tasks/create/templates/Constellation/Template/FORM/demo.stories.jsx.mustache +43 -39
- package/src/tasks/create/templates/Constellation/Template/FORM-region/demo.stories.jsx.mustache +46 -46
- package/src/tasks/create/templates/Constellation/Template/PAGE/demo.stories.jsx.mustache +24 -25
- package/src/tasks/create/templates/Constellation/Widget/CASE/demo.stories.jsx.mustache +7 -7
- package/src/tasks/create/templates/Constellation/Widget/CASE/mock.stories.js.mustache +2 -1
- package/src/tasks/create/templates/Constellation/Widget/PAGE/demo.stories.jsx.mustache +1 -1
- package/src/tasks/create/templates/Constellation/Widget/PAGE/mock.stories.js.mustache +2 -1
- package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/demo.stories.jsx.mustache +6 -6
- package/src/tasks/create/templates/SDK-React/Field/Date/index.tsx.mustache +2 -2
- package/src/tasks/create/templates/SDK-React/Field/DateTime/index.tsx.mustache +2 -2
- package/src/tasks/create/templates/SDK-React/Field/Decimal/index.tsx.mustache +2 -2
- package/src/tasks/create/templates/SDK-React/Field/Decimal-Currency/index.tsx.mustache +1 -1
- package/src/tasks/create/templates/SDK-React/Field/Decimal-Percentage/index.tsx.mustache +2 -2
- package/src/tasks/create/templates/SDK-React/Field/Integer/index.tsx.mustache +2 -2
- package/src/tasks/create/templates/SDK-React/Field/Text/index.tsx.mustache +1 -1
- package/src/tasks/create/templates/SDK-React/Field/Text-Email/index.tsx.mustache +2 -2
- package/src/tasks/create/templates/SDK-React/Field/Text-Input/index.tsx.mustache +1 -1
- package/src/tasks/create/templates/SDK-React/Field/Text-Paragraph/index.tsx.mustache +1 -1
- package/src/tasks/create/templates/SDK-React/Field/Text-Phone/index.tsx.mustache +1 -1
- package/src/tasks/create/templates/SDK-React/Field/Text-URL/index.tsx.mustache +2 -2
- package/src/tasks/create/templates/SDK-React/Field/TimeofDay/index.tsx.mustache +2 -2
- package/src/tasks/create/templates/SDK-React/Template/DETAILS/index.tsx.mustache +1 -1
- package/src/tasks/create/templates/SDK-React/Template/DETAILS-region/index.tsx.mustache +1 -1
- package/src/tasks/delete/helper.js +1 -0
- package/src/tasks/index.js +1 -0
- package/src/tasks/map/map.js +5 -4
- package/src/tasks/override/index.js +31 -21
- package/src/tasks/validator/index.js +10 -1
- package/src/util.js +18 -32
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -4,6 +4,7 @@ import chalk from 'chalk';
|
|
|
4
4
|
import {
|
|
5
5
|
authenticate,
|
|
6
6
|
buildComponent,
|
|
7
|
+
buildAllComponents,
|
|
7
8
|
createComponent,
|
|
8
9
|
deleteComponent,
|
|
9
10
|
deleteAllComponents,
|
|
@@ -22,6 +23,7 @@ const TASKS = {
|
|
|
22
23
|
CREATE: 'create',
|
|
23
24
|
OVERRIDE: 'override',
|
|
24
25
|
BUILD: 'buildComponent',
|
|
26
|
+
BUILD_ALL: 'buildAllComponents',
|
|
25
27
|
MAP_ALL: "mapAll",
|
|
26
28
|
PUBLISH: 'publish',
|
|
27
29
|
PUBLISH_All: 'publishAll',
|
|
@@ -82,6 +84,10 @@ export default async (args = []) => {
|
|
|
82
84
|
buildComponent(options);
|
|
83
85
|
break;
|
|
84
86
|
}
|
|
87
|
+
case TASKS.BUILD_ALL: {
|
|
88
|
+
buildAllComponents(options);
|
|
89
|
+
break;
|
|
90
|
+
}
|
|
85
91
|
case TASKS.LIST: {
|
|
86
92
|
listComponents(options);
|
|
87
93
|
break;
|
package/src/constants.js
CHANGED
|
@@ -8,20 +8,16 @@ export const OOTB_COMPONENTS = '../.ootb_components';
|
|
|
8
8
|
export const FIELD_PATH = '/field';
|
|
9
9
|
export const TEMPLATE_PATH = '/template';
|
|
10
10
|
export const WIDGET_PATH = '/widget';
|
|
11
|
-
export const
|
|
12
|
-
export const TEMPLATES_PATH = '/templates';
|
|
13
|
-
export const WIDGETS_PATH = '/widgets';
|
|
14
|
-
export const DSE_PATH = '/designSystemExtensions';
|
|
11
|
+
export const DSE_PATH = '/designSystemExtension';
|
|
15
12
|
export const INFRA_PATH = '/infra';
|
|
16
13
|
export const COMPONENT_PREFIX_FIELD_PATH = "field/";
|
|
17
14
|
export const COMPONENT_PREFIX_TEMPLATE_PATH = "template/";
|
|
18
15
|
export const COMPONENT_PREFIX_WIDGET_PATH = "widget/";
|
|
19
|
-
export const
|
|
20
|
-
export const COMPONENT_PREFIX_TEMPLATES_PATH = "templates/";
|
|
21
|
-
export const COMPONENT_PREFIX_WIDGETS_PATH = "widgets/";
|
|
22
|
-
export const COMPONENT_PREFIX_DSE_PATH = "designSystemExtensions/";
|
|
16
|
+
export const COMPONENT_PREFIX_DSE_PATH = "designSystemExtension/";
|
|
23
17
|
export const COMPONENT_PREFIX_INFRA_PATH = "infra/";
|
|
24
18
|
|
|
19
|
+
export const COMPONENT_DIRECTORY_PREFIX_CUSTOM = "/custom-";
|
|
20
|
+
|
|
25
21
|
export const CATEGORY_CUSTOM = "custom";
|
|
26
22
|
export const CATEGORY_OVERRIDE = "override";
|
|
27
23
|
export const CATEGORY_CONSTELLATION = "constellation";
|
|
@@ -157,20 +153,20 @@ export const COMPONENT_SCHEMA = {
|
|
|
157
153
|
},
|
|
158
154
|
overrideType: [
|
|
159
155
|
{
|
|
160
|
-
name: 'Field
|
|
161
|
-
value: '
|
|
156
|
+
name: 'Field',
|
|
157
|
+
value: 'field'
|
|
162
158
|
},
|
|
163
159
|
{
|
|
164
160
|
name: 'Template',
|
|
165
|
-
value: '
|
|
161
|
+
value: 'template'
|
|
166
162
|
},
|
|
167
163
|
{
|
|
168
164
|
name: 'Widget',
|
|
169
|
-
value: '
|
|
165
|
+
value: 'widget'
|
|
170
166
|
},
|
|
171
167
|
{
|
|
172
168
|
name: 'Design System Extension',
|
|
173
|
-
value: '
|
|
169
|
+
value: 'designSystemExtension'
|
|
174
170
|
},
|
|
175
171
|
{
|
|
176
172
|
name: 'Infrastructure',
|
|
@@ -178,7 +174,7 @@ export const COMPONENT_SCHEMA = {
|
|
|
178
174
|
}
|
|
179
175
|
],
|
|
180
176
|
overrideComponent: {
|
|
181
|
-
|
|
177
|
+
field: [
|
|
182
178
|
{
|
|
183
179
|
name: 'Auto Complete',
|
|
184
180
|
value: 'AutoComplete'
|
|
@@ -260,7 +256,7 @@ export const COMPONENT_SCHEMA = {
|
|
|
260
256
|
value: 'UserReference'
|
|
261
257
|
}
|
|
262
258
|
],
|
|
263
|
-
|
|
259
|
+
designSystemExtension: [
|
|
264
260
|
{
|
|
265
261
|
name: 'Case Summary Fields',
|
|
266
262
|
value: 'CaseSummaryFields'
|
|
@@ -336,7 +332,7 @@ export const COMPONENT_SCHEMA = {
|
|
|
336
332
|
value: 'View'
|
|
337
333
|
}
|
|
338
334
|
],
|
|
339
|
-
|
|
335
|
+
template: [
|
|
340
336
|
{
|
|
341
337
|
name: 'App Shell',
|
|
342
338
|
value: 'AppShell'
|
|
@@ -482,7 +478,7 @@ export const COMPONENT_SCHEMA = {
|
|
|
482
478
|
value: 'WideNarrow/WideNarrowPage'
|
|
483
479
|
}
|
|
484
480
|
],
|
|
485
|
-
|
|
481
|
+
widget: [
|
|
486
482
|
{
|
|
487
483
|
name: 'App Announcement',
|
|
488
484
|
value: 'AppAnnouncement'
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import https from 'https';
|
|
4
|
+
|
|
5
|
+
import fetch from 'node-fetch';
|
|
6
|
+
import AdmZip from 'adm-zip';
|
|
7
|
+
import chalk from 'chalk';
|
|
8
|
+
|
|
9
|
+
import {
|
|
10
|
+
constructCompleteUrl,
|
|
11
|
+
getComponentDirectoryPath,
|
|
12
|
+
getComponents,
|
|
13
|
+
getComponentsObj,
|
|
14
|
+
getPegaServerConfig,
|
|
15
|
+
validateRulesetVersion,
|
|
16
|
+
getOptionsCategory,
|
|
17
|
+
} from '../../util.js';
|
|
18
|
+
import { PUBLISH_COMPONENT_SERVICE_REST_ENDPOINT, TOKEN_PATH, COMPONENT_SCHEMA, CATEGORY_CUSTOM } from '../../constants.js';
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
export const getBuildCategory = async (options) => {
|
|
22
|
+
const categoryType = getOptionsCategory(options);
|
|
23
|
+
|
|
24
|
+
return [
|
|
25
|
+
{
|
|
26
|
+
name: 'category',
|
|
27
|
+
type: 'rawlist',
|
|
28
|
+
message: 'Category of components ?',
|
|
29
|
+
choices: COMPONENT_SCHEMA.category,
|
|
30
|
+
when() {
|
|
31
|
+
return !options.params[4] && categoryType == null;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
];
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export const getBuildComponentQuestions = async (category) => {
|
|
38
|
+
const components = await getComponentsObj(true, category);
|
|
39
|
+
const defaultPegaConfig = await getPegaServerConfig();
|
|
40
|
+
|
|
41
|
+
if (components.length == 0) {
|
|
42
|
+
console.log(chalk.bold.yellow(`No components to build`));
|
|
43
|
+
process.exit(1);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return [
|
|
47
|
+
{
|
|
48
|
+
name: 'devBuild',
|
|
49
|
+
message: 'Generate development build ?',
|
|
50
|
+
default: defaultPegaConfig.devBuild
|
|
51
|
+
}
|
|
52
|
+
];
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
export const zipComponent = async (componentKey, category = CATEGORY_CUSTOM) => {
|
|
58
|
+
const srcDirectory = await getComponentDirectoryPath(componentKey, category);
|
|
59
|
+
const buildDirectory = await path.join(path.resolve(), 'dist/components', componentKey);
|
|
60
|
+
const configJson = `${srcDirectory}/config.json`;
|
|
61
|
+
|
|
62
|
+
const zip = new AdmZip();
|
|
63
|
+
|
|
64
|
+
zip.addLocalFolder(srcDirectory, 'src/');
|
|
65
|
+
zip.addLocalFile(configJson);
|
|
66
|
+
zip.addLocalFolder(buildDirectory);
|
|
67
|
+
const zipContent = zip.toBuffer().toString('base64');
|
|
68
|
+
|
|
69
|
+
const configContent = Buffer.from(fs.readFileSync(`${srcDirectory}/config.json`)).toString();
|
|
70
|
+
fs.rmd('dist', { recursive: true }, err => {
|
|
71
|
+
if (err) {
|
|
72
|
+
throw err;
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
return { zipContent, configContent };
|
|
76
|
+
};
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import inquirer from 'inquirer';
|
|
2
|
+
import Listr from 'listr';
|
|
3
|
+
import chalk from 'chalk';
|
|
4
|
+
|
|
5
|
+
import validate from '../validator/index.js';
|
|
6
|
+
|
|
7
|
+
import bundleComponent from '../bundle/index.js';
|
|
8
|
+
import lintComponent from '../linter/index.js';
|
|
9
|
+
import { getBuildComponentQuestions, getBuildCategory } from './helper.js';
|
|
10
|
+
import { getComponentDirectoryPath, showVersion, getOptionsCategory, getComponentsObj } from '../../util.js';
|
|
11
|
+
|
|
12
|
+
import { CATEGORY_CUSTOM } from '../../constants.js';
|
|
13
|
+
|
|
14
|
+
export default async options => {
|
|
15
|
+
showVersion();
|
|
16
|
+
|
|
17
|
+
const catQuestion = await getBuildCategory(options);
|
|
18
|
+
const catAnwers = await inquirer.prompt(catQuestion);
|
|
19
|
+
|
|
20
|
+
let category = catAnwers.category;
|
|
21
|
+
if (category == null) {
|
|
22
|
+
category = getOptionsCategory(options);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const components = await getComponentsObj(false, category);
|
|
26
|
+
const questions = await getBuildComponentQuestions(category);
|
|
27
|
+
const answers = await inquirer.prompt(questions);
|
|
28
|
+
const { sourceMap, devBuild } = answers;
|
|
29
|
+
|
|
30
|
+
let content = {
|
|
31
|
+
...answers
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
var componentKey;
|
|
35
|
+
|
|
36
|
+
const customTasks = new Listr(
|
|
37
|
+
[
|
|
38
|
+
{
|
|
39
|
+
title: 'Validate config schema',
|
|
40
|
+
task: async () => {
|
|
41
|
+
await validate(componentKey, category);
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
title: 'Lint component',
|
|
46
|
+
task: async () => {
|
|
47
|
+
const targetDirectory = await getComponentDirectoryPath(componentKey, category);
|
|
48
|
+
// console.log(`in buildComponent Lint component task: componentKey: ${componentKey} targetDirectory: ${targetDirectory}`);
|
|
49
|
+
await lintComponent(targetDirectory);
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
title: 'Bundle component',
|
|
54
|
+
task: async () => await bundleComponent(componentKey, sourceMap, devBuild, category),
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
title: 'Lint companion component',
|
|
58
|
+
task: async () => {
|
|
59
|
+
const targetDirectory = await getComponentDirectoryPath(componentKey, "constellation");
|
|
60
|
+
// console.log(`in buildComponent Lint component task: componentKey: ${componentKey} targetDirectory: ${targetDirectory}`);
|
|
61
|
+
await lintComponent(targetDirectory);
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
title: 'Bundle companion component',
|
|
66
|
+
task: async () => await bundleComponent(componentKey, sourceMap, devBuild, "constellation")
|
|
67
|
+
}
|
|
68
|
+
],
|
|
69
|
+
{
|
|
70
|
+
exitOnError: true
|
|
71
|
+
}
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
const overrideTasks = new Listr(
|
|
75
|
+
[
|
|
76
|
+
{
|
|
77
|
+
title: 'Validate config schema',
|
|
78
|
+
task: async () => {
|
|
79
|
+
await validate(componentKey, category);
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
title: 'Lint component',
|
|
84
|
+
task: async () => {
|
|
85
|
+
const targetDirectory = await getComponentDirectoryPath(componentKey, category);
|
|
86
|
+
// console.log(`in buildComponent Lint component task: componentKey: ${componentKey} targetDirectory: ${targetDirectory}`);
|
|
87
|
+
await lintComponent(targetDirectory);
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
title: 'Bundle Component',
|
|
92
|
+
task: async () => await bundleComponent(componentKey, sourceMap, devBuild, category),
|
|
93
|
+
}
|
|
94
|
+
],
|
|
95
|
+
{
|
|
96
|
+
exitOnError: true
|
|
97
|
+
}
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
if (category === CATEGORY_CUSTOM) {
|
|
102
|
+
for (var index in components) {
|
|
103
|
+
componentKey = components[index].value;
|
|
104
|
+
console.log(chalk.bold.green("Building: " + components[index].name));
|
|
105
|
+
await customTasks.run().catch(err => {
|
|
106
|
+
console.log(chalk.bold.red(err.toString()));
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
for (var index in components) {
|
|
112
|
+
componentKey = components[index].value;
|
|
113
|
+
console.log(chalk.bold.green("Building: " + components[index].name));
|
|
114
|
+
await overrideTasks.run().catch(err => {
|
|
115
|
+
console.log(chalk.bold.red(err.toString()));
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
return true;
|
|
121
|
+
};
|
|
@@ -258,15 +258,14 @@ export const validateCompile = async (
|
|
|
258
258
|
export default async options => {
|
|
259
259
|
showVersion();
|
|
260
260
|
|
|
261
|
-
if (options.params[
|
|
262
|
-
const
|
|
263
|
-
const
|
|
264
|
-
const
|
|
265
|
-
const
|
|
266
|
-
const
|
|
267
|
-
const
|
|
268
|
-
const
|
|
269
|
-
const description = options.params[10];
|
|
261
|
+
if (options.params[9]) {
|
|
262
|
+
const type = options.params[3];
|
|
263
|
+
const subtype = options.params[4];
|
|
264
|
+
const componentName = options.params[5];
|
|
265
|
+
const componentLabel = options.params[6];
|
|
266
|
+
const library = options.params[7];
|
|
267
|
+
const version = options.params[8];
|
|
268
|
+
const description = options.params[9];
|
|
270
269
|
|
|
271
270
|
await validateCompile(
|
|
272
271
|
{
|
|
@@ -298,6 +297,50 @@ export default async options => {
|
|
|
298
297
|
|
|
299
298
|
|
|
300
299
|
const questions = [
|
|
300
|
+
{
|
|
301
|
+
name: 'type',
|
|
302
|
+
type: 'rawlist',
|
|
303
|
+
message: 'Enter type of component',
|
|
304
|
+
default: componentDefaults.type,
|
|
305
|
+
choices: COMPONENT_SCHEMA.type
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
name: 'subtype',
|
|
309
|
+
type: 'rawlist',
|
|
310
|
+
message: 'Enter subtype of component',
|
|
311
|
+
default: componentDefaults.subtype,
|
|
312
|
+
choices: COMPONENT_SCHEMA.subtype.field,
|
|
313
|
+
when(answers) {
|
|
314
|
+
return answers.type === 'Field';
|
|
315
|
+
}
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
name: 'subtype',
|
|
319
|
+
type: 'rawlist',
|
|
320
|
+
message: 'Enter subtype of component',
|
|
321
|
+
default: componentDefaults.subtype,
|
|
322
|
+
choices: COMPONENT_SCHEMA.subtype.template,
|
|
323
|
+
when(answers) {
|
|
324
|
+
return answers.type === 'Template';
|
|
325
|
+
}
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
name: 'subtype',
|
|
329
|
+
type: 'rawlist',
|
|
330
|
+
message: 'Enter subtype of component',
|
|
331
|
+
default: [componentDefaults.subtype || COMPONENT_SCHEMA.subtype.widget[0]],
|
|
332
|
+
choices: COMPONENT_SCHEMA.subtype.widget,
|
|
333
|
+
when(answers) {
|
|
334
|
+
return answers.type === 'Widget';
|
|
335
|
+
},
|
|
336
|
+
validate: value => {
|
|
337
|
+
/* value should not be empty */
|
|
338
|
+
if (Array.isArray(value) && value.length) {
|
|
339
|
+
return true;
|
|
340
|
+
}
|
|
341
|
+
return 'Please select subtype';
|
|
342
|
+
}
|
|
343
|
+
},
|
|
301
344
|
{
|
|
302
345
|
name: 'componentName',
|
|
303
346
|
message: 'Enter component name (required)',
|
|
@@ -355,57 +398,6 @@ export default async options => {
|
|
|
355
398
|
message: 'Please enter the application names to be supported (comma-separated). ',
|
|
356
399
|
suffix: 'Keep empty for all applications'
|
|
357
400
|
},
|
|
358
|
-
// {
|
|
359
|
-
// name: 'framework',
|
|
360
|
-
// type: 'rawlist',
|
|
361
|
-
// message: 'Enter framework a',
|
|
362
|
-
// default: 'COSMOS_React',
|
|
363
|
-
// choices: COMPONENT_SCHEMA.framework
|
|
364
|
-
// },
|
|
365
|
-
{
|
|
366
|
-
name: 'type',
|
|
367
|
-
type: 'rawlist',
|
|
368
|
-
message: 'Enter type of component',
|
|
369
|
-
default: componentDefaults.type,
|
|
370
|
-
choices: COMPONENT_SCHEMA.type
|
|
371
|
-
},
|
|
372
|
-
{
|
|
373
|
-
name: 'subtype',
|
|
374
|
-
type: 'rawlist',
|
|
375
|
-
message: 'Enter subtype of component',
|
|
376
|
-
default: componentDefaults.subtype,
|
|
377
|
-
choices: COMPONENT_SCHEMA.subtype.field,
|
|
378
|
-
when(answers) {
|
|
379
|
-
return answers.type === 'Field';
|
|
380
|
-
}
|
|
381
|
-
},
|
|
382
|
-
{
|
|
383
|
-
name: 'subtype',
|
|
384
|
-
type: 'rawlist',
|
|
385
|
-
message: 'Enter subtype of component',
|
|
386
|
-
default: componentDefaults.subtype,
|
|
387
|
-
choices: COMPONENT_SCHEMA.subtype.template,
|
|
388
|
-
when(answers) {
|
|
389
|
-
return answers.type === 'Template';
|
|
390
|
-
}
|
|
391
|
-
},
|
|
392
|
-
{
|
|
393
|
-
name: 'subtype',
|
|
394
|
-
type: 'rawlist',
|
|
395
|
-
message: 'Enter subtype of component',
|
|
396
|
-
default: [componentDefaults.subtype || COMPONENT_SCHEMA.subtype.widget[0]],
|
|
397
|
-
choices: COMPONENT_SCHEMA.subtype.widget,
|
|
398
|
-
when(answers) {
|
|
399
|
-
return answers.type === 'Widget';
|
|
400
|
-
},
|
|
401
|
-
validate: value => {
|
|
402
|
-
/* value should not be empty */
|
|
403
|
-
if (Array.isArray(value) && value.length) {
|
|
404
|
-
return true;
|
|
405
|
-
}
|
|
406
|
-
return 'Please select subtype';
|
|
407
|
-
}
|
|
408
|
-
},
|
|
409
401
|
{
|
|
410
402
|
name: 'description',
|
|
411
403
|
message: 'Enter description for the component',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { withKnobs
|
|
1
|
+
import { withKnobs } from '@storybook/addon-knobs';
|
|
2
2
|
import { configProps, stateProps } from './mock.stories';
|
|
3
3
|
import {{COMPONENT_CLASS_NAME}} from './index.jsx';
|
|
4
4
|
|
|
@@ -26,8 +26,13 @@ export const base{{COMPONENT_CLASS_NAME}} = () => {
|
|
|
26
26
|
return {
|
|
27
27
|
getActionsApi: () => {
|
|
28
28
|
return {
|
|
29
|
-
updateFieldValue: () => {},
|
|
30
|
-
triggerFieldChange: () => {}
|
|
29
|
+
updateFieldValue: () => {/* nothing */},
|
|
30
|
+
triggerFieldChange: () => {/* nothing */}
|
|
31
|
+
};
|
|
32
|
+
},
|
|
33
|
+
getValidationApi: () => {
|
|
34
|
+
return {
|
|
35
|
+
validate: () => {/* nothing */}
|
|
31
36
|
};
|
|
32
37
|
},
|
|
33
38
|
getStateProps: () => {
|
|
@@ -36,9 +41,9 @@ export const base{{COMPONENT_CLASS_NAME}} = () => {
|
|
|
36
41
|
getConfigProps: () => {
|
|
37
42
|
return configProps;
|
|
38
43
|
},
|
|
39
|
-
ignoreSuggestion: () => {},
|
|
40
|
-
acceptSuggestion: () => {},
|
|
41
|
-
clearErrorMessages: () => {}
|
|
44
|
+
ignoreSuggestion: () => {/* nothing */},
|
|
45
|
+
acceptSuggestion: () => {/* nothing */},
|
|
46
|
+
clearErrorMessages: () => {/* nothing */}
|
|
42
47
|
};
|
|
43
48
|
},
|
|
44
49
|
value: configProps.value,
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { withKnobs, text, boolean } from '@storybook/addon-knobs';
|
|
1
|
+
import { withKnobs } from '@storybook/addon-knobs';
|
|
3
2
|
import { configProps, stateProps } from './mock.stories';
|
|
4
3
|
import {{COMPONENT_CLASS_NAME}} from './index.jsx';
|
|
5
4
|
|
|
@@ -27,8 +26,13 @@ export const base{{COMPONENT_CLASS_NAME}} = () => {
|
|
|
27
26
|
return {
|
|
28
27
|
getActionsApi: () => {
|
|
29
28
|
return {
|
|
30
|
-
updateFieldValue: () => {},
|
|
31
|
-
triggerFieldChange: () => {}
|
|
29
|
+
updateFieldValue: () => {/* nothing */},
|
|
30
|
+
triggerFieldChange: () => {/* nothing */}
|
|
31
|
+
};
|
|
32
|
+
},
|
|
33
|
+
getValidationApi: () => {
|
|
34
|
+
return {
|
|
35
|
+
validate: () => {/* nothing */}
|
|
32
36
|
};
|
|
33
37
|
},
|
|
34
38
|
getStateProps: () => {
|
|
@@ -37,9 +41,9 @@ export const base{{COMPONENT_CLASS_NAME}} = () => {
|
|
|
37
41
|
getConfigProps: () => {
|
|
38
42
|
return configProps;
|
|
39
43
|
},
|
|
40
|
-
ignoreSuggestion: () => {},
|
|
41
|
-
acceptSuggestion: () => {},
|
|
42
|
-
clearErrorMessages: () => {}
|
|
44
|
+
ignoreSuggestion: () => {/* nothing */},
|
|
45
|
+
acceptSuggestion: () => {/* nothing */},
|
|
46
|
+
clearErrorMessages: () => {/* nothing */}
|
|
43
47
|
};
|
|
44
48
|
},
|
|
45
49
|
value: configProps.value,
|
|
@@ -20,7 +20,7 @@ export const base{{COMPONENT_CLASS_NAME}} = () => {
|
|
|
20
20
|
showGroupSeparators: configProps.showGroupSeparators,
|
|
21
21
|
hasSuggestions: configProps.hasSuggestions,
|
|
22
22
|
testId: configProps.testId,
|
|
23
|
-
fieldMetadata
|
|
23
|
+
fieldMetadata,
|
|
24
24
|
|
|
25
25
|
getPConnect: () => {
|
|
26
26
|
return {
|
|
@@ -29,14 +29,14 @@ export const base{{COMPONENT_CLASS_NAME}} = () => {
|
|
|
29
29
|
},
|
|
30
30
|
getActionsApi: () => {
|
|
31
31
|
return {
|
|
32
|
-
updateFieldValue: () => {},
|
|
33
|
-
triggerFieldChange: () => {}
|
|
32
|
+
updateFieldValue: () => {/* nothing */},
|
|
33
|
+
triggerFieldChange: () => {/* nothing */}
|
|
34
34
|
};
|
|
35
35
|
},
|
|
36
|
-
ignoreSuggestion: () => {},
|
|
37
|
-
acceptSuggestion: () => {},
|
|
38
|
-
setInheritedProps: () => {},
|
|
39
|
-
resolveConfigProps: () => {}
|
|
36
|
+
ignoreSuggestion: () => {/* nothing */},
|
|
37
|
+
acceptSuggestion: () => {/* nothing */},
|
|
38
|
+
setInheritedProps: () => {/* nothing */},
|
|
39
|
+
resolveConfigProps: () => {/* nothing */}
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
42
|
};
|
package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/demo.stories.jsx.mustache
CHANGED
|
@@ -13,7 +13,7 @@ export default {
|
|
|
13
13
|
export const base{{COMPONENT_CLASS_NAME}} = () => {
|
|
14
14
|
|
|
15
15
|
const props = {
|
|
16
|
-
value: configProps.value,
|
|
16
|
+
value: Number(configProps.value),
|
|
17
17
|
placeholder: configProps.placeholder,
|
|
18
18
|
label: configProps.label,
|
|
19
19
|
helperText: configProps.helperText,
|
|
@@ -23,7 +23,7 @@ export const base{{COMPONENT_CLASS_NAME}} = () => {
|
|
|
23
23
|
alwaysShowISOCode: configProps.alwaysShowISOCode,
|
|
24
24
|
hasSuggestions: configProps.hasSuggestions,
|
|
25
25
|
testId: configProps.testId,
|
|
26
|
-
fieldMetadata
|
|
26
|
+
fieldMetadata,
|
|
27
27
|
|
|
28
28
|
getPConnect: () => {
|
|
29
29
|
return {
|
|
@@ -32,14 +32,15 @@ export const base{{COMPONENT_CLASS_NAME}} = () => {
|
|
|
32
32
|
},
|
|
33
33
|
getActionsApi: () => {
|
|
34
34
|
return {
|
|
35
|
-
updateFieldValue: () => {},
|
|
36
|
-
triggerFieldChange: () => {}
|
|
35
|
+
updateFieldValue: () => {/* nothing */},
|
|
36
|
+
triggerFieldChange: () => {/* nothing */}
|
|
37
37
|
};
|
|
38
38
|
},
|
|
39
|
-
ignoreSuggestion: () => {},
|
|
40
|
-
acceptSuggestion: () => {},
|
|
41
|
-
setInheritedProps: () => {},
|
|
42
|
-
resolveConfigProps: () => {}
|
|
39
|
+
ignoreSuggestion: () => {/* nothing */},
|
|
40
|
+
acceptSuggestion: () => {/* nothing */},
|
|
41
|
+
setInheritedProps: () => {/* nothing */},
|
|
42
|
+
resolveConfigProps: () => {/* nothing */},
|
|
43
|
+
clearErrorMessages: () => {/* nothing */}
|
|
43
44
|
};
|
|
44
45
|
}
|
|
45
46
|
};
|
package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/demo.stories.jsx.mustache
CHANGED
|
@@ -20,7 +20,7 @@ export const base{{COMPONENT_CLASS_NAME}} = () => {
|
|
|
20
20
|
showGroupSeparators: configProps.showGroupSeparators,
|
|
21
21
|
hasSuggestions: configProps.hasSuggestions,
|
|
22
22
|
testId: configProps.testId,
|
|
23
|
-
fieldMetadata
|
|
23
|
+
fieldMetadata,
|
|
24
24
|
|
|
25
25
|
getPConnect: () => {
|
|
26
26
|
return {
|
|
@@ -29,14 +29,14 @@ export const base{{COMPONENT_CLASS_NAME}} = () => {
|
|
|
29
29
|
},
|
|
30
30
|
getActionsApi: () => {
|
|
31
31
|
return {
|
|
32
|
-
updateFieldValue: () => {},
|
|
33
|
-
triggerFieldChange: () => {}
|
|
32
|
+
updateFieldValue: () => {/* nothing */},
|
|
33
|
+
triggerFieldChange: () => {/* nothing */}
|
|
34
34
|
};
|
|
35
35
|
},
|
|
36
|
-
ignoreSuggestion: () => {},
|
|
37
|
-
acceptSuggestion: () => {},
|
|
38
|
-
setInheritedProps: () => {},
|
|
39
|
-
resolveConfigProps: () => {}
|
|
36
|
+
ignoreSuggestion: () => {/* nothing */},
|
|
37
|
+
acceptSuggestion: () => {/* nothing */},
|
|
38
|
+
setInheritedProps: () => {/* nothing */},
|
|
39
|
+
resolveConfigProps: () => {/* nothing */}
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
42
|
};
|
|
@@ -20,7 +20,7 @@ export const base{{COMPONENT_CLASS_NAME}} = () => {
|
|
|
20
20
|
showGroupSeparators: configProps.showGroupSeparators,
|
|
21
21
|
hasSuggestions: configProps.hasSuggestions,
|
|
22
22
|
testId: configProps.testId,
|
|
23
|
-
fieldMetadata
|
|
23
|
+
fieldMetadata,
|
|
24
24
|
|
|
25
25
|
getPConnect: () => {
|
|
26
26
|
return {
|
|
@@ -29,14 +29,14 @@ export const base{{COMPONENT_CLASS_NAME}} = () => {
|
|
|
29
29
|
},
|
|
30
30
|
getActionsApi: () => {
|
|
31
31
|
return {
|
|
32
|
-
updateFieldValue: () => {},
|
|
33
|
-
triggerFieldChange: () => {}
|
|
32
|
+
updateFieldValue: () => {/* nothing */},
|
|
33
|
+
triggerFieldChange: () => {/* nothing */}
|
|
34
34
|
};
|
|
35
35
|
},
|
|
36
|
-
ignoreSuggestion: () => {},
|
|
37
|
-
acceptSuggestion: () => {},
|
|
38
|
-
setInheritedProps: () => {},
|
|
39
|
-
resolveConfigProps: () => {}
|
|
36
|
+
ignoreSuggestion: () => {/* nothing */},
|
|
37
|
+
acceptSuggestion: () => {/* nothing */},
|
|
38
|
+
setInheritedProps: () => {/* nothing */},
|
|
39
|
+
resolveConfigProps: () => {/* nothing */}
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
42
|
};
|