@pega/custom-dx-components 0.23.49 → 0.24.2
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/README.md +1 -1
- package/package.json +1 -1
- package/src/cli.js +8 -2
- package/src/constants.js +5 -0
- package/src/tasks/build-jest-assets/index.js +171 -0
- package/src/tasks/create/templates/Constellation/Field/Boolean/demo.stories.tsx.mustache +3 -13
- package/src/tasks/create/templates/Constellation/Field/Boolean/index.tsx.mustache +8 -5
- package/src/tasks/create/templates/Constellation/Field/Date/demo.stories.tsx.mustache +8 -19
- package/src/tasks/create/templates/Constellation/Field/Date/index.tsx.mustache +1 -1
- package/src/tasks/create/templates/Constellation/Field/DateTime/demo.stories.tsx.mustache +7 -18
- package/src/tasks/create/templates/Constellation/Field/DateTime/index.tsx.mustache +1 -1
- package/src/tasks/create/templates/Constellation/Field/DateTime/mock.ts.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal/demo.stories.tsx.mustache +1 -7
- package/src/tasks/create/templates/Constellation/Field/Decimal/index.tsx.mustache +1 -1
- package/src/tasks/create/templates/Constellation/Field/Decimal/mock.ts.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/demo.stories.tsx.mustache +2 -9
- package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/index.tsx.mustache +1 -1
- package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/mock.ts.mustache +2 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/demo.stories.tsx.mustache +2 -6
- package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/index.tsx.mustache +1 -1
- package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/mock.ts.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Field/Integer/demo.stories.tsx.mustache +2 -6
- package/src/tasks/create/templates/Constellation/Field/Integer/index.tsx.mustache +1 -1
- package/src/tasks/create/templates/Constellation/Field/Picklist/demo.stories.tsx.mustache +2 -6
- package/src/tasks/create/templates/Constellation/Field/Picklist/index.tsx.mustache +1 -1
- package/src/tasks/create/templates/Constellation/Field/Picklist/mock.ts.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Field/Picklist-Autocomplete/demo.stories.tsx.mustache +2 -8
- package/src/tasks/create/templates/Constellation/Field/Picklist-RadioButtons/demo.stories.tsx.mustache +1 -7
- package/src/tasks/create/templates/Constellation/Field/Text/demo.stories.tsx.mustache +0 -3
- package/src/tasks/create/templates/Constellation/Field/Text-Email/demo.stories.tsx.mustache +1 -5
- package/src/tasks/create/templates/Constellation/Field/Text-Email/index.tsx.mustache +1 -1
- package/src/tasks/create/templates/Constellation/Field/Text-Input/StatusWork.tsx +3 -9
- package/src/tasks/create/templates/Constellation/Field/Text-Input/demo.stories.tsx.mustache +1 -5
- package/src/tasks/create/templates/Constellation/Field/Text-Input/index.tsx.mustache +1 -1
- package/src/tasks/create/templates/Constellation/Field/Text-Input/mock.ts.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/demo.stories.tsx.mustache +1 -5
- package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/index.tsx.mustache +1 -1
- package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/mock.ts.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Phone/demo.stories.tsx.mustache +2 -5
- package/src/tasks/create/templates/Constellation/Field/Text-Phone/index.tsx.mustache +1 -1
- package/src/tasks/create/templates/Constellation/Field/Text-Phone/mock.ts.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Field/Text-URL/demo.stories.tsx.mustache +1 -5
- package/src/tasks/create/templates/Constellation/Field/Text-URL/mock.ts.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Field/TimeofDay/demo.stories.tsx.mustache +5 -15
- package/src/tasks/create/templates/Constellation/Field/TimeofDay/index.tsx.mustache +1 -1
- package/src/tasks/create/templates/Constellation/Template/DETAILS/StatusWork.tsx.mustache +17 -19
- package/src/tasks/create/templates/Constellation/Template/DETAILS/demo.stories.tsx.mustache +5 -5
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/StatusWork.tsx.mustache +17 -19
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/demo.stories.tsx.mustache +5 -5
- package/src/tasks/create/templates/Constellation/Template/FORM/demo.stories.tsx.mustache +5 -3
- package/src/tasks/create/templates/Constellation/Template/FORM-region/demo.stories.tsx.mustache +4 -2
- package/src/tasks/create/templates/Constellation/Template/PAGE/demo.stories.tsx.mustache +4 -3
- package/src/tasks/create/templates/Constellation/Widget/CASE/demo.stories.tsx.mustache +3 -2
- package/src/tasks/create/templates/Constellation/Widget/PAGE/demo.stories.tsx.mustache +5 -8
- package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/demo.stories.tsx.mustache +5 -4
- package/src/tasks/index.js +1 -0
- package/src/tasks/init/template/.storybook/preview.js +3 -0
- package/src/tasks/init/template/package.json.mustache +7 -6
- package/src/util.js +18 -0
- package/tests/assets/components/create/_components.md +1 -0
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyBoolean/index.tsx +1 -1
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyCurrency/index.tsx +1 -1
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDate/index.tsx +1 -1
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDateTime/index.tsx +1 -1
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDecimal/index.tsx +1 -1
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDetails/StatusWork.tsx +17 -19
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyEmail/index.tsx +1 -1
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyInteger/index.tsx +1 -1
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyParagraph/index.tsx +1 -1
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPercentage/index.tsx +1 -1
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPhone/index.tsx +1 -1
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPicklist/index.tsx +1 -1
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTextInput/StatusWork.tsx +3 -9
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTextInput/index.tsx +1 -1
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTimeOfDay/index.tsx +1 -1
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTwoColumnDetails/StatusWork.tsx +17 -19
- package/tests/assets/components/createAll/Constellation/_components.md +1 -0
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyBoolean/index.tsx +1 -1
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyCurrency/index.tsx +1 -1
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDate/index.tsx +1 -1
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDateTime/index.tsx +1 -1
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDecimal/index.tsx +1 -1
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDetails/StatusWork.tsx +17 -19
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyEmail/index.tsx +1 -1
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyInteger/index.tsx +1 -1
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyParagraph/index.tsx +1 -1
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPercentage/index.tsx +1 -1
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPhone/index.tsx +1 -1
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPicklist/index.tsx +1 -1
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTextInput/StatusWork.tsx +3 -9
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTextInput/index.tsx +1 -1
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTimeOfDay/index.tsx +1 -1
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnDetails/StatusWork.tsx +17 -19
- package/tests/assets/components/createAll/Launchpad/_components.md +1 -0
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ This project provides you with an environment to extend Constellation by giving
|
|
|
8
8
|
|
|
9
9
|
Ensure you have access to the following in your system:
|
|
10
10
|
|
|
11
|
-
- Pega Infinity Server version
|
|
11
|
+
- Pega Infinity Server version 24 or later
|
|
12
12
|
|
|
13
13
|
- Git version 2.30 or later
|
|
14
14
|
|
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -18,7 +18,8 @@ import {
|
|
|
18
18
|
promoteWebPack,
|
|
19
19
|
updateComponent,
|
|
20
20
|
validate,
|
|
21
|
-
upgrade
|
|
21
|
+
upgrade,
|
|
22
|
+
buildJestAssets
|
|
22
23
|
} from './tasks/index.js';
|
|
23
24
|
|
|
24
25
|
const TASKS = {
|
|
@@ -38,7 +39,8 @@ const TASKS = {
|
|
|
38
39
|
DELETE: 'delete',
|
|
39
40
|
DELETE_ALL: "deleteAll",
|
|
40
41
|
AUTHENTICATE: 'authenticate',
|
|
41
|
-
UPGRADE: 'upgrade'
|
|
42
|
+
UPGRADE: 'upgrade',
|
|
43
|
+
BUILD_JEST_ASSETS: 'buildJestAssets'
|
|
42
44
|
};
|
|
43
45
|
|
|
44
46
|
const parseArgumentsIntoOptions = rawArgs => {
|
|
@@ -132,6 +134,10 @@ export default async (args = []) => {
|
|
|
132
134
|
upgrade(options);
|
|
133
135
|
break;
|
|
134
136
|
}
|
|
137
|
+
case TASKS.BUILD_JEST_ASSETS: {
|
|
138
|
+
buildJestAssets(options);
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
135
141
|
default: {
|
|
136
142
|
console.log(chalk.red(`No task matched with ${task}`));
|
|
137
143
|
break;
|
package/src/constants.js
CHANGED
|
@@ -39,6 +39,11 @@ export const BUILDER_DIR_FILE_PATH = '../bundle/builder';
|
|
|
39
39
|
|
|
40
40
|
export const CATEGORY_CONSTELLATION = 'constellation';
|
|
41
41
|
|
|
42
|
+
export const JEST_ASSETS_PATH = 'node_modules/@pega/custom-dx-components/tests/assets/components/';
|
|
43
|
+
export const JEST_CREATE_PATH = 'create/';
|
|
44
|
+
export const JEST_CREATE_ALL_CONSTELLATION_PATH = 'createAll/Constellation/';
|
|
45
|
+
export const JEST_CREATE_ALL_LAUNCHPAD_PATH = 'createAll/Launchpad';
|
|
46
|
+
|
|
42
47
|
export const AUTHENTICATE_DEFAULTS = {
|
|
43
48
|
serverType: 'infinity',
|
|
44
49
|
server: 'https://localhost:1080/prweb',
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { join } from 'path';
|
|
4
|
+
import inquirer from 'inquirer';
|
|
5
|
+
import { Listr } from 'listr2';
|
|
6
|
+
import chalk from 'chalk';
|
|
7
|
+
|
|
8
|
+
import { showVersion, getServerType, setServerType, getSubComponents, deleteLocalComponent, checkPathAccess, getComponents } from '../../util.js';
|
|
9
|
+
import createAll from '../create-all/index.js';
|
|
10
|
+
import create from '../create/index.js';
|
|
11
|
+
|
|
12
|
+
import { JEST_ASSETS_PATH, JEST_CREATE_PATH, JEST_CREATE_ALL_CONSTELLATION_PATH, JEST_CREATE_ALL_LAUNCHPAD_PATH, TASKS_CONFIG_JSON_FILENAME, COMPONENTS_DIRECTORY_PATH } from '../../constants.js';
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
const getBuildAssetsQuestions = async () => {
|
|
16
|
+
const message = "\n**IMPORTANT** Building Jest Assets will remove any local components in your components directory!\n";
|
|
17
|
+
console.log(`${chalk.green.bold(message)}`);
|
|
18
|
+
|
|
19
|
+
return [
|
|
20
|
+
{
|
|
21
|
+
name: 'buildAssets',
|
|
22
|
+
type: 'confirm',
|
|
23
|
+
message: 'Generate Jest Assets ?',
|
|
24
|
+
default: false
|
|
25
|
+
}
|
|
26
|
+
];
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const deleteTestComponent = async(path, componentKey) => {
|
|
30
|
+
const directory = join(path, componentKey);
|
|
31
|
+
|
|
32
|
+
try {
|
|
33
|
+
fs.rmSync(directory, { recursive: true });
|
|
34
|
+
console.log(`${chalk.red.bold(componentKey)} is deleted from assets`);
|
|
35
|
+
} catch (err) {
|
|
36
|
+
console.log('no file');
|
|
37
|
+
throw new Error(`No such file ${componentKey}`);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const copyAssets = async(destinationPath) => {
|
|
42
|
+
const currentDirectory = process.cwd();
|
|
43
|
+
const pegaConfigJsonPath = join(currentDirectory, TASKS_CONFIG_JSON_FILENAME);
|
|
44
|
+
|
|
45
|
+
await checkPathAccess(pegaConfigJsonPath);
|
|
46
|
+
|
|
47
|
+
let data = fs.readFileSync(pegaConfigJsonPath, { encoding: 'utf8' });
|
|
48
|
+
data = JSON.parse(data);
|
|
49
|
+
|
|
50
|
+
if (!data[COMPONENTS_DIRECTORY_PATH]) {
|
|
51
|
+
console.error(
|
|
52
|
+
`${chalk.red.bold('ERROR')} Could not able find components directory path in config.json`
|
|
53
|
+
);
|
|
54
|
+
process.exit(1);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const srcDir = join(currentDirectory, data[COMPONENTS_DIRECTORY_PATH]);
|
|
58
|
+
|
|
59
|
+
fs.cpSync(srcDir, destinationPath, { recursive: true});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const deleteAssets = async() => {
|
|
63
|
+
const currentDirectory = process.cwd();
|
|
64
|
+
const pegaConfigJsonPath = join(currentDirectory, TASKS_CONFIG_JSON_FILENAME);
|
|
65
|
+
|
|
66
|
+
await checkPathAccess(pegaConfigJsonPath);
|
|
67
|
+
|
|
68
|
+
let data = fs.readFileSync(pegaConfigJsonPath, { encoding: 'utf8' });
|
|
69
|
+
data = JSON.parse(data);
|
|
70
|
+
|
|
71
|
+
if (!data[COMPONENTS_DIRECTORY_PATH]) {
|
|
72
|
+
console.error(
|
|
73
|
+
`${chalk.red.bold('ERROR')} Could not able find components directory path in config.json`
|
|
74
|
+
);
|
|
75
|
+
process.exit(1);
|
|
76
|
+
}
|
|
77
|
+
const localComponents = await getComponents();
|
|
78
|
+
|
|
79
|
+
for (const index in localComponents) {
|
|
80
|
+
const componentToDelete = localComponents[index];
|
|
81
|
+
// console.log(chalk.bold.green("Deleting: " + componentToDelete));
|
|
82
|
+
// eslint-disable-next-line no-await-in-loop
|
|
83
|
+
const directory = join(currentDirectory, data[COMPONENTS_DIRECTORY_PATH], componentToDelete);
|
|
84
|
+
|
|
85
|
+
try {
|
|
86
|
+
fs.rmSync(directory, { recursive: true });
|
|
87
|
+
console.log(`${chalk.red.bold(componentToDelete)} is deleted from Local`);
|
|
88
|
+
} catch (err) {
|
|
89
|
+
console.log('no file');
|
|
90
|
+
throw new Error(`No such file ${componentToDelete}`);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const createJestAssets = async(isLaunchPad = false) => {
|
|
96
|
+
|
|
97
|
+
// initially delete local assets
|
|
98
|
+
await deleteAssets();
|
|
99
|
+
|
|
100
|
+
// const framework = await getFramework();
|
|
101
|
+
let args = [ '','', '', 'My', '0.0.1', 'DXIL', '', 'Pega'];
|
|
102
|
+
let myOptions = {};
|
|
103
|
+
myOptions["params"] = args;
|
|
104
|
+
|
|
105
|
+
await createAll(myOptions);
|
|
106
|
+
|
|
107
|
+
const jestCreateAllPath = isLaunchPad ? JEST_CREATE_ALL_LAUNCHPAD_PATH : JEST_CREATE_ALL_CONSTELLATION_PATH;
|
|
108
|
+
|
|
109
|
+
// goto Constellation
|
|
110
|
+
// get current test assets and delete them
|
|
111
|
+
let createAllPath = path.join(path.resolve(), JEST_ASSETS_PATH, jestCreateAllPath);
|
|
112
|
+
const fileList = await getSubComponents(createAllPath, '');
|
|
113
|
+
|
|
114
|
+
for (const index in fileList) {
|
|
115
|
+
const componentToDelete = fileList[index];
|
|
116
|
+
// console.log(chalk.bold.green("Deleting: " + componentToDelete));
|
|
117
|
+
// eslint-disable-next-line no-await-in-loop
|
|
118
|
+
await deleteTestComponent(createAllPath, componentToDelete);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
await copyAssets(createAllPath);
|
|
122
|
+
await deleteAssets();
|
|
123
|
+
|
|
124
|
+
args = [ '','', '', 'Field', 'Text', 'MyTestText', 'My Test Text', '0.0.1','DXIL', '', 'My Test Text Description', 'Pega'];
|
|
125
|
+
myOptions = {};
|
|
126
|
+
myOptions["params"] = args;
|
|
127
|
+
|
|
128
|
+
await create(myOptions);
|
|
129
|
+
|
|
130
|
+
let createPath = path.join(path.resolve(), JEST_ASSETS_PATH, JEST_CREATE_PATH);
|
|
131
|
+
const myFileList = await getSubComponents(createPath, '');
|
|
132
|
+
|
|
133
|
+
for (const index in myFileList) {
|
|
134
|
+
const componentToDelete = myFileList[index];
|
|
135
|
+
// console.log(chalk.bold.green("Deleting: " + componentToDelete));
|
|
136
|
+
// eslint-disable-next-line no-await-in-loop
|
|
137
|
+
await deleteTestComponent(createPath, componentToDelete);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
await copyAssets(createPath);
|
|
141
|
+
await deleteAssets();
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
export default async options => {
|
|
146
|
+
showVersion();
|
|
147
|
+
|
|
148
|
+
const questions = await getBuildAssetsQuestions();
|
|
149
|
+
const answers = await inquirer.prompt(questions);
|
|
150
|
+
const { buildAssets } = answers;
|
|
151
|
+
|
|
152
|
+
if (buildAssets) {
|
|
153
|
+
// get current server type
|
|
154
|
+
const savedServerType = await getServerType();
|
|
155
|
+
|
|
156
|
+
// Constellation
|
|
157
|
+
await setServerType("infinity");
|
|
158
|
+
await createJestAssets(false);
|
|
159
|
+
|
|
160
|
+
//Launchpad
|
|
161
|
+
await setServerType("launchpad");
|
|
162
|
+
await createJestAssets(true);
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
// restore serverType
|
|
166
|
+
await setServerType(savedServerType);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
};
|
|
@@ -23,20 +23,7 @@ export const Base{{COMPONENT_CLASS_NAME}}: Story = args => {
|
|
|
23
23
|
|
|
24
24
|
const props = {
|
|
25
25
|
value,
|
|
26
|
-
label: configProps.label,
|
|
27
|
-
helperText: configProps.helperText,
|
|
28
|
-
caption: configProps.caption,
|
|
29
|
-
validatemessage: configProps.validatemessage,
|
|
30
|
-
hideLabel: configProps.hideLabel,
|
|
31
|
-
testId: configProps.testId,
|
|
32
26
|
additionalProps: configProps.additionalProps,
|
|
33
|
-
displayMode: configProps.displayMode,
|
|
34
|
-
variant: configProps.variant,
|
|
35
|
-
trueLabel: configProps.trueLabel,
|
|
36
|
-
falseLabel: configProps.falseLabel,
|
|
37
|
-
disabled: configProps.disabled,
|
|
38
|
-
readOnly: configProps.readOnly,
|
|
39
|
-
required: configProps.required,
|
|
40
27
|
getPConnect: () => {
|
|
41
28
|
return {
|
|
42
29
|
getStateProps: () => {
|
|
@@ -76,6 +63,9 @@ Base{{COMPONENT_CLASS_NAME}}.args = {
|
|
|
76
63
|
required: configProps.required,
|
|
77
64
|
status: configProps.status,
|
|
78
65
|
hideLabel: configProps.hideLabel,
|
|
66
|
+
trueLabel: configProps.trueLabel,
|
|
67
|
+
falseLabel: configProps.falseLabel,
|
|
79
68
|
displayMode: configProps.displayMode,
|
|
69
|
+
variant: configProps.variant,
|
|
80
70
|
validatemessage: configProps.validatemessage
|
|
81
71
|
};
|
|
@@ -3,7 +3,8 @@ import {
|
|
|
3
3
|
CheckboxGroup,
|
|
4
4
|
FieldValueList,
|
|
5
5
|
Text,
|
|
6
|
-
withConfiguration
|
|
6
|
+
withConfiguration,
|
|
7
|
+
BooleanDisplay
|
|
7
8
|
} from "@pega/cosmos-react-core";
|
|
8
9
|
|
|
9
10
|
import type { PConnFieldProps } from './PConnProps';
|
|
@@ -96,15 +97,17 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
|
|
|
96
97
|
|
|
97
98
|
let displayComponent;
|
|
98
99
|
if (displayMode) {
|
|
99
|
-
// @ts-ignore
|
|
100
100
|
displayComponent = (
|
|
101
|
-
|
|
102
|
-
<{{COMPONENT_CLASS_NAME}} value={value} trueLabel={trueLabel} falseLabel={falseLabel} />
|
|
101
|
+
<BooleanDisplay value={value} trueLabel={trueLabel} falseLabel={falseLabel} />
|
|
103
102
|
);
|
|
104
103
|
}
|
|
105
104
|
|
|
106
105
|
if (displayMode === 'DISPLAY_ONLY') {
|
|
107
|
-
return (
|
|
106
|
+
return (
|
|
107
|
+
<Styled{{COMPONENT_CLASS_NAME}}Wrapper>
|
|
108
|
+
{displayComponent}
|
|
109
|
+
</Styled{{COMPONENT_CLASS_NAME}}Wrapper>
|
|
110
|
+
);
|
|
108
111
|
}
|
|
109
112
|
|
|
110
113
|
if (displayMode === "LABELS_LEFT") {
|
|
@@ -31,6 +31,9 @@ window.PCore.getEnvironmentInfo = () => {
|
|
|
31
31
|
|
|
32
32
|
export const Base{{COMPONENT_CLASS_NAME}}: Story = args => {
|
|
33
33
|
const props = {
|
|
34
|
+
value: configProps.value,
|
|
35
|
+
additionalProps: configProps.additionalProps,
|
|
36
|
+
hasSuggestions: configProps.hasSuggestions,
|
|
34
37
|
getPConnect: () => {
|
|
35
38
|
return {
|
|
36
39
|
getActionsApi: () => {
|
|
@@ -54,25 +57,7 @@ export const Base{{COMPONENT_CLASS_NAME}}: Story = args => {
|
|
|
54
57
|
acceptSuggestion: () => {/* nothing */},
|
|
55
58
|
clearErrorMessages: () => {/* nothing */}
|
|
56
59
|
};
|
|
57
|
-
}
|
|
58
|
-
value: configProps.value,
|
|
59
|
-
validatemessage: configProps.validatemessage,
|
|
60
|
-
label: configProps.label,
|
|
61
|
-
hideLabel: configProps.hideLabel,
|
|
62
|
-
helperText: configProps.helperText,
|
|
63
|
-
nextYearRange: configProps.nextYearRange,
|
|
64
|
-
previousYearRange: configProps.previousYearRange,
|
|
65
|
-
showWeekNumber: configProps.showWeekNumber,
|
|
66
|
-
testId: configProps.testId,
|
|
67
|
-
showAsFormattedText: configProps.showAsFormattedText,
|
|
68
|
-
additionalProps: configProps.additionalProps,
|
|
69
|
-
displayMode: configProps.displayMode,
|
|
70
|
-
variant: configProps.variant,
|
|
71
|
-
hasSuggestions: configProps.hasSuggestions,
|
|
72
|
-
validatemessage: '',
|
|
73
|
-
disabled: configProps.disabled,
|
|
74
|
-
readOnly: configProps.readOnly,
|
|
75
|
-
required: configProps.required
|
|
60
|
+
}
|
|
76
61
|
};
|
|
77
62
|
|
|
78
63
|
return (
|
|
@@ -92,6 +77,10 @@ Base{{COMPONENT_CLASS_NAME}}.args = {
|
|
|
92
77
|
required: configProps.required,
|
|
93
78
|
status: configProps.status,
|
|
94
79
|
hideLabel: configProps.hideLabel,
|
|
80
|
+
nextYearRange: configProps.nextYearRange,
|
|
81
|
+
previousYearRange: configProps.previousYearRange,
|
|
82
|
+
showAsFormattedText: configProps.showAsFormattedText,
|
|
95
83
|
displayMode: configProps.displayMode,
|
|
84
|
+
variant: configProps.variant,
|
|
96
85
|
validatemessage: configProps.validatemessage
|
|
97
86
|
};
|
|
@@ -175,7 +175,7 @@ function {{COMPONENT_CLASS_NAME}} (props: {{COMPONENT_CLASS_NAME}}Props) {
|
|
|
175
175
|
);
|
|
176
176
|
switch(displayMode){
|
|
177
177
|
case 'DISPLAY_ONLY': {
|
|
178
|
-
return ( <Styled{{COMPONENT_CLASS_NAME}}Wrapper> displayComp </Styled{{COMPONENT_CLASS_NAME}}Wrapper>);
|
|
178
|
+
return ( <Styled{{COMPONENT_CLASS_NAME}}Wrapper> {displayComp} </Styled{{COMPONENT_CLASS_NAME}}Wrapper>);
|
|
179
179
|
}
|
|
180
180
|
case "LABELS_LEFT" : {
|
|
181
181
|
return (
|
|
@@ -31,6 +31,9 @@ window.PCore.getEnvironmentInfo = () => {
|
|
|
31
31
|
|
|
32
32
|
export const Base{{COMPONENT_CLASS_NAME}}: Story = args => {
|
|
33
33
|
const props = {
|
|
34
|
+
value: configProps.value,
|
|
35
|
+
additionalProps: configProps.additionalProps,
|
|
36
|
+
hasSuggestions: configProps.hasSuggestions,
|
|
34
37
|
getPConnect: () => {
|
|
35
38
|
return {
|
|
36
39
|
getActionsApi: () => {
|
|
@@ -54,24 +57,7 @@ export const Base{{COMPONENT_CLASS_NAME}}: Story = args => {
|
|
|
54
57
|
acceptSuggestion: () => {/* nothing */},
|
|
55
58
|
clearErrorMessages: () => {/* nothing */}
|
|
56
59
|
};
|
|
57
|
-
}
|
|
58
|
-
value: configProps.value,
|
|
59
|
-
validatemessage: configProps.validatemessage,
|
|
60
|
-
label: configProps.label,
|
|
61
|
-
hideLabel: configProps.hideLabel,
|
|
62
|
-
helperText: configProps.helperText,
|
|
63
|
-
withSeconds: configProps.withSeconds,
|
|
64
|
-
nextYearRange: configProps.nextYearRange,
|
|
65
|
-
previousYearRange: configProps.previousYearRange,
|
|
66
|
-
showWeekNumber: configProps.showWeekNumber,
|
|
67
|
-
testId: configProps.testId,
|
|
68
|
-
additionalProps: configProps.additionalProps,
|
|
69
|
-
displayMode: configProps.displayMode,
|
|
70
|
-
variant: configProps.variant,
|
|
71
|
-
hasSuggestions: configProps.hasSuggestions,
|
|
72
|
-
disabled: configProps.disabled,
|
|
73
|
-
readOnly: configProps.readOnly,
|
|
74
|
-
required: configProps.required
|
|
60
|
+
}
|
|
75
61
|
};
|
|
76
62
|
|
|
77
63
|
return (
|
|
@@ -92,6 +78,9 @@ Base{{COMPONENT_CLASS_NAME}}.args = {
|
|
|
92
78
|
required: configProps.required,
|
|
93
79
|
status: configProps.status,
|
|
94
80
|
hideLabel: configProps.hideLabel,
|
|
81
|
+
nextYearRange: configProps.nextYearRange,
|
|
82
|
+
previousYearRange: configProps.previousYearRange,
|
|
95
83
|
displayMode: configProps.displayMode,
|
|
84
|
+
variant: configProps.variant,
|
|
96
85
|
validatemessage: configProps.validatemessage
|
|
97
86
|
};
|
|
@@ -181,7 +181,7 @@ function {{COMPONENT_CLASS_NAME}} (props: {{COMPONENT_CLASS_NAME}}Props) {
|
|
|
181
181
|
);
|
|
182
182
|
switch (displayMode) {
|
|
183
183
|
case 'DISPLAY_ONLY': {
|
|
184
|
-
return ( <Styled{{COMPONENT_CLASS_NAME}}Wrapper> displayComp </Styled{{COMPONENT_CLASS_NAME}}Wrapper>);
|
|
184
|
+
return ( <Styled{{COMPONENT_CLASS_NAME}}Wrapper> {displayComp} </Styled{{COMPONENT_CLASS_NAME}}Wrapper>);
|
|
185
185
|
}
|
|
186
186
|
case 'LABELS_LEFT': {
|
|
187
187
|
return (
|
|
@@ -20,14 +20,7 @@ export const Base{{COMPONENT_CLASS_NAME}}: Story = args => {
|
|
|
20
20
|
|
|
21
21
|
const props = {
|
|
22
22
|
value: configProps.value,
|
|
23
|
-
placeholder: configProps.placeholder,
|
|
24
|
-
label: configProps.label,
|
|
25
|
-
helperText: configProps.helperText,
|
|
26
|
-
showGroupSeparators: configProps.showGroupSeparators,
|
|
27
|
-
hasSuggestions: configProps.hasSuggestions,
|
|
28
|
-
testId: configProps.testId,
|
|
29
23
|
fieldMetadata,
|
|
30
|
-
validatemessage: '',
|
|
31
24
|
getPConnect: () => {
|
|
32
25
|
return {
|
|
33
26
|
getStateProps: () => {
|
|
@@ -66,5 +59,6 @@ Base{{COMPONENT_CLASS_NAME}}.args = {
|
|
|
66
59
|
status: configProps.status,
|
|
67
60
|
hideLabel: configProps.hideLabel,
|
|
68
61
|
displayMode: configProps.displayMode,
|
|
62
|
+
variant: configProps.variant,
|
|
69
63
|
validatemessage: configProps.validatemessage
|
|
70
64
|
};
|
|
@@ -161,7 +161,7 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
|
|
|
161
161
|
|
|
162
162
|
switch (displayMode) {
|
|
163
163
|
case 'DISPLAY_ONLY': {
|
|
164
|
-
return (<Styled{{COMPONENT_CLASS_NAME}}Wrapper> displayComp </Styled{{COMPONENT_CLASS_NAME}}Wrapper>);
|
|
164
|
+
return (<Styled{{COMPONENT_CLASS_NAME}}Wrapper> {displayComp} </Styled{{COMPONENT_CLASS_NAME}}Wrapper>);
|
|
165
165
|
}
|
|
166
166
|
case 'LABELS_LEFT': {
|
|
167
167
|
return (
|
package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/demo.stories.tsx.mustache
CHANGED
|
@@ -20,17 +20,8 @@ export const Base{{COMPONENT_CLASS_NAME}}: Story = args => {
|
|
|
20
20
|
|
|
21
21
|
const props = {
|
|
22
22
|
value: Number(configProps.value),
|
|
23
|
-
placeholder: configProps.placeholder,
|
|
24
|
-
label: configProps.label,
|
|
25
|
-
helperText: configProps.helperText,
|
|
26
|
-
showGroupSeparators: configProps.showGroupSeparators,
|
|
27
|
-
allowDecimals: configProps.allowDecimals,
|
|
28
|
-
currencyISOCode: configProps.currencyISOCode,
|
|
29
|
-
alwaysShowISOCode: configProps.alwaysShowISOCode,
|
|
30
23
|
hasSuggestions: configProps.hasSuggestions,
|
|
31
|
-
testId: configProps.testId,
|
|
32
24
|
fieldMetadata,
|
|
33
|
-
validatemessage: '',
|
|
34
25
|
getPConnect: () => {
|
|
35
26
|
return {
|
|
36
27
|
getStateProps: () => {
|
|
@@ -60,6 +51,7 @@ export const Base{{COMPONENT_CLASS_NAME}}: Story = args => {
|
|
|
60
51
|
|
|
61
52
|
Base{{COMPONENT_CLASS_NAME}}.args = {
|
|
62
53
|
label: configProps.label,
|
|
54
|
+
placeholder: configProps.placeholder,
|
|
63
55
|
helperText: configProps.helperText,
|
|
64
56
|
showGroupSeparators: configProps.showGroupSeparators,
|
|
65
57
|
allowDecimals: configProps.allowDecimals,
|
|
@@ -72,5 +64,6 @@ Base{{COMPONENT_CLASS_NAME}}.args = {
|
|
|
72
64
|
status: configProps.status,
|
|
73
65
|
hideLabel: configProps.hideLabel,
|
|
74
66
|
displayMode: configProps.displayMode,
|
|
67
|
+
variant: configProps.variant,
|
|
75
68
|
validatemessage: configProps.validatemessage
|
|
76
69
|
};
|
|
@@ -192,7 +192,7 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
|
|
|
192
192
|
|
|
193
193
|
switch (displayMode) {
|
|
194
194
|
case 'DISPLAY_ONLY': {
|
|
195
|
-
return (<Styled{{COMPONENT_CLASS_NAME}}Wrapper> displayComp </Styled{{COMPONENT_CLASS_NAME}}Wrapper>) ;
|
|
195
|
+
return (<Styled{{COMPONENT_CLASS_NAME}}Wrapper> {displayComp} </Styled{{COMPONENT_CLASS_NAME}}Wrapper>) ;
|
|
196
196
|
}
|
|
197
197
|
case 'LABELS_LEFT': {
|
|
198
198
|
return (
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
export const configProps = {
|
|
4
4
|
value: '',
|
|
5
5
|
label: 'Currency Sample',
|
|
6
|
+
placeholder: 'Currency Placeholder',
|
|
6
7
|
currencyISOCode: 'USD',
|
|
7
8
|
allowDecimals: true,
|
|
8
9
|
showGroupSeparators: true,
|
|
@@ -12,6 +13,7 @@ export const configProps = {
|
|
|
12
13
|
testId: 'currency-12345678',
|
|
13
14
|
hasSuggestions: false,
|
|
14
15
|
displayMode: '',
|
|
16
|
+
variant: '',
|
|
15
17
|
hideLabel: false,
|
|
16
18
|
readOnly: false,
|
|
17
19
|
required: false,
|
package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/demo.stories.tsx.mustache
CHANGED
|
@@ -20,14 +20,8 @@ export const Base{{COMPONENT_CLASS_NAME}}: Story = args => {
|
|
|
20
20
|
|
|
21
21
|
const props = {
|
|
22
22
|
value: configProps.value,
|
|
23
|
-
placeholder: configProps.placeholder,
|
|
24
|
-
label: configProps.label,
|
|
25
|
-
helperText: configProps.helperText,
|
|
26
|
-
showGroupSeparators: configProps.showGroupSeparators,
|
|
27
23
|
hasSuggestions: configProps.hasSuggestions,
|
|
28
|
-
testId: configProps.testId,
|
|
29
24
|
fieldMetadata,
|
|
30
|
-
validatemessage: '',
|
|
31
25
|
getPConnect: () => {
|
|
32
26
|
return {
|
|
33
27
|
getStateProps: () => {
|
|
@@ -57,6 +51,7 @@ export const Base{{COMPONENT_CLASS_NAME}}: Story = args => {
|
|
|
57
51
|
Base{{COMPONENT_CLASS_NAME}}.args = {
|
|
58
52
|
label: configProps.label,
|
|
59
53
|
helperText: configProps.helperText,
|
|
54
|
+
placeholder: configProps.placeholder,
|
|
60
55
|
showGroupSeparators: configProps.showGroupSeparators,
|
|
61
56
|
testId: configProps.testId,
|
|
62
57
|
readOnly: configProps.readOnly,
|
|
@@ -65,5 +60,6 @@ Base{{COMPONENT_CLASS_NAME}}.args = {
|
|
|
65
60
|
status: configProps.status,
|
|
66
61
|
hideLabel: configProps.hideLabel,
|
|
67
62
|
displayMode: configProps.displayMode,
|
|
63
|
+
variant: configProps.variant,
|
|
68
64
|
validatemessage: configProps.validatemessage
|
|
69
65
|
};
|
package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/index.tsx.mustache
CHANGED
|
@@ -168,7 +168,7 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
|
|
|
168
168
|
|
|
169
169
|
return displayMode === 'DISPLAY_ONLY' ? (
|
|
170
170
|
<Styled{{COMPONENT_CLASS_NAME}}Wrapper>
|
|
171
|
-
displayComp
|
|
171
|
+
{displayComp}
|
|
172
172
|
</Styled{{COMPONENT_CLASS_NAME}}Wrapper>
|
|
173
173
|
) : (
|
|
174
174
|
<Styled{{COMPONENT_CLASS_NAME}}Wrapper>
|
|
@@ -19,14 +19,8 @@ export const Base{{COMPONENT_CLASS_NAME}}: Story = args => {
|
|
|
19
19
|
|
|
20
20
|
const props = {
|
|
21
21
|
value: configProps.value,
|
|
22
|
-
placeholder: configProps.placeholder,
|
|
23
|
-
label: configProps.label,
|
|
24
|
-
helperText: configProps.helperText,
|
|
25
|
-
showGroupSeparators: configProps.showGroupSeparators,
|
|
26
22
|
hasSuggestions: configProps.hasSuggestions,
|
|
27
|
-
testId: configProps.testId,
|
|
28
23
|
fieldMetadata,
|
|
29
|
-
validatemessage: '',
|
|
30
24
|
getPConnect: () => {
|
|
31
25
|
return {
|
|
32
26
|
getStateProps: () => {
|
|
@@ -56,6 +50,7 @@ export const Base{{COMPONENT_CLASS_NAME}}: Story = args => {
|
|
|
56
50
|
Base{{COMPONENT_CLASS_NAME}}.args = {
|
|
57
51
|
label: configProps.label,
|
|
58
52
|
helperText: configProps.helperText,
|
|
53
|
+
placeholder: configProps.placeholder,
|
|
59
54
|
showGroupSeparators: configProps.showGroupSeparators,
|
|
60
55
|
testId: configProps.testId,
|
|
61
56
|
readOnly: configProps.readOnly,
|
|
@@ -64,5 +59,6 @@ Base{{COMPONENT_CLASS_NAME}}.args = {
|
|
|
64
59
|
status: configProps.status,
|
|
65
60
|
hideLabel: configProps.hideLabel,
|
|
66
61
|
displayMode: configProps.displayMode,
|
|
62
|
+
variant: configProps.variant,
|
|
67
63
|
validatemessage: configProps.validatemessage
|
|
68
64
|
};
|
|
@@ -187,7 +187,7 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
|
|
|
187
187
|
|
|
188
188
|
switch (displayMode) {
|
|
189
189
|
case 'DISPLAY_ONLY': {
|
|
190
|
-
return (<Styled{{COMPONENT_CLASS_NAME}}Wrapper> displayComp </Styled{{COMPONENT_CLASS_NAME}}Wrapper>);
|
|
190
|
+
return (<Styled{{COMPONENT_CLASS_NAME}}Wrapper> {displayComp} </Styled{{COMPONENT_CLASS_NAME}}Wrapper>);
|
|
191
191
|
}
|
|
192
192
|
case 'LABELS_LEFT': {
|
|
193
193
|
return (
|
|
@@ -23,14 +23,8 @@ export const Base{{COMPONENT_CLASS_NAME}}: Story = args => {
|
|
|
23
23
|
|
|
24
24
|
const props = {
|
|
25
25
|
value,
|
|
26
|
-
placeholder: configProps.placeholder,
|
|
27
|
-
label: configProps.label,
|
|
28
|
-
helperText: configProps.helperText,
|
|
29
|
-
datasource: configProps.datasource,
|
|
30
|
-
testId: configProps.testId,
|
|
31
26
|
hasSuggestions: configProps.hasSuggestions,
|
|
32
27
|
fieldMetadata,
|
|
33
|
-
validatemessage: '',
|
|
34
28
|
getPConnect: () => {
|
|
35
29
|
return {
|
|
36
30
|
getConfigProps: () => {
|
|
@@ -84,6 +78,7 @@ export const Base{{COMPONENT_CLASS_NAME}}: Story = args => {
|
|
|
84
78
|
};
|
|
85
79
|
|
|
86
80
|
Base{{COMPONENT_CLASS_NAME}}.args = {
|
|
81
|
+
datasource: configProps.datasource,
|
|
87
82
|
label: configProps.label,
|
|
88
83
|
helperText: configProps.helperText,
|
|
89
84
|
placeholder: configProps.placeholder,
|
|
@@ -94,5 +89,6 @@ Base{{COMPONENT_CLASS_NAME}}.args = {
|
|
|
94
89
|
status: configProps.status,
|
|
95
90
|
hideLabel: configProps.hideLabel,
|
|
96
91
|
displayMode: configProps.displayMode,
|
|
92
|
+
variant: configProps.variant,
|
|
97
93
|
validatemessage: configProps.validatemessage
|
|
98
94
|
};
|
|
@@ -256,7 +256,7 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
|
|
|
256
256
|
|
|
257
257
|
return displayMode === 'DISPLAY_ONLY' ? (
|
|
258
258
|
<Styled{{COMPONENT_CLASS_NAME}}Wrapper>
|
|
259
|
-
displayComp
|
|
259
|
+
{displayComp}
|
|
260
260
|
</Styled{{COMPONENT_CLASS_NAME}}Wrapper>
|
|
261
261
|
) : (
|
|
262
262
|
<Styled{{COMPONENT_CLASS_NAME}}Wrapper>
|