@pega/dx-component-builder-sdk 0.1.5 → 0.1.6
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/index.js +48 -3
- package/src/tasks/create/templates/SDK-React/Field/Boolean/demo.stories.jsx.mustache +26 -14
- package/src/tasks/create/templates/SDK-React/Field/Boolean/mock.stories.js.mustache +15 -0
- package/src/tasks/create/templates/SDK-React/Field/Decimal/demo.stories.jsx.mustache +17 -10
- package/src/tasks/create/templates/SDK-React/Field/Decimal/mock.stories.js.mustache +14 -0
- package/src/tasks/create/templates/SDK-React/Field/Decimal-Currency/demo.stories.jsx.mustache +16 -10
- package/src/tasks/create/templates/SDK-React/Field/Decimal-Currency/mock.stories.js.mustache +14 -0
- package/src/tasks/create/templates/SDK-React/Field/Decimal-Percentage/demo.stories.jsx.mustache +17 -10
- package/src/tasks/create/templates/SDK-React/Field/Decimal-Percentage/mock.stories.js.mustache +14 -0
- package/src/tasks/create/templates/SDK-React/Field/Integer/demo.stories.jsx.mustache +16 -10
- package/src/tasks/create/templates/SDK-React/Field/Integer/mock.stories.js.mustache +14 -0
- package/src/tasks/create/templates/SDK-React/Field/Picklist/demo.stories.jsx.mustache +25 -16
- package/src/tasks/create/templates/SDK-React/Field/Picklist/mock.stories.js.mustache +30 -0
- package/src/tasks/create/templates/SDK-React/Field/Text-Phone/demo.stories.jsx.mustache +3 -1
- package/src/tasks/delete/helper.js +3 -0
- package/src/tasks/delete-all/helper.js +3 -0
- package/src/util.js +13 -7
package/package.json
CHANGED
|
@@ -31,9 +31,17 @@ import { COMPONENT_SCHEMA } from '../../constants.js';
|
|
|
31
31
|
const copy = promisify(ncp);
|
|
32
32
|
|
|
33
33
|
const copyComponentTemplate = async options => {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
if (options.targetDirectory) {
|
|
35
|
+
return copy(options.templateDirectory, options.targetDirectory, {
|
|
36
|
+
clobber: false
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
return copy(options.templateDirectoryConstellation, options.targetDirectoryConstellation, {
|
|
41
|
+
clobber: false
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
37
45
|
};
|
|
38
46
|
|
|
39
47
|
const compileMustacheTemplates = async (
|
|
@@ -151,17 +159,34 @@ const validateCompile = async (
|
|
|
151
159
|
const templateDir = `./templates/${framework}/${type}/${sSubType}`;
|
|
152
160
|
const templateDirectory = fileURLToPath(new URL(templateDir, import.meta.url));
|
|
153
161
|
|
|
162
|
+
const templateDirConstellation = `./templates/Constellation/${type}/${sSubType}`;
|
|
163
|
+
const templateDirectoryConstellation = fileURLToPath(new URL(templateDirConstellation, import.meta.url));
|
|
164
|
+
|
|
154
165
|
const componentKey = `${organization}_${library}_${componentName}`;
|
|
155
166
|
|
|
156
167
|
const typeLC = type.toLowerCase();
|
|
157
168
|
const targetDirectory = await getComponentDirectoryPath(join(typeLC, "/",componentKey));
|
|
169
|
+
const targetDirectoryConstellation = await getComponentDirectoryPath(join(typeLC, "/",componentKey), "constellation");
|
|
158
170
|
|
|
159
171
|
const components = await getComponents(false);
|
|
160
172
|
if (components.includes(componentKey)) {
|
|
161
173
|
console.log(chalk.red(`${componentKey} component already exists in ${targetDirectory}`));
|
|
174
|
+
|
|
175
|
+
let componentsConstellation = await getComponents(false, "constellation");
|
|
176
|
+
if (components.includes(componentKey)) {
|
|
177
|
+
console.log(chalk.red(`${componentKey} companion component already exists in ${targetDirectoryConstellation}`));
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
// test for constellation
|
|
183
|
+
const componentsConstellation = await getComponents(false, "constellation");
|
|
184
|
+
if (components.includes(componentKey)) {
|
|
185
|
+
console.log(chalk.red(`${componentKey} companion component already exists in ${targetDirectoryConstellation}`));
|
|
162
186
|
return;
|
|
163
187
|
}
|
|
164
188
|
|
|
189
|
+
// component
|
|
165
190
|
await copyComponentTemplate({
|
|
166
191
|
...options,
|
|
167
192
|
targetDirectory,
|
|
@@ -180,7 +205,27 @@ const validateCompile = async (
|
|
|
180
205
|
allowedApplications
|
|
181
206
|
});
|
|
182
207
|
|
|
208
|
+
// matching constellation
|
|
209
|
+
await copyComponentTemplate({
|
|
210
|
+
...options,
|
|
211
|
+
targetDirectoryConstellation,
|
|
212
|
+
templateDirectoryConstellation
|
|
213
|
+
});
|
|
214
|
+
await compileMustacheTemplates(targetDirectoryConstellation, {
|
|
215
|
+
componentKey,
|
|
216
|
+
componentName,
|
|
217
|
+
componentLabel,
|
|
218
|
+
library,
|
|
219
|
+
version,
|
|
220
|
+
type,
|
|
221
|
+
subtype,
|
|
222
|
+
description,
|
|
223
|
+
organization,
|
|
224
|
+
allowedApplications
|
|
225
|
+
});
|
|
226
|
+
|
|
183
227
|
console.log(chalk.green(`created ${componentKey} component in ${targetDirectory}`));
|
|
228
|
+
console.log(chalk.green(`created ${componentKey} companion component in ${targetDirectoryConstellation}`));
|
|
184
229
|
|
|
185
230
|
};
|
|
186
231
|
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
|
-
import { withKnobs
|
|
2
|
+
import { withKnobs } from '@storybook/addon-knobs';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { configProps, stateProps } from './mock.stories';
|
|
5
|
+
|
|
6
|
+
import {{COMPONENT_CLASS_NAME}} from './index.tsx';
|
|
5
7
|
|
|
6
8
|
export default {
|
|
7
9
|
title: '{{COMPONENT_CLASS_NAME}}',
|
|
@@ -10,30 +12,40 @@ export default {
|
|
|
10
12
|
};
|
|
11
13
|
|
|
12
14
|
export const Base{{COMPONENT_CLASS_NAME}} = () => {
|
|
13
|
-
const [value, setValue] = useState(
|
|
15
|
+
const [value, setValue] = useState(configProps.value);
|
|
14
16
|
|
|
15
17
|
const props = {
|
|
18
|
+
value,
|
|
19
|
+
label: configProps.label,
|
|
20
|
+
helperText: configProps.helperText,
|
|
21
|
+
caption: configProps.caption,
|
|
22
|
+
testId: configProps.testId,
|
|
23
|
+
trueLabel: configProps.trueLabel,
|
|
24
|
+
falseLabel: configProps.falseLabel,
|
|
25
|
+
|
|
16
26
|
getPConnect: () => {
|
|
17
27
|
return {
|
|
28
|
+
getStateProps: () => {
|
|
29
|
+
return stateProps;
|
|
30
|
+
},
|
|
31
|
+
getConfigProps: () => {
|
|
32
|
+
return configProps;
|
|
33
|
+
},
|
|
18
34
|
getActionsApi: () => {
|
|
19
35
|
return {
|
|
20
36
|
updateFieldValue: (propName, theValue) => {
|
|
21
37
|
setValue(theValue);
|
|
22
|
-
}
|
|
38
|
+
},
|
|
39
|
+
triggerFieldChange: () => { /* nothing */}
|
|
23
40
|
};
|
|
24
41
|
},
|
|
25
|
-
|
|
26
|
-
return {
|
|
42
|
+
getValidationApi: () => {
|
|
43
|
+
return {
|
|
44
|
+
validate: () => { /* nothing */}
|
|
45
|
+
};
|
|
27
46
|
}
|
|
28
47
|
};
|
|
29
|
-
}
|
|
30
|
-
value,
|
|
31
|
-
placeholder: text('Placeholder', 'Test placeholder'),
|
|
32
|
-
disabled: boolean('Disabled', false),
|
|
33
|
-
readOnly: boolean('Disabled', false),
|
|
34
|
-
required: boolean('Disabled', false),
|
|
35
|
-
label: text('Label', 'Sample Label'),
|
|
36
|
-
testId: text('Test id', 'text-12344566')
|
|
48
|
+
}
|
|
37
49
|
};
|
|
38
50
|
|
|
39
51
|
return (
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export const configProps = {
|
|
2
|
+
"caption": "Boolean Caption",
|
|
3
|
+
"value": false,
|
|
4
|
+
"trueLabel": "Yes",
|
|
5
|
+
"falseLabel": "No",
|
|
6
|
+
"label": "Boolean Sample",
|
|
7
|
+
"helperText": "Boolean Helper Text",
|
|
8
|
+
"testId": "boolean-12345678",
|
|
9
|
+
"hasSuggestions": false
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const stateProps = {
|
|
13
|
+
"value": ".BooleanSample",
|
|
14
|
+
"hasSuggestions": false
|
|
15
|
+
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
|
-
import { withKnobs
|
|
2
|
+
import { withKnobs } from '@storybook/addon-knobs';
|
|
3
|
+
import { configProps, fieldMetadata } from './mock.stories.js';
|
|
3
4
|
|
|
4
|
-
import {{COMPONENT_CLASS_NAME}} from './index.
|
|
5
|
+
import {{COMPONENT_CLASS_NAME}} from './index.tsx';
|
|
5
6
|
|
|
6
7
|
export default {
|
|
7
8
|
title: '{{COMPONENT_CLASS_NAME}}',
|
|
@@ -10,9 +11,15 @@ export default {
|
|
|
10
11
|
};
|
|
11
12
|
|
|
12
13
|
export const Base{{COMPONENT_CLASS_NAME}} = () => {
|
|
13
|
-
const [value, setValue] = useState(
|
|
14
|
+
const [value, setValue] = useState(configProps.value);
|
|
14
15
|
|
|
15
16
|
const props = {
|
|
17
|
+
value,
|
|
18
|
+
placeholder: configProps.placeholder,
|
|
19
|
+
label: configProps.label,
|
|
20
|
+
helperText: configProps.helperText,
|
|
21
|
+
testId: configProps.testId,
|
|
22
|
+
fieldMetadata,
|
|
16
23
|
getPConnect: () => {
|
|
17
24
|
return {
|
|
18
25
|
getActionsApi: () => {
|
|
@@ -27,13 +34,12 @@ export const Base{{COMPONENT_CLASS_NAME}} = () => {
|
|
|
27
34
|
}
|
|
28
35
|
};
|
|
29
36
|
},
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
testId: text('Test id', 'text-12344566')
|
|
37
|
+
onChange: event => {
|
|
38
|
+
setValue(event.target.value);
|
|
39
|
+
},
|
|
40
|
+
onBlur: () => {
|
|
41
|
+
return configProps.value;
|
|
42
|
+
}
|
|
37
43
|
};
|
|
38
44
|
|
|
39
45
|
return (
|
|
@@ -42,3 +48,4 @@ export const Base{{COMPONENT_CLASS_NAME}} = () => {
|
|
|
42
48
|
</>
|
|
43
49
|
);
|
|
44
50
|
};
|
|
51
|
+
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const configProps = {
|
|
2
|
+
value: '',
|
|
3
|
+
label: 'Decimal Sample',
|
|
4
|
+
placeholder: 'Decimal Placeholder',
|
|
5
|
+
helperText: 'Decimal Helper Text',
|
|
6
|
+
testId: 'decimal-12345678'
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export const fieldMetadata = {
|
|
10
|
+
classID: 'DIXL-MediaCo-Work-NewService',
|
|
11
|
+
type: 'Decimal',
|
|
12
|
+
displayAs: 'pxNumber',
|
|
13
|
+
label: 'Decimal sample'
|
|
14
|
+
};
|
package/src/tasks/create/templates/SDK-React/Field/Decimal-Currency/demo.stories.jsx.mustache
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
|
-
import { withKnobs
|
|
2
|
+
import { withKnobs } from '@storybook/addon-knobs';
|
|
3
|
+
import { configProps, fieldMetadata } from './mock.stories.js';
|
|
3
4
|
|
|
4
|
-
import {{COMPONENT_CLASS_NAME}} from './index.
|
|
5
|
+
import {{COMPONENT_CLASS_NAME}} from './index.tsx';
|
|
5
6
|
|
|
6
7
|
export default {
|
|
7
8
|
title: '{{COMPONENT_CLASS_NAME}}',
|
|
@@ -10,9 +11,15 @@ export default {
|
|
|
10
11
|
};
|
|
11
12
|
|
|
12
13
|
export const Base{{COMPONENT_CLASS_NAME}} = () => {
|
|
13
|
-
const [value, setValue] = useState(
|
|
14
|
+
const [value, setValue] = useState(configProps.value);
|
|
14
15
|
|
|
15
16
|
const props = {
|
|
17
|
+
value,
|
|
18
|
+
placeholder: configProps.placeholder,
|
|
19
|
+
label: configProps.label,
|
|
20
|
+
helperText: configProps.helperText,
|
|
21
|
+
testId: configProps.testId,
|
|
22
|
+
fieldMetadata,
|
|
16
23
|
getPConnect: () => {
|
|
17
24
|
return {
|
|
18
25
|
getActionsApi: () => {
|
|
@@ -27,13 +34,12 @@ export const Base{{COMPONENT_CLASS_NAME}} = () => {
|
|
|
27
34
|
}
|
|
28
35
|
};
|
|
29
36
|
},
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
testId: text('Test id', 'text-12344566')
|
|
37
|
+
onChange: event => {
|
|
38
|
+
setValue(event.target.value);
|
|
39
|
+
},
|
|
40
|
+
onBlur: () => {
|
|
41
|
+
return configProps.value;
|
|
42
|
+
}
|
|
37
43
|
};
|
|
38
44
|
|
|
39
45
|
return (
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const configProps = {
|
|
2
|
+
value: '',
|
|
3
|
+
label: 'Currency Sample',
|
|
4
|
+
placeholder: 'Currency Placeholder',
|
|
5
|
+
helperText: 'Currency Helper Text',
|
|
6
|
+
testId: 'currency-12345678'
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export const fieldMetadata = {
|
|
10
|
+
classID: 'DIXL-MediaCo-Work-NewService',
|
|
11
|
+
type: 'Decimal',
|
|
12
|
+
displayAs: 'pxCurrency',
|
|
13
|
+
label: 'Currency sample'
|
|
14
|
+
};
|
package/src/tasks/create/templates/SDK-React/Field/Decimal-Percentage/demo.stories.jsx.mustache
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
|
-
import { withKnobs
|
|
2
|
+
import { withKnobs } from '@storybook/addon-knobs';
|
|
3
|
+
import { configProps, fieldMetadata } from './mock.stories.js';
|
|
3
4
|
|
|
4
|
-
import {{COMPONENT_CLASS_NAME}} from './index.
|
|
5
|
+
import {{COMPONENT_CLASS_NAME}} from './index.tsx';
|
|
5
6
|
|
|
6
7
|
export default {
|
|
7
8
|
title: '{{COMPONENT_CLASS_NAME}}',
|
|
@@ -10,9 +11,16 @@ export default {
|
|
|
10
11
|
};
|
|
11
12
|
|
|
12
13
|
export const Base{{COMPONENT_CLASS_NAME}} = () => {
|
|
13
|
-
const [value, setValue] = useState(
|
|
14
|
+
const [value, setValue] = useState(configProps.value);
|
|
14
15
|
|
|
15
16
|
const props = {
|
|
17
|
+
value,
|
|
18
|
+
placeholder: configProps.placeholder,
|
|
19
|
+
label: configProps.label,
|
|
20
|
+
helperText: configProps.helperText,
|
|
21
|
+
hasSuggestions: configProps.hasSuggestions,
|
|
22
|
+
testId: configProps.testId,
|
|
23
|
+
fieldMetadata,
|
|
16
24
|
getPConnect: () => {
|
|
17
25
|
return {
|
|
18
26
|
getActionsApi: () => {
|
|
@@ -27,13 +35,12 @@ export const Base{{COMPONENT_CLASS_NAME}} = () => {
|
|
|
27
35
|
}
|
|
28
36
|
};
|
|
29
37
|
},
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
testId: text('Test id', 'text-12344566')
|
|
38
|
+
onChange: event => {
|
|
39
|
+
setValue(event.target.value);
|
|
40
|
+
},
|
|
41
|
+
onBlur: () => {
|
|
42
|
+
return configProps.value;
|
|
43
|
+
}
|
|
37
44
|
};
|
|
38
45
|
|
|
39
46
|
return (
|
package/src/tasks/create/templates/SDK-React/Field/Decimal-Percentage/mock.stories.js.mustache
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const configProps = {
|
|
2
|
+
value: '',
|
|
3
|
+
label: 'Percentage Sample',
|
|
4
|
+
placeholder: 'Percentage Placeholder',
|
|
5
|
+
helperText: 'Percentage Helper Text',
|
|
6
|
+
testId: 'percentage-12345678'
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export const fieldMetadata = {
|
|
10
|
+
classID: 'DIXL-MediaCo-Work-NewService',
|
|
11
|
+
type: 'Decimal',
|
|
12
|
+
displayAs: 'pxPercentage',
|
|
13
|
+
label: 'Percentage sample'
|
|
14
|
+
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
|
-
import { withKnobs
|
|
2
|
+
import { withKnobs } from '@storybook/addon-knobs';
|
|
3
|
+
import { configProps, fieldMetadata } from './mock.stories.js';
|
|
3
4
|
|
|
4
|
-
import {{COMPONENT_CLASS_NAME}} from './index.
|
|
5
|
+
import {{COMPONENT_CLASS_NAME}} from './index.tsx';
|
|
5
6
|
|
|
6
7
|
export default {
|
|
7
8
|
title: '{{COMPONENT_CLASS_NAME}}',
|
|
@@ -10,9 +11,15 @@ export default {
|
|
|
10
11
|
};
|
|
11
12
|
|
|
12
13
|
export const Base{{COMPONENT_CLASS_NAME}} = () => {
|
|
13
|
-
const [value, setValue] = useState(
|
|
14
|
+
const [value, setValue] = useState(configProps.value);
|
|
14
15
|
|
|
15
16
|
const props = {
|
|
17
|
+
value,
|
|
18
|
+
placeholder: configProps.placeholder,
|
|
19
|
+
label: configProps.label,
|
|
20
|
+
helperText: configProps.helperText,
|
|
21
|
+
testId: configProps.testId,
|
|
22
|
+
fieldMetadata,
|
|
16
23
|
getPConnect: () => {
|
|
17
24
|
return {
|
|
18
25
|
getActionsApi: () => {
|
|
@@ -27,13 +34,12 @@ export const Base{{COMPONENT_CLASS_NAME}} = () => {
|
|
|
27
34
|
}
|
|
28
35
|
};
|
|
29
36
|
},
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
testId: text('Test id', 'text-12344566')
|
|
37
|
+
onChange: event => {
|
|
38
|
+
setValue(event.target.value);
|
|
39
|
+
},
|
|
40
|
+
onBlur: () => {
|
|
41
|
+
return configProps.value;
|
|
42
|
+
}
|
|
37
43
|
};
|
|
38
44
|
|
|
39
45
|
return (
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const configProps = {
|
|
2
|
+
value: '',
|
|
3
|
+
label: 'Integer Sample',
|
|
4
|
+
placeholder: 'Integer Placeholder',
|
|
5
|
+
helperText: 'Integer Helper Text',
|
|
6
|
+
testId: 'integer-12345678'
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export const fieldMetadata = {
|
|
10
|
+
classID: 'DIXL-MediaCo-Work-NewService',
|
|
11
|
+
type: 'Integer',
|
|
12
|
+
displayAs: 'pxInteger',
|
|
13
|
+
label: 'Integer sample'
|
|
14
|
+
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
|
-
import { withKnobs
|
|
2
|
+
import { withKnobs } from '@storybook/addon-knobs';
|
|
3
|
+
import { configProps, stateProps } from './mock.stories';
|
|
3
4
|
|
|
4
|
-
import {{COMPONENT_CLASS_NAME}} from './index.
|
|
5
|
+
import {{COMPONENT_CLASS_NAME}} from './index.tsx';
|
|
5
6
|
|
|
6
7
|
export default {
|
|
7
8
|
title: '{{COMPONENT_CLASS_NAME}}',
|
|
@@ -10,30 +11,37 @@ export default {
|
|
|
10
11
|
};
|
|
11
12
|
|
|
12
13
|
export const Base{{COMPONENT_CLASS_NAME}} = () => {
|
|
13
|
-
const [value, setValue] = useState(
|
|
14
|
+
const [value, setValue] = useState(configProps.value);
|
|
14
15
|
|
|
15
16
|
const props = {
|
|
17
|
+
value,
|
|
18
|
+
placeholder: configProps.placeholder,
|
|
19
|
+
label: configProps.label,
|
|
20
|
+
helperText: configProps.helperText,
|
|
21
|
+
datasource: configProps.datasource,
|
|
22
|
+
testId: configProps.testId,
|
|
23
|
+
hasSuggestions: configProps.hasSuggestions,
|
|
24
|
+
listType: configProps.listType,
|
|
16
25
|
getPConnect: () => {
|
|
17
26
|
return {
|
|
27
|
+
getDataObject: () => {
|
|
28
|
+
return undefined;
|
|
29
|
+
},
|
|
30
|
+
getStateProps: () => {
|
|
31
|
+
return stateProps;
|
|
32
|
+
},
|
|
18
33
|
getActionsApi: () => {
|
|
19
34
|
return {
|
|
20
|
-
updateFieldValue: (propName,
|
|
21
|
-
setValue(
|
|
35
|
+
updateFieldValue: (propName, val) => {
|
|
36
|
+
setValue(val);
|
|
37
|
+
},
|
|
38
|
+
triggerFieldChange: () => {
|
|
39
|
+
return undefined;
|
|
22
40
|
}
|
|
23
41
|
};
|
|
24
|
-
},
|
|
25
|
-
getStateProps: () => {
|
|
26
|
-
return { value: '.name' };
|
|
27
42
|
}
|
|
28
43
|
};
|
|
29
|
-
}
|
|
30
|
-
value,
|
|
31
|
-
placeholder: text('Placeholder', 'Test placeholder'),
|
|
32
|
-
disabled: boolean('Disabled', false),
|
|
33
|
-
readOnly: boolean('Disabled', false),
|
|
34
|
-
required: boolean('Disabled', false),
|
|
35
|
-
label: text('Label', 'Sample Label'),
|
|
36
|
-
testId: text('Test id', 'text-12344566')
|
|
44
|
+
}
|
|
37
45
|
};
|
|
38
46
|
|
|
39
47
|
return (
|
|
@@ -42,3 +50,4 @@ export const Base{{COMPONENT_CLASS_NAME}} = () => {
|
|
|
42
50
|
</>
|
|
43
51
|
);
|
|
44
52
|
};
|
|
53
|
+
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export const configProps = {
|
|
2
|
+
value: '',
|
|
3
|
+
label: 'Picklist Sample',
|
|
4
|
+
placeholder: 'Select...',
|
|
5
|
+
listType: 'associated',
|
|
6
|
+
datasource: [
|
|
7
|
+
{
|
|
8
|
+
key: 'Option 1',
|
|
9
|
+
value: 'Option 1'
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
key: 'Option 2',
|
|
13
|
+
value: 'Option 2'
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
key: 'Option 3',
|
|
17
|
+
value: 'Option 3'
|
|
18
|
+
}
|
|
19
|
+
],
|
|
20
|
+
helperText: 'Picklist Helper Text',
|
|
21
|
+
testId: 'picklist-12345678',
|
|
22
|
+
hasSuggestions: false
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export const stateProps = {
|
|
26
|
+
value: '.PicklistSample',
|
|
27
|
+
placeholder: 'Select...',
|
|
28
|
+
datasource: '.PicklistSample',
|
|
29
|
+
hasSuggestions: false
|
|
30
|
+
};
|
|
@@ -89,6 +89,9 @@ export const deleteLocalComponents = async (sourceOfComponents, category = "cust
|
|
|
89
89
|
]);
|
|
90
90
|
if (answers.confirmDeletion) {
|
|
91
91
|
await deleteLocalComponent(answers.componentKey, category);
|
|
92
|
+
if (category === "custom") {
|
|
93
|
+
await deleteLocalComponent(answers.componentKey, "constellation");
|
|
94
|
+
}
|
|
92
95
|
|
|
93
96
|
if (category === "override") {
|
|
94
97
|
// need to remove the map as well
|
|
@@ -99,6 +99,9 @@ export const deleteLocalComponents = async (sourceOfComponents, category = "cust
|
|
|
99
99
|
if (localComponents[index].type == undefined) {
|
|
100
100
|
var componentToDelete = localComponents[index].value;
|
|
101
101
|
await deleteLocalComponent(componentToDelete, category);
|
|
102
|
+
if (category === "custom") {
|
|
103
|
+
await deleteLocalComponent(componentToDelete, "constellation");
|
|
104
|
+
}
|
|
102
105
|
|
|
103
106
|
if (category === "override") {
|
|
104
107
|
// need to remove the map as well
|
package/src/util.js
CHANGED
|
@@ -73,16 +73,22 @@ export const deleteLocalComponent = async (componentKey, category = "custom") =>
|
|
|
73
73
|
|
|
74
74
|
const directory = join(currentDirectory, data[COMPONENTS_DIRECTORY_PATH], categoryDirectory, componentKey);
|
|
75
75
|
|
|
76
|
-
//
|
|
77
|
-
fs.
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
76
|
+
// test for the directory
|
|
77
|
+
if (fs.existsSync(directory)) {
|
|
78
|
+
//fs.rmdir(directory, { recursive: true }, err => {
|
|
79
|
+
fs.rm(directory, { recursive: true }, err => {
|
|
80
|
+
if (err) {
|
|
81
|
+
throw err;
|
|
82
|
+
}
|
|
81
83
|
|
|
82
|
-
|
|
84
|
+
console.log(`${chalk.red.bold(componentKey)} is deleted from Local ${category} `);
|
|
83
85
|
|
|
84
86
|
|
|
85
|
-
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
console.log(`${chalk.red.bold(componentKey)} is NOT FOUND from Local ${category} `);
|
|
91
|
+
}
|
|
86
92
|
};
|
|
87
93
|
|
|
88
94
|
export const deleteServerComponent = async componentKey => {
|