@pega/custom-dx-components 2.0.23 → 2.0.25
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 +3 -6
- package/src/cli.js +0 -18
- package/src/constants.js +2 -32
- package/src/tasks/authenticate/helper.js +5 -63
- package/src/tasks/authenticate/index.js +50 -107
- package/src/tasks/create/index.js +63 -59
- package/src/tasks/create/templates/Constellation/Field/Boolean/boolean-format.js.mustache +1 -1
- package/src/tasks/create/templates/Constellation/Field/Boolean/demo.stories.jsx.mustache +16 -33
- package/src/tasks/create/templates/Constellation/Field/Boolean/index.jsx.mustache +2 -1
- package/src/tasks/create/templates/Constellation/Field/Date/date.js.mustache +67 -179
- package/src/tasks/create/templates/Constellation/Field/Date/demo.stories.jsx.mustache +17 -46
- package/src/tasks/create/templates/Constellation/Field/Date/index.jsx.mustache +1 -3
- package/src/tasks/create/templates/Constellation/Field/DateTime/date-time.js.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Field/DateTime/{date-utils.js.mustache → date-utils.js} +0 -1
- package/src/tasks/create/templates/Constellation/Field/DateTime/date.js.mustache +0 -1
- package/src/tasks/create/templates/Constellation/Field/DateTime/demo.stories.jsx.mustache +17 -46
- package/src/tasks/create/templates/Constellation/Field/DateTime/index.jsx.mustache +0 -2
- package/src/tasks/create/templates/Constellation/Field/Decimal/demo.stories.jsx.mustache +17 -22
- package/src/tasks/create/templates/Constellation/Field/Decimal/index.jsx.mustache +1 -2
- package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/demo.stories.jsx.mustache +17 -26
- package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/index.jsx.mustache +4 -3
- package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/demo.stories.jsx.mustache +17 -22
- package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/index.jsx.mustache +2 -8
- package/src/tasks/create/templates/Constellation/Field/Integer/demo.stories.jsx.mustache +17 -22
- package/src/tasks/create/templates/Constellation/Field/Integer/index.jsx.mustache +1 -2
- package/src/tasks/create/templates/Constellation/Field/Picklist/demo.stories.jsx.mustache +16 -50
- package/src/tasks/create/templates/Constellation/Field/Picklist/index.jsx.mustache +1 -44
- package/src/tasks/create/templates/Constellation/Field/Picklist/picklist.js.mustache +43 -0
- package/src/tasks/create/templates/Constellation/Field/Text/demo.stories.jsx.mustache +16 -23
- package/src/tasks/create/templates/Constellation/Field/Text-Email/demo.stories.jsx.mustache +17 -21
- package/src/tasks/create/templates/Constellation/Field/Text-Email/index.jsx.mustache +2 -44
- package/src/tasks/create/templates/Constellation/Field/Text-Email/text-email.js.mustache +43 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Input/{StatusWork.jsx → StatusWork.js} +1 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Input/demo.stories.jsx.mustache +17 -21
- package/src/tasks/create/templates/Constellation/Field/Text-Input/index.jsx.mustache +3 -46
- package/src/tasks/create/templates/Constellation/Field/Text-Input/text-input.js.mustache +43 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/demo.stories.jsx.mustache +17 -21
- package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/index.jsx.mustache +2 -44
- package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/text-paragraph.js.mustache +43 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Phone/demo.stories.jsx.mustache +17 -19
- package/src/tasks/create/templates/Constellation/Field/Text-Phone/index.jsx.mustache +3 -47
- package/src/tasks/create/templates/Constellation/Field/Text-Phone/text-phone.js.mustache +43 -0
- package/src/tasks/create/templates/Constellation/Field/Text-URL/demo.stories.jsx.mustache +17 -19
- 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.jsx.mustache → text-url.js.mustache} +1 -2
- package/src/tasks/create/templates/Constellation/Field/TimeofDay/demo.stories.jsx.mustache +17 -30
- package/src/tasks/create/templates/Constellation/Field/TimeofDay/time-of-day.js.mustache +0 -1
- package/src/tasks/create/templates/Constellation/Template/DETAILS/index.jsx.mustache +29 -14
- package/src/tasks/create/templates/Constellation/Template/DETAILS/utils.js.mustache +77 -3
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/index.jsx.mustache +29 -14
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/utils.js.mustache +74 -3
- package/src/tasks/create/templates/Constellation/Template/FORM/index.jsx.mustache +10 -6
- package/src/tasks/create/templates/Constellation/Template/FORM-region/index.jsx.mustache +8 -10
- package/src/tasks/create/templates/Constellation/Template/PAGE/{GetNextWork.jsx.mustache → GetNextWork.js.mustache} +0 -6
- package/src/tasks/create/templates/Constellation/Template/PAGE/index.jsx.mustache +7 -9
- package/src/tasks/create/templates/Constellation/Template/PAGE/utils.js.mustache +1 -4
- package/src/tasks/create/templates/Constellation/Widget/CASE/index.jsx.mustache +0 -1
- package/src/tasks/create/templates/Constellation/Widget/PAGE/index.jsx.mustache +8 -8
- package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/{Avatar.jsx.mustache → Avatar.js.mustache} +0 -2
- package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/{Operator.jsx.mustache → Operator.js.mustache} +1 -2
- package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/index.jsx.mustache +9 -9
- package/src/tasks/delete/helper.js +0 -4
- package/src/tasks/delete/index.js +0 -4
- package/src/tasks/index.js +0 -3
- package/src/tasks/init/index.js +3 -3
- package/src/tasks/init/template/.eslintrc.json +5 -186
- package/src/tasks/init/template/README.md +59 -75
- package/src/tasks/init/template/package.json.mustache +6 -21
- package/src/tasks/init/template/tasks.config.json +2 -5
- package/src/tasks/list/index.js +0 -4
- package/src/tasks/{bundle → publish/bundle}/builder/webpack.config.js +2 -0
- package/src/tasks/{bundle → publish/bundle}/index.js +2 -2
- package/src/tasks/publish/index.js +1 -14
- package/src/util.js +6 -11
- package/src/auth.js +0 -563
- package/src/tasks/build/helper.js +0 -123
- package/src/tasks/build/index.js +0 -54
- package/src/tasks/create/templates/Constellation/Field/Boolean/mock.stories.js.mustache +0 -21
- package/src/tasks/create/templates/Constellation/Field/Date/DateFormatter.js.mustache +0 -61
- package/src/tasks/create/templates/Constellation/Field/Date/FormattedText.jsx.mustache +0 -41
- package/src/tasks/create/templates/Constellation/Field/Date/mock.stories.js.mustache +0 -23
- package/src/tasks/create/templates/Constellation/Field/DateTime/mock.stories.js.mustache +0 -23
- package/src/tasks/create/templates/Constellation/Field/Decimal/mock.stories.js.mustache +0 -21
- package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/mock.stories.js.mustache +0 -23
- package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/mock.stories.js.mustache +0 -21
- package/src/tasks/create/templates/Constellation/Field/Integer/mock.stories.js.mustache +0 -21
- package/src/tasks/create/templates/Constellation/Field/Picklist/mock.stories.js.mustache +0 -67
- package/src/tasks/create/templates/Constellation/Field/Text/mock.stories.js.mustache +0 -13
- package/src/tasks/create/templates/Constellation/Field/Text-Email/mock.stories.js.mustache +0 -22
- package/src/tasks/create/templates/Constellation/Field/Text-Input/mock.stories.js.mustache +0 -21
- package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/mock.stories.js.mustache +0 -20
- package/src/tasks/create/templates/Constellation/Field/Text-Phone/mock.stories.js.mustache +0 -37
- package/src/tasks/create/templates/Constellation/Field/Text-URL/mock.stories.js.mustache +0 -22
- package/src/tasks/create/templates/Constellation/Field/TimeofDay/mock.stories.js.mustache +0 -20
- package/src/tasks/create/templates/Constellation/Template/DETAILS/StatusWork.jsx.mustache +0 -26
- package/src/tasks/create/templates/Constellation/Template/DETAILS/demo.stories.jsx.mustache +0 -118
- package/src/tasks/create/templates/Constellation/Template/DETAILS/mock.stories.js.mustache +0 -179
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/StatusWork.jsx.mustache +0 -26
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/demo.stories.jsx.mustache +0 -123
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/mock.stories.js.mustache +0 -215
- package/src/tasks/create/templates/Constellation/Template/FORM/demo.stories.jsx.mustache +0 -93
- package/src/tasks/create/templates/Constellation/Template/FORM/mock.stories.js.mustache +0 -125
- package/src/tasks/create/templates/Constellation/Template/FORM-region/demo.stories.jsx.mustache +0 -100
- package/src/tasks/create/templates/Constellation/Template/FORM-region/mock.stories.js.mustache +0 -131
- package/src/tasks/create/templates/Constellation/Template/PAGE/demo.stories.jsx.mustache +0 -101
- package/src/tasks/create/templates/Constellation/Template/PAGE/mock.stories.js.mustache +0 -94
- package/src/tasks/create/templates/Constellation/Widget/CASE/demo.stories.jsx.mustache +0 -78
- package/src/tasks/create/templates/Constellation/Widget/CASE/mock.stories.js.mustache +0 -390
- package/src/tasks/create/templates/Constellation/Widget/PAGE/demo.stories.jsx.mustache +0 -30
- package/src/tasks/create/templates/Constellation/Widget/PAGE/mock.stories.js.mustache +0 -23
- package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/demo.stories.jsx.mustache +0 -68
- package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/mock.stories.js.mustache +0 -51
- package/src/tasks/delete-all/helper.js +0 -175
- package/src/tasks/delete-all/index.js +0 -49
- package/src/tasks/init/template/.eslintignore +0 -8
- package/src/tasks/linter/index.js +0 -46
- package/src/tasks/publish-all/helper.js +0 -139
- package/src/tasks/publish-all/index.js +0 -84
- /package/src/tasks/{bundle → publish/bundle}/builder/index.js +0 -0
- /package/src/tasks/{bundle → publish/bundle}/builder/modules.js +0 -0
- /package/src/tasks/{bundle → publish/bundle}/builder/paths.js +0 -0
|
@@ -1,123 +0,0 @@
|
|
|
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
|
-
getPegaServerConfig,
|
|
14
|
-
validateRulesetVersion
|
|
15
|
-
} from '../../util.js';
|
|
16
|
-
import { PUBLISH_COMPONENT_SERVICE_REST_ENDPOINT, TOKEN_PATH } from '../../constants.js';
|
|
17
|
-
|
|
18
|
-
export const getPublishComponentQuestions = async () => {
|
|
19
|
-
const components = await getComponents();
|
|
20
|
-
const defaultPegaConfig = await getPegaServerConfig();
|
|
21
|
-
|
|
22
|
-
return [
|
|
23
|
-
{
|
|
24
|
-
name: 'componentKey',
|
|
25
|
-
type: 'rawlist',
|
|
26
|
-
message: 'Select component to build',
|
|
27
|
-
choices: components
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
name: 'sourceMap',
|
|
31
|
-
message: 'Generate source map ?',
|
|
32
|
-
default: defaultPegaConfig.sourceMap,
|
|
33
|
-
when: () => false && !process.env.SOURCE_MAP
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
name: 'devBuild',
|
|
37
|
-
message: 'Generate development build ?',
|
|
38
|
-
default: defaultPegaConfig.devBuild
|
|
39
|
-
}
|
|
40
|
-
];
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export const zipComponent = async componentKey => {
|
|
44
|
-
const srcDirectory = await getComponentDirectoryPath(componentKey);
|
|
45
|
-
const buildDirectory = await path.join(path.resolve(), 'dist/components', componentKey);
|
|
46
|
-
const configJson = `${srcDirectory}/config.json`;
|
|
47
|
-
|
|
48
|
-
const zip = new AdmZip();
|
|
49
|
-
|
|
50
|
-
zip.addLocalFolder(srcDirectory, 'src/');
|
|
51
|
-
zip.addLocalFile(configJson);
|
|
52
|
-
zip.addLocalFolder(buildDirectory);
|
|
53
|
-
const zipContent = zip.toBuffer().toString('base64');
|
|
54
|
-
|
|
55
|
-
const configContent = Buffer.from(fs.readFileSync(`${srcDirectory}/config.json`)).toString();
|
|
56
|
-
fs.rmdir('dist', { recursive: true }, err => {
|
|
57
|
-
if (err) {
|
|
58
|
-
throw err;
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
return { zipContent, configContent };
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
export const publishComponentToServer = async data => {
|
|
65
|
-
const { configContent, zipContent, componentKey, rulesetName, rulesetVersion } = data;
|
|
66
|
-
|
|
67
|
-
const apiBody = {
|
|
68
|
-
configContent,
|
|
69
|
-
zipContent,
|
|
70
|
-
componentKey: JSON.parse(configContent).componentKey,
|
|
71
|
-
publishFor: 'constellation',
|
|
72
|
-
rulesetName,
|
|
73
|
-
rulesetVersion,
|
|
74
|
-
category: ''
|
|
75
|
-
};
|
|
76
|
-
const defaultPegaConfig = await getPegaServerConfig();
|
|
77
|
-
const url = constructCompleteUrl(
|
|
78
|
-
defaultPegaConfig.server,
|
|
79
|
-
PUBLISH_COMPONENT_SERVICE_REST_ENDPOINT
|
|
80
|
-
);
|
|
81
|
-
try {
|
|
82
|
-
const OauthData = fs.readFileSync(TOKEN_PATH, 'utf8');
|
|
83
|
-
if (OauthData) {
|
|
84
|
-
const {
|
|
85
|
-
access_token: accessToken,
|
|
86
|
-
token_type: tokenType,
|
|
87
|
-
refresh_token: refreshToken
|
|
88
|
-
} = JSON.parse(OauthData);
|
|
89
|
-
let status = 500;
|
|
90
|
-
fetch(url, {
|
|
91
|
-
method: 'POST',
|
|
92
|
-
agent: new https.Agent({ rejectUnauthorized: false }),
|
|
93
|
-
headers: {
|
|
94
|
-
Authorization: `${tokenType} ${accessToken}`
|
|
95
|
-
},
|
|
96
|
-
body: JSON.stringify(apiBody)
|
|
97
|
-
})
|
|
98
|
-
.then(response => {
|
|
99
|
-
status = response.status;
|
|
100
|
-
return response.text();
|
|
101
|
-
})
|
|
102
|
-
.then(resp => {
|
|
103
|
-
const respData = JSON.parse(resp);
|
|
104
|
-
if (status === 401) {
|
|
105
|
-
throw new Error(
|
|
106
|
-
'Error occured in authentication. Please regenerate using authenticate'
|
|
107
|
-
);
|
|
108
|
-
// console.log(accessTokenUri, refreshToken);
|
|
109
|
-
/* TODO - Handle refresh_token */
|
|
110
|
-
} else if (status == 200) {
|
|
111
|
-
console.log(chalk.bold.green(`Success : ${respData.message}`));
|
|
112
|
-
} else {
|
|
113
|
-
throw new Error(`${respData.message}`);
|
|
114
|
-
}
|
|
115
|
-
})
|
|
116
|
-
.catch(e => Promise.reject(`${chalk.bold.red(e)}`));
|
|
117
|
-
} else {
|
|
118
|
-
throw new Error(`Error occured in authentication. Please regenerate using authenticate`);
|
|
119
|
-
}
|
|
120
|
-
} catch (err) {
|
|
121
|
-
throw new Error(`Error occured in authentication. Please regenerate using authenticate`);
|
|
122
|
-
}
|
|
123
|
-
};
|
package/src/tasks/build/index.js
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
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 { getPublishComponentQuestions, publishComponentToServer, zipComponent } from './helper.js';
|
|
10
|
-
import { getComponentDirectoryPath, showVersion } from '../../util.js';
|
|
11
|
-
|
|
12
|
-
export default async options => {
|
|
13
|
-
showVersion();
|
|
14
|
-
|
|
15
|
-
const questions = await getPublishComponentQuestions();
|
|
16
|
-
const answers = await inquirer.prompt(questions);
|
|
17
|
-
const { componentKey, sourceMap, devBuild } = answers;
|
|
18
|
-
|
|
19
|
-
let content = {
|
|
20
|
-
...answers
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
const tasks = new Listr(
|
|
24
|
-
[
|
|
25
|
-
{
|
|
26
|
-
title: 'Validate config schema',
|
|
27
|
-
task: async () => {
|
|
28
|
-
await validate(componentKey);
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
title: 'Lint component',
|
|
33
|
-
task: async () => {
|
|
34
|
-
const targetDirectory = await getComponentDirectoryPath(componentKey);
|
|
35
|
-
// console.log(`in buildComponent Lint component task: componentKey: ${componentKey} targetDirectory: ${targetDirectory}`);
|
|
36
|
-
await lintComponent(targetDirectory);
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
title: 'Bundle Component',
|
|
41
|
-
task: async () => await bundleComponent(componentKey, sourceMap, devBuild),
|
|
42
|
-
skip: () => (options.skipBundle ? 'Skipped bundling component' : undefined)
|
|
43
|
-
}
|
|
44
|
-
],
|
|
45
|
-
{
|
|
46
|
-
exitOnError: true
|
|
47
|
-
}
|
|
48
|
-
);
|
|
49
|
-
|
|
50
|
-
await tasks.run().catch(err => {
|
|
51
|
-
console.log(chalk.bold.red(err.toString()));
|
|
52
|
-
});
|
|
53
|
-
return true;
|
|
54
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export const configProps = {
|
|
2
|
-
value: true,
|
|
3
|
-
label: 'Boolean label',
|
|
4
|
-
helperText: 'Test helper text',
|
|
5
|
-
caption: 'Boolean caption',
|
|
6
|
-
validatemessage: '',
|
|
7
|
-
hideLabel: false,
|
|
8
|
-
testId: '12345678',
|
|
9
|
-
additionalProps: {},
|
|
10
|
-
displayMode: '',
|
|
11
|
-
variant: '',
|
|
12
|
-
trueLabel: 'True',
|
|
13
|
-
falseLabel: 'False',
|
|
14
|
-
disabled: false,
|
|
15
|
-
readOnly: false,
|
|
16
|
-
required: true
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export const stateProps = {
|
|
20
|
-
value: '.Test'
|
|
21
|
-
};
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import dayjs from 'dayjs';
|
|
2
|
-
import relativeTime from 'dayjs/plugin/relativeTime';
|
|
3
|
-
import localizedFormat from 'dayjs/plugin/localizedFormat';
|
|
4
|
-
import utc from 'dayjs/plugin/utc';
|
|
5
|
-
import tzone from 'dayjs/plugin/timezone';
|
|
6
|
-
|
|
7
|
-
dayjs.extend(relativeTime);
|
|
8
|
-
dayjs.extend(localizedFormat);
|
|
9
|
-
dayjs.extend(utc);
|
|
10
|
-
dayjs.extend(tzone);
|
|
11
|
-
|
|
12
|
-
const types = ['fromNow', 'customFormat'];
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
// value should be in ISO 8601 format.
|
|
17
|
-
function DateFormatter(
|
|
18
|
-
value,
|
|
19
|
-
{ type = types[1], format = "DD/MM/YYYY", timezone } = {}
|
|
20
|
-
) {
|
|
21
|
-
if (!value) return value;
|
|
22
|
-
switch (type) {
|
|
23
|
-
case types[1]:
|
|
24
|
-
if (timezone) return dayjs(value).tz(timezone).format(format);
|
|
25
|
-
return dayjs(value).format(format);
|
|
26
|
-
case types[0]:
|
|
27
|
-
return dayjs(value).from(dayjs());
|
|
28
|
-
default:
|
|
29
|
-
return value;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// value should be in hh:mm:ss format (00:00:00 - 23:59:59).
|
|
34
|
-
function TimeFormatter(value, options) {
|
|
35
|
-
if (!value) return value;
|
|
36
|
-
const { locale = "en-US" } = options;
|
|
37
|
-
const timeOnlyRegex = /^(?:[01]\d|2[0123]):(?:[012345]\d):(?:[012345]\d)$/;
|
|
38
|
-
if (value.length === 8 && timeOnlyRegex.test(value)) {
|
|
39
|
-
const tempDate = new Date();
|
|
40
|
-
const hours = parseInt(value.substr(0, 2), 10);
|
|
41
|
-
const minutes = parseInt(value.substr(3, 2), 10);
|
|
42
|
-
const seconds = parseInt(value.substr(6, 2), 10);
|
|
43
|
-
tempDate.setHours(hours);
|
|
44
|
-
tempDate.setMinutes(minutes);
|
|
45
|
-
tempDate.setSeconds(seconds);
|
|
46
|
-
return tempDate.toLocaleTimeString(locale);
|
|
47
|
-
}
|
|
48
|
-
return DateFormatter(value, options);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export default {
|
|
52
|
-
Date: (value, options) => DateFormatter(value, { type: 'customFormat', ...options }),
|
|
53
|
-
'Date-Time-Default': (value, options) =>
|
|
54
|
-
DateFormatter(value, { ...options, type: 'customFormat', format: 'lll' }),
|
|
55
|
-
'Time-Default': (value, options) =>
|
|
56
|
-
TimeFormatter(value, {
|
|
57
|
-
...options,
|
|
58
|
-
type: 'customFormat',
|
|
59
|
-
format: 'hh:mm A'
|
|
60
|
-
})
|
|
61
|
-
};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { FieldValueList } from '@pega/cosmos-react-core';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
|
|
4
|
-
import { format } from './date.js';
|
|
5
|
-
|
|
6
|
-
export default function FormattedText(props) {
|
|
7
|
-
const { formatType, label, value, testId, hideLabel, variant, additionalProps } = props;
|
|
8
|
-
|
|
9
|
-
let text = value;
|
|
10
|
-
|
|
11
|
-
text = format(text, formatType, additionalProps);
|
|
12
|
-
|
|
13
|
-
const fields = [
|
|
14
|
-
{
|
|
15
|
-
id: label.toLowerCase(),
|
|
16
|
-
name: hideLabel ? '' : label,
|
|
17
|
-
value: text
|
|
18
|
-
}
|
|
19
|
-
];
|
|
20
|
-
return <FieldValueList variant={variant} fields={fields} data-testid={testId} />;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
FormattedText.defaultProps = {
|
|
24
|
-
formatType: 'none',
|
|
25
|
-
variant: 'stacked',
|
|
26
|
-
value: undefined,
|
|
27
|
-
label: '',
|
|
28
|
-
testId: null,
|
|
29
|
-
hideLabel: false,
|
|
30
|
-
additionalProps: {}
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
FormattedText.propTypes = {
|
|
34
|
-
formatType: PropTypes.string,
|
|
35
|
-
variant: PropTypes.oneOf(['inline', 'stacked']),
|
|
36
|
-
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.bool]),
|
|
37
|
-
label: PropTypes.string,
|
|
38
|
-
testId: PropTypes.string,
|
|
39
|
-
additionalProps: PropTypes.objectOf(PropTypes.any),
|
|
40
|
-
hideLabel: PropTypes.bool
|
|
41
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export const configProps = {
|
|
2
|
-
value: '2023-01-31T12:23:00.000Z',
|
|
3
|
-
validatemessage: '',
|
|
4
|
-
label: 'Date Label',
|
|
5
|
-
hideLabel: false,
|
|
6
|
-
helperText: 'Date helper text',
|
|
7
|
-
nextYearRange: '10',
|
|
8
|
-
previousYearRange: '10',
|
|
9
|
-
showWeekNumber: true,
|
|
10
|
-
testId: '12345678',
|
|
11
|
-
showAsFormattedText: true,
|
|
12
|
-
additionalProps: {},
|
|
13
|
-
displayMode: '',
|
|
14
|
-
variant: '',
|
|
15
|
-
hasSuggestions: false,
|
|
16
|
-
readOnly: false,
|
|
17
|
-
required: false,
|
|
18
|
-
disabled: false
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export const stateProps = {
|
|
22
|
-
value: '.DateLabel'
|
|
23
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export const configProps = {
|
|
2
|
-
value: '2023-01-24T16:45:00.000Z',
|
|
3
|
-
validatemessage: '',
|
|
4
|
-
label: 'DateTime Label',
|
|
5
|
-
hideLabel: false,
|
|
6
|
-
helperText: 'DateTime helper text',
|
|
7
|
-
withSeconds: false,
|
|
8
|
-
nextYearRange: '10',
|
|
9
|
-
previousYearRange: '5',
|
|
10
|
-
showWeekNumber: false,
|
|
11
|
-
testId: '12345678',
|
|
12
|
-
additionalProps: {},
|
|
13
|
-
displayMode: '',
|
|
14
|
-
variant: '',
|
|
15
|
-
hasSuggestions: false,
|
|
16
|
-
readOnly: false,
|
|
17
|
-
required: false,
|
|
18
|
-
disabled: false
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export const stateProps = {
|
|
22
|
-
value: '.DateTimeLabel'
|
|
23
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export const configProps = {
|
|
2
|
-
value: '',
|
|
3
|
-
label: 'Decimal Sample',
|
|
4
|
-
showGroupSeparators: true,
|
|
5
|
-
placeholder: 'Decimal Placeholder',
|
|
6
|
-
helperText: 'Decimal Helper Text',
|
|
7
|
-
testId: 'decimal-12345678',
|
|
8
|
-
hasSuggestions: false
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export const stateProps = {
|
|
12
|
-
value: '.DecimalSample',
|
|
13
|
-
hasSuggestions: false
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export const fieldMetadata = {
|
|
17
|
-
classID: 'DIXL-MediaCo-Work-NewService',
|
|
18
|
-
type: 'Decimal',
|
|
19
|
-
displayAs: 'pxNumber',
|
|
20
|
-
label: 'Decimal sample'
|
|
21
|
-
};
|
package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/mock.stories.js.mustache
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export const configProps = {
|
|
2
|
-
value: '',
|
|
3
|
-
label: 'Currency Sample',
|
|
4
|
-
currencyISOCode: 'USD',
|
|
5
|
-
allowDecimals: true,
|
|
6
|
-
alwaysShowISOCode: true,
|
|
7
|
-
placeholder: 'Currency Placeholder',
|
|
8
|
-
helperText: 'Currency Helper Text',
|
|
9
|
-
testId: 'currency-12345678',
|
|
10
|
-
hasSuggestions: false
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export const stateProps = {
|
|
14
|
-
value: '.CurrencySample',
|
|
15
|
-
hasSuggestions: false
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export const fieldMetadata = {
|
|
19
|
-
classID: 'DIXL-MediaCo-Work-NewService',
|
|
20
|
-
type: 'Decimal',
|
|
21
|
-
displayAs: 'pxCurrency',
|
|
22
|
-
label: 'Currency sample'
|
|
23
|
-
};
|
package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/mock.stories.js.mustache
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export const configProps = {
|
|
2
|
-
value: '',
|
|
3
|
-
label: 'Percentage Sample',
|
|
4
|
-
showGroupSeparators: true,
|
|
5
|
-
placeholder: 'Percentage Placeholder',
|
|
6
|
-
helperText: 'Percentage Helper Text',
|
|
7
|
-
testId: 'percentage-12345678',
|
|
8
|
-
hasSuggestions: false
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export const stateProps = {
|
|
12
|
-
value: '.PercentageSample',
|
|
13
|
-
hasSuggestions: false
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export const fieldMetadata = {
|
|
17
|
-
classID: 'DIXL-MediaCo-Work-NewService',
|
|
18
|
-
type: 'Decimal',
|
|
19
|
-
displayAs: 'pxPercentage',
|
|
20
|
-
label: 'Percentage sample'
|
|
21
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export const configProps = {
|
|
2
|
-
value: '',
|
|
3
|
-
label: 'Integer Sample',
|
|
4
|
-
showGroupSeparators: true,
|
|
5
|
-
placeholder: 'Integer Placeholder',
|
|
6
|
-
helperText: 'Integer Helper Text',
|
|
7
|
-
testId: 'integer-12345678',
|
|
8
|
-
hasSuggestions: false
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export const stateProps = {
|
|
12
|
-
value: '.IntegerSample',
|
|
13
|
-
hasSuggestions: false
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export const fieldMetadata = {
|
|
17
|
-
classID: 'DIXL-MediaCo-Work-NewService',
|
|
18
|
-
type: 'Integer',
|
|
19
|
-
displayAs: 'pxInteger',
|
|
20
|
-
label: 'Integer sample'
|
|
21
|
-
};
|
|
@@ -1,67 +0,0 @@
|
|
|
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
|
-
};
|
|
31
|
-
|
|
32
|
-
export const rawMetadata = {
|
|
33
|
-
type: 'Dropdown',
|
|
34
|
-
config: {
|
|
35
|
-
value: '@P .PicklistSample',
|
|
36
|
-
label: '@L Picklist Sample',
|
|
37
|
-
placeholder: '@L Select...',
|
|
38
|
-
listType: 'associated',
|
|
39
|
-
datasource: '@ASSOCIATED .PicklistSample',
|
|
40
|
-
helperText: '@L Picklist Helper Text',
|
|
41
|
-
testId: 'picklist-12345678'
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
export const fieldMetadata = {
|
|
46
|
-
classID: 'DIXL-MediaCo-Work-NewService',
|
|
47
|
-
type: 'Text',
|
|
48
|
-
displayAs: 'pxDropdown',
|
|
49
|
-
label: 'Picklist sample',
|
|
50
|
-
datasource: {
|
|
51
|
-
tableType: 'PromptList',
|
|
52
|
-
records: [
|
|
53
|
-
{
|
|
54
|
-
key: 'Option 1',
|
|
55
|
-
value: 'Option 1'
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
key: 'Option 2',
|
|
59
|
-
value: 'Option 2'
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
key: 'Option 3',
|
|
63
|
-
value: 'Option 3'
|
|
64
|
-
}
|
|
65
|
-
]
|
|
66
|
-
}
|
|
67
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export const configProps = {
|
|
2
|
-
value: '',
|
|
3
|
-
label: 'Text Sample',
|
|
4
|
-
placeholder: 'Text Placeholder',
|
|
5
|
-
helperText: 'Text Helper Text',
|
|
6
|
-
testId: 'Text-12345678',
|
|
7
|
-
hasSuggestions: false
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export const stateProps = {
|
|
11
|
-
value: '.TextSample',
|
|
12
|
-
hasSuggestions: false
|
|
13
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export const configProps = {
|
|
2
|
-
value: '',
|
|
3
|
-
label: 'Email Sample',
|
|
4
|
-
placeholder: 'Email Placeholder',
|
|
5
|
-
helperText: 'Email Helper Text',
|
|
6
|
-
testId: 'email-12345678',
|
|
7
|
-
hasSuggestions: false
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export const stateProps = {
|
|
11
|
-
value: '.EmailSample',
|
|
12
|
-
hasSuggestions: false
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export const fieldMetadata = {
|
|
16
|
-
classID: 'DIXL-MediaCo-Work-NewService',
|
|
17
|
-
type: 'Text',
|
|
18
|
-
maxLength: 256,
|
|
19
|
-
displayAs: 'pxEmail',
|
|
20
|
-
label: 'Email sample',
|
|
21
|
-
validateAs: 'ValidEmailAddress'
|
|
22
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export const configProps = {
|
|
2
|
-
value: '',
|
|
3
|
-
label: 'TextInput Sample',
|
|
4
|
-
placeholder: 'TextInput Placeholder',
|
|
5
|
-
helperText: 'TextInput Helper Text',
|
|
6
|
-
testId: 'TextInput-12345678',
|
|
7
|
-
hasSuggestions: false
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export const stateProps = {
|
|
11
|
-
value: '.TextInputSample',
|
|
12
|
-
hasSuggestions: false
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export const fieldMetadata = {
|
|
16
|
-
classID: 'DIXL-MediaCo-Work-NewService',
|
|
17
|
-
type: 'Text',
|
|
18
|
-
maxLength: 256,
|
|
19
|
-
displayAs: 'pxTextInput',
|
|
20
|
-
label: 'TextInput Sample'
|
|
21
|
-
};
|
package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/mock.stories.js.mustache
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export const configProps = {
|
|
2
|
-
value: '',
|
|
3
|
-
label: 'Paragraph Sample',
|
|
4
|
-
placeholder: 'Paragraph Placeholder',
|
|
5
|
-
helperText: 'Paragraph Helper Text',
|
|
6
|
-
testId: 'paragraph-12345678',
|
|
7
|
-
hasSuggestions: false
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export const fieldMetadata = {
|
|
11
|
-
classID: 'DIXL-MediaCo-Work-NewService',
|
|
12
|
-
type: 'Text',
|
|
13
|
-
displayAs: 'pxTextArea',
|
|
14
|
-
label: 'Paragraph sample'
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export const stateProps = {
|
|
18
|
-
value: '.ParagraphSample',
|
|
19
|
-
hasSuggestions: false
|
|
20
|
-
};
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
export const configProps = {
|
|
2
|
-
value: '',
|
|
3
|
-
label: 'Phone Sample',
|
|
4
|
-
datasource: {
|
|
5
|
-
source: [
|
|
6
|
-
{
|
|
7
|
-
value: '+1'
|
|
8
|
-
},
|
|
9
|
-
{
|
|
10
|
-
value: '+91'
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
value: '+48'
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
value: '+44'
|
|
17
|
-
}
|
|
18
|
-
],
|
|
19
|
-
fields: {}
|
|
20
|
-
},
|
|
21
|
-
showCountryCode: true,
|
|
22
|
-
placeholder: 'Phone Placeholder',
|
|
23
|
-
helperText: 'Phone Helper Text',
|
|
24
|
-
testId: 'phone-12345678',
|
|
25
|
-
hasSuggestions: false
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export const stateProps = {
|
|
29
|
-
value: '.PhoneSample',
|
|
30
|
-
datasource: {
|
|
31
|
-
source: 'D_pyCountryCallingCodeList.pxResults',
|
|
32
|
-
fields: {
|
|
33
|
-
value: '.pyCallingCode'
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
hasSuggestions: false
|
|
37
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export const configProps = {
|
|
2
|
-
value: '',
|
|
3
|
-
label: 'URL Sample',
|
|
4
|
-
placeholder: 'URL Placeholder',
|
|
5
|
-
helperText: 'URL Helper Text',
|
|
6
|
-
testId: 'url-12345678',
|
|
7
|
-
hasSuggestions: false
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export const fieldMetadata = {
|
|
11
|
-
classID: 'DIXL-MediaCo-Work-NewService',
|
|
12
|
-
type: 'Text',
|
|
13
|
-
maxLength: 256,
|
|
14
|
-
displayAs: 'pxURL',
|
|
15
|
-
label: 'URL sample',
|
|
16
|
-
validateAs: 'pxIsValidURL'
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export const stateProps = {
|
|
20
|
-
value: '.URLSample',
|
|
21
|
-
hasSuggestions: false
|
|
22
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export const configProps = {
|
|
2
|
-
value: '13:30',
|
|
3
|
-
validatemessage: '',
|
|
4
|
-
label: 'TimeOfDay Label',
|
|
5
|
-
hideLabel: false,
|
|
6
|
-
helperText: 'TimeOfDay helper text',
|
|
7
|
-
withSeconds: false,
|
|
8
|
-
testId: '12345678',
|
|
9
|
-
additionalProps: {},
|
|
10
|
-
displayMode: '',
|
|
11
|
-
variant: '',
|
|
12
|
-
hasSuggestions: false,
|
|
13
|
-
readOnly: false,
|
|
14
|
-
required: false,
|
|
15
|
-
disabled: false
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export const stateProps = {
|
|
19
|
-
value: '.TimeOfDayLabel'
|
|
20
|
-
};
|