@pega/custom-dx-components 0.0.1 → 0.23.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/.vscode/extensions.json +1 -1
- package/README.md +6 -189
- package/package.json +34 -32
- package/src/auth.js +608 -0
- package/src/cli.js +42 -0
- package/src/constants.js +125 -8
- package/src/tasks/authenticate/helper.js +91 -8
- package/src/tasks/authenticate/index.js +169 -49
- package/src/tasks/build/helper.js +122 -0
- package/src/tasks/build/index.js +54 -0
- package/src/tasks/build-all/helper.js +70 -0
- package/src/tasks/build-all/index.js +79 -0
- package/src/tasks/{publish/bundle → bundle}/builder/index.js +49 -5
- package/src/tasks/{publish/bundle → bundle}/builder/webpack.config.js +5 -3
- package/src/tasks/{publish/bundle → bundle}/index.js +2 -2
- package/src/tasks/create/index.js +87 -64
- package/src/tasks/create/templates/Constellation/Field/Boolean/Boolean.js.mustache +38 -0
- package/src/tasks/create/templates/Constellation/Field/Boolean/boolean-format.js.mustache +26 -0
- package/src/tasks/create/templates/Constellation/Field/Boolean/config.json.mustache +146 -0
- package/src/tasks/create/templates/Constellation/Field/Boolean/demo.stories.jsx.mustache +61 -0
- package/src/tasks/create/templates/Constellation/Field/Boolean/event-utils.js.mustache +18 -0
- package/src/tasks/create/templates/Constellation/Field/Boolean/index.jsx.mustache +170 -0
- package/src/tasks/create/templates/Constellation/Field/Boolean/mock.stories.js.mustache +21 -0
- package/src/tasks/create/templates/Constellation/Field/Boolean/styles.js.mustache +7 -0
- package/src/tasks/create/templates/Constellation/Field/Date/DateFormatter.js.mustache +61 -0
- package/src/tasks/create/templates/Constellation/Field/Date/FormattedText.jsx.mustache +41 -0
- package/src/tasks/create/templates/Constellation/Field/Date/config.json.mustache +196 -0
- package/src/tasks/create/templates/Constellation/Field/Date/date.js.mustache +439 -0
- package/src/tasks/create/templates/Constellation/Field/Date/demo.stories.jsx.mustache +73 -0
- package/src/tasks/create/templates/Constellation/Field/Date/index.jsx.mustache +256 -0
- package/src/tasks/create/templates/Constellation/Field/Date/mock.stories.js.mustache +23 -0
- package/src/tasks/create/templates/Constellation/Field/Date/styles.js.mustache +7 -0
- package/src/tasks/create/templates/Constellation/Field/Date/suggestions-handler.js +10 -0
- package/src/tasks/create/templates/Constellation/Field/DateTime/config.json.mustache +257 -0
- package/src/tasks/create/templates/Constellation/Field/DateTime/date-time.js.mustache +92 -0
- package/src/tasks/create/templates/Constellation/Field/DateTime/date-utils.js.mustache +287 -0
- package/src/tasks/create/templates/Constellation/Field/DateTime/date.js.mustache +328 -0
- package/src/tasks/create/templates/Constellation/Field/DateTime/demo.stories.jsx.mustache +73 -0
- package/src/tasks/create/templates/Constellation/Field/DateTime/index.jsx.mustache +254 -0
- package/src/tasks/create/templates/Constellation/Field/DateTime/mock.stories.js.mustache +23 -0
- package/src/tasks/create/templates/Constellation/Field/DateTime/styles.js.mustache +7 -0
- package/src/tasks/create/templates/Constellation/Field/DateTime/suggestions-handler.js +10 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal/config.json.mustache +279 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal/demo.stories.jsx.mustache +49 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal/event-utils.js.mustache +18 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal/index.jsx.mustache +273 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal/mock.stories.js.mustache +21 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal/styles.js.mustache +7 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal/suggestions-handler.js +10 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/config.json.mustache +292 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/demo.stories.jsx.mustache +53 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/event-utils.js.mustache +18 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/index.jsx.mustache +299 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/mock.stories.js.mustache +23 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/styles.js.mustache +7 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/suggestions-handler.js +10 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/config.json.mustache +94 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/demo.stories.jsx.mustache +49 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/event-utils.js.mustache +18 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/index.jsx.mustache +281 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/mock.stories.js.mustache +21 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/styles.js.mustache +7 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/suggestions-handler.js +10 -0
- package/src/tasks/create/templates/Constellation/Field/Integer/config.json.mustache +348 -0
- package/src/tasks/create/templates/Constellation/Field/Integer/demo.stories.jsx.mustache +49 -0
- package/src/tasks/create/templates/Constellation/Field/Integer/event-utils.js.mustache +18 -0
- package/src/tasks/create/templates/Constellation/Field/Integer/index.jsx.mustache +336 -0
- package/src/tasks/create/templates/Constellation/Field/Integer/mock.stories.js.mustache +21 -0
- package/src/tasks/create/templates/Constellation/Field/Integer/styles.js.mustache +7 -0
- package/src/tasks/create/templates/Constellation/Field/Integer/suggestions-handler.js +10 -0
- package/src/tasks/create/templates/Constellation/Field/Picklist/config.json.mustache +115 -0
- package/src/tasks/create/templates/Constellation/Field/Picklist/demo.stories.jsx.mustache +78 -0
- package/src/tasks/create/templates/Constellation/Field/Picklist/event-utils.js.mustache +18 -0
- package/src/tasks/create/templates/Constellation/Field/Picklist/index.jsx.mustache +351 -0
- package/src/tasks/create/templates/Constellation/Field/Picklist/mock.stories.js.mustache +67 -0
- package/src/tasks/create/templates/Constellation/Field/Picklist/styles.js.mustache +7 -0
- package/src/tasks/create/templates/Constellation/Field/Picklist/suggestions-handler.js +10 -0
- package/src/tasks/create/{template → templates/Constellation/Field/Text}/config.json.mustache +15 -5
- package/src/tasks/create/templates/Constellation/Field/Text/demo.stories.jsx.mustache +51 -0
- package/src/tasks/create/{template → templates/Constellation/Field/Text}/index.jsx.mustache +5 -0
- package/src/tasks/create/templates/Constellation/Field/Text/mock.stories.js.mustache +13 -0
- package/src/tasks/create/templates/Constellation/Field/Text/styles.js.mustache +7 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Email/config.json.mustache +112 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Email/demo.stories.jsx.mustache +48 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Email/event-utils.js.mustache +18 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Email/index.jsx.mustache +231 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Email/mock.stories.js.mustache +22 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Email/styles.js.mustache +7 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Email/suggestions-handler.js +10 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Input/StatusWork.jsx +26 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Input/config.json.mustache +112 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Input/demo.stories.jsx.mustache +48 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Input/event-utils.js.mustache +18 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Input/index.jsx.mustache +239 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Input/mock.stories.js.mustache +21 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Input/styles.js.mustache +7 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Input/suggestions-handler.js +10 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/config.json.mustache +112 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/demo.stories.jsx.mustache +48 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/event-utils.js.mustache +18 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/index.jsx.mustache +231 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/mock.stories.js.mustache +20 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/styles.js.mustache +7 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/suggestions-handler.js +10 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Phone/config.json.mustache +124 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Phone/demo.stories.jsx.mustache +46 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Phone/event-utils.js.mustache +18 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Phone/index.jsx.mustache +267 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Phone/mock.stories.js.mustache +37 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Phone/styles.js.mustache +7 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Phone/suggestions-handler.js +10 -0
- package/src/tasks/create/templates/Constellation/Field/Text-URL/config.json.mustache +238 -0
- package/src/tasks/create/templates/Constellation/Field/Text-URL/demo.stories.jsx.mustache +46 -0
- package/src/tasks/create/templates/Constellation/Field/Text-URL/event-utils.js.mustache +18 -0
- package/src/tasks/create/templates/Constellation/Field/Text-URL/index.jsx.mustache +232 -0
- package/src/tasks/create/templates/Constellation/Field/Text-URL/mock.stories.js.mustache +22 -0
- package/src/tasks/create/templates/Constellation/Field/Text-URL/styles.js.mustache +7 -0
- package/src/tasks/create/templates/Constellation/Field/Text-URL/suggestions-handler.js +10 -0
- package/src/tasks/create/templates/Constellation/Field/Text-URL/text-url.jsx.mustache +173 -0
- package/src/tasks/create/templates/Constellation/Field/TimeOfDay/config.json.mustache +186 -0
- package/src/tasks/create/templates/Constellation/Field/TimeOfDay/demo.stories.jsx.mustache +57 -0
- package/src/tasks/create/templates/Constellation/Field/TimeOfDay/index.jsx.mustache +213 -0
- package/src/tasks/create/templates/Constellation/Field/TimeOfDay/mock.stories.js.mustache +20 -0
- package/src/tasks/create/templates/Constellation/Field/TimeOfDay/styles.js.mustache +7 -0
- package/src/tasks/create/templates/Constellation/Field/TimeOfDay/suggestions-handler.js +10 -0
- package/src/tasks/create/templates/Constellation/Field/TimeOfDay/time-of-day.js.mustache +287 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS/OneColumnDetails.svg +22 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS/StatusWork.jsx.mustache +26 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS/config.json.mustache +36 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS/demo.stories.jsx.mustache +132 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS/index.jsx.mustache +86 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS/mock.stories.js.mustache +189 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS/styles.js.mustache +7 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS/utils.js.mustache +152 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/StatusWork.jsx.mustache +26 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/TwoColumnDetails.svg +28 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/config.json.mustache +43 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/demo.stories.jsx.mustache +136 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/index.jsx.mustache +86 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/mock.stories.js.mustache +230 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/styles.js.mustache +7 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/utils.js.mustache +155 -0
- package/src/tasks/create/templates/Constellation/Template/FORM/DefaultForm.svg +29 -0
- package/src/tasks/create/templates/Constellation/Template/FORM/config.json.mustache +46 -0
- package/src/tasks/create/templates/Constellation/Template/FORM/demo.stories.jsx.mustache +169 -0
- package/src/tasks/create/templates/Constellation/Template/FORM/index.jsx.mustache +45 -0
- package/src/tasks/create/templates/Constellation/Template/FORM/mock.stories.js.mustache +137 -0
- package/src/tasks/create/templates/Constellation/Template/FORM/styles.js.mustache +7 -0
- package/src/tasks/create/templates/Constellation/Template/FORM-region/TwoColumn.svg +38 -0
- package/src/tasks/create/templates/Constellation/Template/FORM-region/config.json.mustache +28 -0
- package/src/tasks/create/templates/Constellation/Template/FORM-region/demo.stories.jsx.mustache +178 -0
- package/src/tasks/create/templates/Constellation/Template/FORM-region/index.jsx.mustache +48 -0
- package/src/tasks/create/templates/Constellation/Template/FORM-region/mock.stories.js.mustache +143 -0
- package/src/tasks/create/templates/Constellation/Template/FORM-region/styles.js.mustache +7 -0
- package/src/tasks/create/templates/Constellation/Template/PAGE/GetNextWork.jsx.mustache +35 -0
- package/src/tasks/create/templates/Constellation/Template/PAGE/OneColumnPage.svg +36 -0
- package/src/tasks/create/templates/Constellation/Template/PAGE/config.json.mustache +33 -0
- package/src/tasks/create/templates/Constellation/Template/PAGE/demo.stories.jsx.mustache +102 -0
- package/src/tasks/create/templates/Constellation/Template/PAGE/index.jsx.mustache +70 -0
- package/src/tasks/create/templates/Constellation/Template/PAGE/localizations.json.mustache +4 -0
- package/src/tasks/create/templates/Constellation/Template/PAGE/mock.stories.js.mustache +94 -0
- package/src/tasks/create/templates/Constellation/Template/PAGE/styles.js.mustache +7 -0
- package/src/tasks/create/templates/Constellation/Template/PAGE/utils.js.mustache +229 -0
- package/src/tasks/create/templates/Constellation/Widget/CASE/OneColumnPage.svg +36 -0
- package/src/tasks/create/templates/Constellation/Widget/CASE/config.json.mustache +24 -0
- package/src/tasks/create/templates/Constellation/Widget/CASE/demo.stories.jsx.mustache +78 -0
- package/src/tasks/create/templates/Constellation/Widget/CASE/index.jsx.mustache +76 -0
- package/src/tasks/create/templates/Constellation/Widget/CASE/mock.stories.js.mustache +390 -0
- package/src/tasks/create/{template → templates/Constellation/Widget/CASE}/styles.js.mustache +1 -1
- package/src/tasks/create/templates/Constellation/Widget/PAGE/OneColumnPage.svg +36 -0
- package/src/tasks/create/templates/Constellation/Widget/PAGE/config.json.mustache +60 -0
- package/src/tasks/create/templates/Constellation/Widget/PAGE/demo.stories.jsx.mustache +30 -0
- package/src/tasks/create/templates/Constellation/Widget/PAGE/index.jsx.mustache +48 -0
- package/src/tasks/create/templates/Constellation/Widget/PAGE/mock.stories.js.mustache +23 -0
- package/src/tasks/{init/template/src/components/Organization_Library_VideoPlayer/styles.js → create/templates/Constellation/Widget/PAGE/styles.js.mustache} +3 -1
- package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/Avatar.jsx.mustache +75 -0
- package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/OneColumnPage.svg +36 -0
- package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/Operator.jsx.mustache +240 -0
- package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/config.json.mustache +67 -0
- package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/demo.stories.jsx.mustache +68 -0
- package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/index.jsx.mustache +110 -0
- package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/mock.stories.js.mustache +51 -0
- package/src/tasks/{init/template/src/components/Organization_Library_MediaURL/MediaURL.styles.ts → create/templates/Constellation/Widget/PAGE-CASE/styles.js.mustache} +3 -1
- package/src/tasks/create-all/index.js +398 -0
- package/src/tasks/delete/helper.js +6 -4
- package/src/tasks/delete/index.js +4 -0
- package/src/tasks/delete-all/helper.js +153 -0
- package/src/tasks/delete-all/index.js +49 -0
- package/src/tasks/generate-ai/aiPrompt.txt.mustache +23 -0
- package/src/tasks/generate-ai/aiPromptDavinci.txt.mustache +14 -0
- package/src/tasks/generate-ai/helper.js +357 -0
- package/src/tasks/generate-ai/index.js +34 -0
- package/src/tasks/index.js +7 -0
- package/src/tasks/init/index.js +9 -3
- package/src/tasks/init/template/.eslintignore +8 -0
- package/src/tasks/init/template/.eslintrc.json +186 -5
- package/src/tasks/init/template/.vscode/extensions.json +1 -1
- package/src/tasks/init/template/README.md +80 -61
- package/src/tasks/init/template/keys/DX-ComponentDev.zip +0 -0
- package/src/tasks/init/template/keys/dxcb.crt +32 -0
- package/src/tasks/init/template/keys/dxcb.key +51 -0
- package/src/tasks/init/template/package.json.mustache +44 -21
- package/src/tasks/init/template/src/components/_components.md +1 -0
- package/src/tasks/init/template/tasks.config.json +19 -5
- package/src/tasks/init/template/templateNPMRC.txt +8 -0
- package/src/tasks/linter/index.js +46 -0
- package/src/tasks/list/helper.js +19 -6
- package/src/tasks/list/index.js +4 -0
- package/src/tasks/publish/helper.js +13 -4
- package/src/tasks/publish/index.js +14 -1
- package/src/tasks/publish-all/helper.js +154 -0
- package/src/tasks/publish-all/index.js +95 -0
- package/src/tasks/rename/index.js +314 -0
- package/src/tasks/validator/index.js +291 -18
- package/src/util.js +372 -6
- package/src/tasks/create/template/demo.stories.jsx.mustache +0 -44
- package/src/tasks/init/template/src/components/MBTAList/MBTAList.stories.tsx +0 -10
- package/src/tasks/init/template/src/components/MBTAList/MBTAList.tsx +0 -122
- package/src/tasks/init/template/src/components/MBTAList/icons/accessible.icon.tsx +0 -14
- package/src/tasks/init/template/src/components/MBTAList/icons/bus.icon.tsx +0 -13
- package/src/tasks/init/template/src/components/MBTAList/icons/mbta.icon.tsx +0 -10
- package/src/tasks/init/template/src/components/MBTAList/icons/subway.icon.tsx +0 -14
- package/src/tasks/init/template/src/components/MBTAList/index.ts +0 -2
- package/src/tasks/init/template/src/components/Organization_Library_MediaURL/MediaURL.stories.tsx +0 -19
- package/src/tasks/init/template/src/components/Organization_Library_MediaURL/MediaURL.types.ts +0 -10
- package/src/tasks/init/template/src/components/Organization_Library_MediaURL/MediaURLDisplay.tsx +0 -25
- package/src/tasks/init/template/src/components/Organization_Library_MediaURL/MediaURLInput.tsx +0 -24
- package/src/tasks/init/template/src/components/Organization_Library_MediaURL/config.json +0 -13
- package/src/tasks/init/template/src/components/Organization_Library_MediaURL/index.ts +0 -2
- package/src/tasks/init/template/src/components/Organization_Library_VideoPlayer/config.json +0 -44
- package/src/tasks/init/template/src/components/Organization_Library_VideoPlayer/demo.stories.jsx +0 -40
- package/src/tasks/init/template/src/components/Organization_Library_VideoPlayer/index.jsx +0 -42
- /package/src/tasks/{publish/bundle → bundle}/builder/modules.js +0 -0
- /package/src/tasks/{publish/bundle → bundle}/builder/paths.js +0 -0
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
import { useState, useEffect, useRef } from 'react';
|
|
2
|
+
import { Select, Option, FieldValueList, Text } from '@pega/cosmos-react-core';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
|
|
5
|
+
// includes in bundle
|
|
6
|
+
import handleEvent from "./event-utils";
|
|
7
|
+
import { suggestionsHandler } from './suggestions-handler';
|
|
8
|
+
|
|
9
|
+
import Styled{{COMPONENT_CLASS_NAME}}Wrapper from './styles';
|
|
10
|
+
import {EmailDisplay, PhoneDisplay, URLDisplay } from "@pega/cosmos-react-core";
|
|
11
|
+
|
|
12
|
+
export const formatExists = (formatterVal) => {
|
|
13
|
+
const formatterValues = [
|
|
14
|
+
"TextInput",
|
|
15
|
+
"WorkStatus",
|
|
16
|
+
"RichText",
|
|
17
|
+
"Email",
|
|
18
|
+
"Phone",
|
|
19
|
+
"URL",
|
|
20
|
+
"Operator"
|
|
21
|
+
];
|
|
22
|
+
let isformatter = false;
|
|
23
|
+
if (formatterValues.includes(formatterVal)) {
|
|
24
|
+
isformatter = true;
|
|
25
|
+
}
|
|
26
|
+
return isformatter;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
export const textFormatter = (formatter,value) => {
|
|
31
|
+
let displayComponent = null;
|
|
32
|
+
switch(formatter){
|
|
33
|
+
case "TextInput" : {
|
|
34
|
+
displayComponent = value;
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
case "Email" : {
|
|
38
|
+
displayComponent = (<EmailDisplay value={value} displayText={value} variant="link" />);
|
|
39
|
+
break;
|
|
40
|
+
}
|
|
41
|
+
case "Phone" : {
|
|
42
|
+
displayComponent = (<PhoneDisplay value={value} variant="link" />);
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
case "URL" : {
|
|
46
|
+
displayComponent = (<URLDisplay target="_blank" value={value} displayText={value} variant="link" />);
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
// no default
|
|
50
|
+
}
|
|
51
|
+
return displayComponent;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
export const setDefaultValue = (dropdownOptions, pConnect, propName) => {
|
|
56
|
+
// calculate the default option and set it to dropdown
|
|
57
|
+
const option = (dropdownOptions && dropdownOptions[0]) || {};
|
|
58
|
+
const defaultValue = option.key ? option.props.value : '';
|
|
59
|
+
pConnect.setValue(propName, defaultValue, defaultValue);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const pushPlaceholderOption = (placeholder, listSourceItems, items, pConnect) => {
|
|
63
|
+
// If we have a placeholder, push that option in the list of items
|
|
64
|
+
if (placeholder) {
|
|
65
|
+
items.push(
|
|
66
|
+
<Option key={placeholder} value=''>
|
|
67
|
+
{pConnect.getLocalizedValue(placeholder)}
|
|
68
|
+
</Option>
|
|
69
|
+
);
|
|
70
|
+
} else if (!listSourceItems) {
|
|
71
|
+
// If we don't have a placeholder and our list source is empty, push a blank row option in the list of items
|
|
72
|
+
items.push(<Option key='' value='' />);
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
// Duplicated runtime code from Constellation Design System Component
|
|
78
|
+
|
|
79
|
+
// props passed in combination of props from property panel (config.json) and run time props from Constellation
|
|
80
|
+
// any default values in config.pros should be set in defaultProps at bottom of this file
|
|
81
|
+
const {{COMPONENT_CLASS_NAME}} = props => {
|
|
82
|
+
const {
|
|
83
|
+
getPConnect,
|
|
84
|
+
value,
|
|
85
|
+
label,
|
|
86
|
+
hideLabel,
|
|
87
|
+
placeholder,
|
|
88
|
+
datasource,
|
|
89
|
+
listType,
|
|
90
|
+
validatemessage,
|
|
91
|
+
testId,
|
|
92
|
+
helperText,
|
|
93
|
+
additionalProps,
|
|
94
|
+
displayMode,
|
|
95
|
+
onRecordChange,
|
|
96
|
+
variant,
|
|
97
|
+
fieldMetadata,
|
|
98
|
+
isTableFormatter,
|
|
99
|
+
hasSuggestions
|
|
100
|
+
} = props;
|
|
101
|
+
const { formatter } = props;
|
|
102
|
+
const pConnect = getPConnect();
|
|
103
|
+
const actions = pConnect.getActionsApi();
|
|
104
|
+
const propName = pConnect.getStateProps().value;
|
|
105
|
+
const className = pConnect.getCaseInfo().getClassName();
|
|
106
|
+
const refName = propName?.slice(propName.lastIndexOf('.') + 1);
|
|
107
|
+
|
|
108
|
+
let { readOnly, required, disabled } = props;
|
|
109
|
+
[readOnly, required, disabled] = [readOnly, required, disabled].map(
|
|
110
|
+
(prop) => prop === true || (typeof prop === 'string' && prop === 'true')
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
const [status, setStatus] = useState(hasSuggestions ? 'pending' : undefined);
|
|
114
|
+
|
|
115
|
+
const useIsMount = () => {
|
|
116
|
+
const isMountRef = useRef(true);
|
|
117
|
+
useEffect(() => {
|
|
118
|
+
isMountRef.current = false;
|
|
119
|
+
}, []);
|
|
120
|
+
return isMountRef.current;
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
const isMount = useIsMount();
|
|
124
|
+
|
|
125
|
+
const metaData = Array.isArray(fieldMetadata)
|
|
126
|
+
? fieldMetadata.filter((field) => field?.classID === className)[0]
|
|
127
|
+
: fieldMetadata;
|
|
128
|
+
let displayName = metaData?.datasource?.propertyForDisplayText;
|
|
129
|
+
displayName = displayName?.slice(displayName.lastIndexOf('.') + 1);
|
|
130
|
+
const localeContext = metaData?.datasource?.tableType === 'DataPage' ? 'datapage' : 'associated';
|
|
131
|
+
const localeClass = localeContext === 'datapage' ? '@baseclass' : className;
|
|
132
|
+
const localeName = localeContext === 'datapage' ? metaData?.datasource?.name : refName;
|
|
133
|
+
const localePath = localeContext === 'datapage' ? displayName : '';
|
|
134
|
+
|
|
135
|
+
const configProps = pConnect.getConfigProps();
|
|
136
|
+
const items = [];
|
|
137
|
+
const isDatapage = listType === 'datapage';
|
|
138
|
+
let listSourceItems = isDatapage ? configProps.listOutput : datasource;
|
|
139
|
+
|
|
140
|
+
if (isDatapage && typeof datasource === 'object' && !Array.isArray(listSourceItems)) {
|
|
141
|
+
listSourceItems = datasource.source ? datasource.source : [];
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
useEffect(() => {
|
|
145
|
+
if (validatemessage !== '') {
|
|
146
|
+
setStatus('error');
|
|
147
|
+
}
|
|
148
|
+
if (hasSuggestions) {
|
|
149
|
+
setStatus('pending');
|
|
150
|
+
} else if (!hasSuggestions && status !== 'success') {
|
|
151
|
+
setStatus(validatemessage !== '' ? 'error' : undefined);
|
|
152
|
+
}
|
|
153
|
+
}, [validatemessage, hasSuggestions]);
|
|
154
|
+
|
|
155
|
+
pushPlaceholderOption(placeholder, listSourceItems, items, pConnect);
|
|
156
|
+
|
|
157
|
+
// Loop through all of our list source items that make up the values of the dropdown
|
|
158
|
+
|
|
159
|
+
let selectedLabel = '';
|
|
160
|
+
(listSourceItems || []).forEach((item) => {
|
|
161
|
+
selectedLabel =
|
|
162
|
+
value !== undefined &&
|
|
163
|
+
value !== null &&
|
|
164
|
+
item.key !== undefined &&
|
|
165
|
+
item.key !== null &&
|
|
166
|
+
value.toString() === item.key.toString()
|
|
167
|
+
? item.text || item.value
|
|
168
|
+
: selectedLabel;
|
|
169
|
+
items.push(
|
|
170
|
+
<Option key={item.key} value={item.key}>
|
|
171
|
+
{isDatapage
|
|
172
|
+
? pConnect.getLocalizedValue(
|
|
173
|
+
item.text,
|
|
174
|
+
localePath,
|
|
175
|
+
pConnect.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName)
|
|
176
|
+
)
|
|
177
|
+
: pConnect.getLocalizedValue(
|
|
178
|
+
item.value,
|
|
179
|
+
localePath,
|
|
180
|
+
pConnect.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName)
|
|
181
|
+
)}
|
|
182
|
+
</Option>
|
|
183
|
+
);
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
const isDisplayModeEnabled =
|
|
187
|
+
displayMode === 'LABELS_LEFT' || displayMode === 'STACKED_LARGE_VAL' || displayMode === 'DISPLAY_ONLY';
|
|
188
|
+
let firstOptionKey = '';
|
|
189
|
+
let firstOptionValue = '';
|
|
190
|
+
if (!placeholder && listSourceItems?.length > 0) {
|
|
191
|
+
// First option isn't going to change as long as placeholder is present. Incase placeholder is not there
|
|
192
|
+
// check for new option
|
|
193
|
+
firstOptionKey = listSourceItems[0].key;
|
|
194
|
+
firstOptionValue = listSourceItems[0].text || listSourceItems[0].value;
|
|
195
|
+
}
|
|
196
|
+
useEffect(() => {
|
|
197
|
+
// placeholder - placeholder option configured to be shown with dropdown, empty string if not configured
|
|
198
|
+
// value - value of the dropdown if set to something prior (either by pre-activity or default value etc.), empty string if nothing is set
|
|
199
|
+
// selectedLabel - is value(the one above) if it is one of the option in the dropdown datasource, empty string if not
|
|
200
|
+
// below code does this -
|
|
201
|
+
// set dropdown value to first option if placeholder is NOT present and ((value is empty) or (value is not empty and selectedLabel is empty))
|
|
202
|
+
// set dropdown value to empty if placeholder is present and value is not empty and selectedLabel is empty
|
|
203
|
+
// Broken down first option(key, value) to be as dependency instead of entire items array which creates new reference on every render
|
|
204
|
+
// First option is kept as dependency as setDefaultValue sets only first value from options
|
|
205
|
+
if (!isDisplayModeEnabled && ((!placeholder && !value) || (!isMount && value && !selectedLabel))) {
|
|
206
|
+
setDefaultValue(items, pConnect, propName);
|
|
207
|
+
}
|
|
208
|
+
}, [firstOptionKey, firstOptionValue, placeholder, selectedLabel, value, propName]);
|
|
209
|
+
|
|
210
|
+
if (displayMode === 'LABELS_LEFT' || displayMode === 'DISPLAY_ONLY') {
|
|
211
|
+
let displayComp = selectedLabel;
|
|
212
|
+
if (isTableFormatter && formatExists(formatter)) {
|
|
213
|
+
displayComp = textFormatter(formatter, selectedLabel);
|
|
214
|
+
}
|
|
215
|
+
if (selectedLabel === '') {
|
|
216
|
+
displayComp = value || <span aria-hidden='true'>––</span>;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
return displayMode === 'DISPLAY_ONLY' ? (
|
|
220
|
+
<Styled{{COMPONENT_CLASS_NAME}}Wrapper>
|
|
221
|
+
displayComp
|
|
222
|
+
</Styled{{COMPONENT_CLASS_NAME}}Wrapper>
|
|
223
|
+
) : (
|
|
224
|
+
<Styled{{COMPONENT_CLASS_NAME}}Wrapper>
|
|
225
|
+
<FieldValueList
|
|
226
|
+
variant={hideLabel ? 'stacked' : variant}
|
|
227
|
+
data-testid={testId}
|
|
228
|
+
fields={[
|
|
229
|
+
{
|
|
230
|
+
id: '1',
|
|
231
|
+
name: hideLabel ? '' : label,
|
|
232
|
+
value: displayComp
|
|
233
|
+
}
|
|
234
|
+
]}
|
|
235
|
+
/>
|
|
236
|
+
</Styled{{COMPONENT_CLASS_NAME}}Wrapper>
|
|
237
|
+
);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
if (displayMode === 'STACKED_LARGE_VAL') {
|
|
241
|
+
selectedLabel = selectedLabel === '' ? value : selectedLabel;
|
|
242
|
+
const isValDefined = typeof selectedLabel !== 'undefined' && selectedLabel !== '';
|
|
243
|
+
const val = isValDefined ? (
|
|
244
|
+
<Text variant='h1' as='span'>
|
|
245
|
+
{selectedLabel}
|
|
246
|
+
</Text>
|
|
247
|
+
) : (
|
|
248
|
+
''
|
|
249
|
+
);
|
|
250
|
+
return (
|
|
251
|
+
<Styled{{COMPONENT_CLASS_NAME}}Wrapper>
|
|
252
|
+
<FieldValueList
|
|
253
|
+
variant='stacked'
|
|
254
|
+
data-testid={testId}
|
|
255
|
+
fields={[{ id: '2', name: hideLabel ? '' : label, value: val }]}
|
|
256
|
+
/>
|
|
257
|
+
</Styled{{COMPONENT_CLASS_NAME}}Wrapper>
|
|
258
|
+
);
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
const onResolveSuggestionHandler = (accepted) => {
|
|
262
|
+
suggestionsHandler(accepted, pConnect, setStatus);
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
return (
|
|
266
|
+
<Styled{{COMPONENT_CLASS_NAME}}Wrapper>
|
|
267
|
+
<Select
|
|
268
|
+
{...additionalProps}
|
|
269
|
+
label={label}
|
|
270
|
+
labelHidden={hideLabel}
|
|
271
|
+
info={validatemessage || helperText}
|
|
272
|
+
status={status}
|
|
273
|
+
data-testid={testId}
|
|
274
|
+
key={getPConnect().getRawMetadata().config.value}
|
|
275
|
+
value={value}
|
|
276
|
+
disabled={disabled}
|
|
277
|
+
required={required}
|
|
278
|
+
readOnly={readOnly}
|
|
279
|
+
onChange={(event) => {
|
|
280
|
+
handleEvent(actions, 'changeNblur', propName, event.target.value);
|
|
281
|
+
if (hasSuggestions) {
|
|
282
|
+
pConnect.ignoreSuggestion();
|
|
283
|
+
setStatus(undefined);
|
|
284
|
+
}
|
|
285
|
+
if (onRecordChange) {
|
|
286
|
+
onRecordChange(event);
|
|
287
|
+
}
|
|
288
|
+
}}
|
|
289
|
+
onBlur={(event) => {
|
|
290
|
+
pConnect.getValidationApi().validate(event.target.value);
|
|
291
|
+
}}
|
|
292
|
+
onResolveSuggestion={onResolveSuggestionHandler}
|
|
293
|
+
>
|
|
294
|
+
{items}
|
|
295
|
+
</Select>
|
|
296
|
+
</Styled{{COMPONENT_CLASS_NAME}}Wrapper>
|
|
297
|
+
);
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
{{COMPONENT_CLASS_NAME}}.defaultProps = {
|
|
301
|
+
value: '',
|
|
302
|
+
placeholder: '',
|
|
303
|
+
validatemessage: '',
|
|
304
|
+
hideLabel: false,
|
|
305
|
+
disabled: false,
|
|
306
|
+
readOnly: false,
|
|
307
|
+
required: false,
|
|
308
|
+
testId: null,
|
|
309
|
+
helperText: '',
|
|
310
|
+
datasource: [],
|
|
311
|
+
listType: '',
|
|
312
|
+
additionalProps: {},
|
|
313
|
+
fieldMetadata: {},
|
|
314
|
+
displayMode: null,
|
|
315
|
+
onRecordChange: null,
|
|
316
|
+
variant: 'inline',
|
|
317
|
+
formatter: '',
|
|
318
|
+
isTableFormatter: false,
|
|
319
|
+
hasSuggestions: false
|
|
320
|
+
};
|
|
321
|
+
|
|
322
|
+
{{COMPONENT_CLASS_NAME}}.propTypes = {
|
|
323
|
+
getPConnect: PropTypes.func.isRequired,
|
|
324
|
+
value: PropTypes.string,
|
|
325
|
+
placeholder: PropTypes.string,
|
|
326
|
+
label: PropTypes.string.isRequired,
|
|
327
|
+
hideLabel: PropTypes.bool,
|
|
328
|
+
datasource: PropTypes.oneOfType([
|
|
329
|
+
PropTypes.arrayOf(PropTypes.any),
|
|
330
|
+
PropTypes.shape({
|
|
331
|
+
source: PropTypes.arrayOf(PropTypes.any)
|
|
332
|
+
})
|
|
333
|
+
]),
|
|
334
|
+
listType: PropTypes.string,
|
|
335
|
+
validatemessage: PropTypes.string,
|
|
336
|
+
disabled: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
|
|
337
|
+
readOnly: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
|
|
338
|
+
required: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
|
|
339
|
+
testId: PropTypes.string,
|
|
340
|
+
helperText: PropTypes.string,
|
|
341
|
+
additionalProps: PropTypes.objectOf(PropTypes.any),
|
|
342
|
+
fieldMetadata: PropTypes.objectOf(PropTypes.any),
|
|
343
|
+
displayMode: PropTypes.string,
|
|
344
|
+
onRecordChange: PropTypes.func,
|
|
345
|
+
variant: PropTypes.string,
|
|
346
|
+
formatter: PropTypes.string,
|
|
347
|
+
isTableFormatter: PropTypes.bool,
|
|
348
|
+
hasSuggestions: PropTypes.bool
|
|
349
|
+
};
|
|
350
|
+
|
|
351
|
+
export default {{COMPONENT_CLASS_NAME}};
|
|
@@ -0,0 +1,67 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/* eslint-disable import/prefer-default-export */
|
|
2
|
+
export const suggestionsHandler = (accepted, pConn, setStatus) => {
|
|
3
|
+
if (accepted) {
|
|
4
|
+
pConn.acceptSuggestion();
|
|
5
|
+
setStatus('success');
|
|
6
|
+
} else {
|
|
7
|
+
pConn.ignoreSuggestion();
|
|
8
|
+
setStatus(undefined);
|
|
9
|
+
}
|
|
10
|
+
};
|
package/src/tasks/create/{template → templates/Constellation/Field/Text}/config.json.mustache
RENAMED
|
@@ -7,17 +7,13 @@
|
|
|
7
7
|
"library": "{{LIBRARY}}",
|
|
8
8
|
"allowedApplications": {{{ALLOWEDAPPS}}},
|
|
9
9
|
"componentKey": "{{COMPONENT_KEY}}",
|
|
10
|
+
"compName" : "{{COMPONENT_CLASS_NAME}}",
|
|
10
11
|
"type": "{{TYPE}}",
|
|
11
12
|
"subtype": {{{SUB_TYPE}}},
|
|
12
13
|
{{#IS_TEMPLATE}}
|
|
13
14
|
"icon": "images/pz-text-input-active.svg",
|
|
14
15
|
{{/IS_TEMPLATE}}
|
|
15
16
|
"properties": [
|
|
16
|
-
{
|
|
17
|
-
"name": "value",
|
|
18
|
-
"label": "Property",
|
|
19
|
-
"format": "PROPERTY"
|
|
20
|
-
},
|
|
21
17
|
{
|
|
22
18
|
"name": "label",
|
|
23
19
|
"label": "Label value",
|
|
@@ -42,6 +38,20 @@
|
|
|
42
38
|
"name": "required",
|
|
43
39
|
"label": "Required",
|
|
44
40
|
"format": "REQUIRED"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"label": "Advanced",
|
|
44
|
+
"format": "GROUP",
|
|
45
|
+
"collapsible": true,
|
|
46
|
+
"properties": [
|
|
47
|
+
{
|
|
48
|
+
"name": "testId",
|
|
49
|
+
"label": "Test ID",
|
|
50
|
+
"format": "TEXT",
|
|
51
|
+
"ignorePattern": "[^-_\\p{N}\\p{L}]",
|
|
52
|
+
"includeAnnotations": false
|
|
53
|
+
}
|
|
54
|
+
]
|
|
45
55
|
}
|
|
46
56
|
],
|
|
47
57
|
"defaultConfig": {
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import { withKnobs } from '@storybook/addon-knobs';
|
|
3
|
+
|
|
4
|
+
import { stateProps, configProps } from './mock.stories';
|
|
5
|
+
|
|
6
|
+
import {{COMPONENT_CLASS_NAME}} from './index.jsx';
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
title: '{{COMPONENT_CLASS_NAME}}',
|
|
10
|
+
decorators: [withKnobs],
|
|
11
|
+
component: {{COMPONENT_CLASS_NAME}}
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const base{{COMPONENT_CLASS_NAME}} = () => {
|
|
15
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
16
|
+
const [value, setValue] = useState(configProps.value);
|
|
17
|
+
|
|
18
|
+
const props = {
|
|
19
|
+
value,
|
|
20
|
+
placeholder: configProps.placeholder,
|
|
21
|
+
label: configProps.label,
|
|
22
|
+
testId: configProps.testId,
|
|
23
|
+
hasSuggestions: configProps.hasSuggestions,
|
|
24
|
+
|
|
25
|
+
getPConnect: () => {
|
|
26
|
+
return {
|
|
27
|
+
getStateProps: () => {
|
|
28
|
+
return stateProps;
|
|
29
|
+
},
|
|
30
|
+
getActionsApi: () => {
|
|
31
|
+
return {
|
|
32
|
+
updateFieldValue: (propName, theValue) => {
|
|
33
|
+
setValue(theValue);
|
|
34
|
+
},
|
|
35
|
+
triggerFieldChange: () => {/* nothing */}
|
|
36
|
+
};
|
|
37
|
+
},
|
|
38
|
+
ignoreSuggestion: () => {/* nothing */},
|
|
39
|
+
acceptSuggestion: () => {/* nothing */},
|
|
40
|
+
setInheritedProps: () => {/* nothing */},
|
|
41
|
+
resolveConfigProps: () => {/* nothing */}
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<>
|
|
48
|
+
<{{COMPONENT_CLASS_NAME}} {...props} />
|
|
49
|
+
</>
|
|
50
|
+
);
|
|
51
|
+
};
|
|
@@ -3,6 +3,11 @@ import { Input, Label } from '@pega/cosmos-react-core';
|
|
|
3
3
|
|
|
4
4
|
import Styled{{COMPONENT_CLASS_NAME}}Wrapper from './styles';
|
|
5
5
|
|
|
6
|
+
|
|
7
|
+
// Duplicated runtime code from Constellation Design System Component
|
|
8
|
+
|
|
9
|
+
// props passed in combination of props from property panel (config.json) and run time props from Constellation
|
|
10
|
+
// any default values in config.pros should be set in defaultProps at bottom of this file
|
|
6
11
|
const {{COMPONENT_CLASS_NAME}} = props => {
|
|
7
12
|
const { getPConnect, value, placeholder, disabled, readOnly, required, label, testId } = props;
|
|
8
13
|
|
|
@@ -0,0 +1,13 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{COMPONENT_KEY}}",
|
|
3
|
+
"label": "{{COMPONENT_LABEL}}",
|
|
4
|
+
"description": "{{DESCRIPTION}}",
|
|
5
|
+
"organization": "{{ORGANIZATION}}",
|
|
6
|
+
"version": "{{VERSION}}",
|
|
7
|
+
"library": "{{LIBRARY}}",
|
|
8
|
+
"allowedApplications": {{{ALLOWEDAPPS}}},
|
|
9
|
+
"componentKey": "{{COMPONENT_KEY}}",
|
|
10
|
+
"compName" : "{{COMPONENT_CLASS_NAME}}",
|
|
11
|
+
"type": "{{TYPE}}",
|
|
12
|
+
"subtype": {{{SUB_TYPE}}},
|
|
13
|
+
"icon": "images/pz-email-active.svg",
|
|
14
|
+
"properties": [
|
|
15
|
+
{
|
|
16
|
+
"name": "label",
|
|
17
|
+
"label": "Field label",
|
|
18
|
+
"format": "TEXT",
|
|
19
|
+
"required": true
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"name": "readOnly",
|
|
23
|
+
"label": "Edit mode",
|
|
24
|
+
"format": "READONLY"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"label": "Column settings",
|
|
28
|
+
"format": "GROUP",
|
|
29
|
+
"visibility": "@VIEWTYPE == 'MultiRecordDisplayAsTable'",
|
|
30
|
+
"properties": [
|
|
31
|
+
{
|
|
32
|
+
"name": "columnWidth",
|
|
33
|
+
"label": "Column width",
|
|
34
|
+
"format": "SELECT",
|
|
35
|
+
"source": [
|
|
36
|
+
{
|
|
37
|
+
"key": "auto",
|
|
38
|
+
"value": "Auto"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"key": "custom",
|
|
42
|
+
"value": "Custom"
|
|
43
|
+
}
|
|
44
|
+
]
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"name": "width",
|
|
48
|
+
"label": "Width (px)",
|
|
49
|
+
"format": "NUMBER",
|
|
50
|
+
"visibility": "$this.columnWidth == 'custom'"
|
|
51
|
+
}
|
|
52
|
+
]
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"label": "Input settings",
|
|
56
|
+
"format": "GROUP",
|
|
57
|
+
"visibility": "(!readOnly = true)",
|
|
58
|
+
"properties": [
|
|
59
|
+
{
|
|
60
|
+
"name": "placeholder",
|
|
61
|
+
"label": "Placeholder",
|
|
62
|
+
"format": "TEXT"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"name": "helperText",
|
|
66
|
+
"label": "Helper text",
|
|
67
|
+
"format": "TEXT"
|
|
68
|
+
}
|
|
69
|
+
]
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"label": "Conditions",
|
|
73
|
+
"format": "GROUP",
|
|
74
|
+
"properties": [
|
|
75
|
+
{
|
|
76
|
+
"name": "required",
|
|
77
|
+
"label": "Required",
|
|
78
|
+
"format": "REQUIRED",
|
|
79
|
+
"visibility": "(!readOnly = true)"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"name": "disabled",
|
|
83
|
+
"label": "Disabled",
|
|
84
|
+
"format": "DISABLED",
|
|
85
|
+
"visibility": "(!readOnly = true)"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"name": "visibility",
|
|
89
|
+
"label": "Visibility",
|
|
90
|
+
"format": "VISIBILITY"
|
|
91
|
+
}
|
|
92
|
+
]
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"label": "Advanced",
|
|
96
|
+
"format": "GROUP",
|
|
97
|
+
"collapsible": true,
|
|
98
|
+
"properties": [
|
|
99
|
+
{
|
|
100
|
+
"name": "testId",
|
|
101
|
+
"label": "Test ID",
|
|
102
|
+
"format": "TEXT",
|
|
103
|
+
"ignorePattern": "[^-_\\p{N}\\p{L}]",
|
|
104
|
+
"includeAnnotations": false
|
|
105
|
+
}
|
|
106
|
+
]
|
|
107
|
+
}
|
|
108
|
+
],
|
|
109
|
+
"defaultConfig": {
|
|
110
|
+
"label": "@L $this.label"
|
|
111
|
+
}
|
|
112
|
+
}
|