@pega/dx-component-builder-sdk 0.1.0
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/.access_token +1 -0
- package/.agilestudio +3 -0
- package/.eslintrc.json +18 -0
- package/.prettierignore +2 -0
- package/.prettierrc.json +1 -0
- package/LICENSE +185 -0
- package/README.md +199 -0
- package/bin/index.js +5 -0
- package/cspell.json +26 -0
- package/package.json +67 -0
- package/src/cli.js +104 -0
- package/src/constants.js +134 -0
- package/src/tasks/authenticate/helper.js +60 -0
- package/src/tasks/authenticate/index.js +81 -0
- package/src/tasks/build/helper.js +125 -0
- package/src/tasks/build/index.js +52 -0
- package/src/tasks/bundle/builder/index.js +218 -0
- package/src/tasks/bundle/builder/modules.js +139 -0
- package/src/tasks/bundle/builder/paths.js +50 -0
- package/src/tasks/bundle/builder/webpack.config.js +336 -0
- package/src/tasks/bundle/index.js +65 -0
- package/src/tasks/create/index.js +380 -0
- package/src/tasks/create/template/config.json.mustache +62 -0
- package/src/tasks/create/template/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/template/index.jsx.mustache +55 -0
- package/src/tasks/create/template/styles.js.mustache +7 -0
- 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 +145 -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 +171 -0
- package/src/tasks/create/templates/Constellation/Field/Boolean/styles.js.mustache +7 -0
- package/src/tasks/create/templates/Constellation/Field/Date/config.json.mustache +195 -0
- package/src/tasks/create/templates/Constellation/Field/Date/date.js.mustache +327 -0
- package/src/tasks/create/templates/Constellation/Field/Date/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/Constellation/Field/Date/index.jsx.mustache +254 -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 +256 -0
- package/src/tasks/create/templates/Constellation/Field/DateTime/date-time.js.mustache +93 -0
- package/src/tasks/create/templates/Constellation/Field/DateTime/date-utils.js +286 -0
- package/src/tasks/create/templates/Constellation/Field/DateTime/date.js.mustache +327 -0
- package/src/tasks/create/templates/Constellation/Field/DateTime/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/Constellation/Field/DateTime/index.jsx.mustache +252 -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 +278 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal/demo.stories.jsx.mustache +44 -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 +272 -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 +291 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/demo.stories.jsx.mustache +44 -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 +300 -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 +93 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/demo.stories.jsx.mustache +44 -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 +275 -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 +347 -0
- package/src/tasks/create/templates/Constellation/Field/Integer/demo.stories.jsx.mustache +44 -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 +335 -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 +114 -0
- package/src/tasks/create/templates/Constellation/Field/Picklist/demo.stories.jsx.mustache +44 -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 +308 -0
- package/src/tasks/create/templates/Constellation/Field/Picklist/picklist.js.mustache +43 -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/templates/Constellation/Field/Text/config.json.mustache +62 -0
- package/src/tasks/create/templates/Constellation/Field/Text/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/Constellation/Field/Text/index.jsx.mustache +60 -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 +111 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Email/demo.stories.jsx.mustache +44 -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 +189 -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-Email/text-email.js.mustache +43 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Input/StatusWork.js +27 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Input/config.json.mustache +111 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Input/demo.stories.jsx.mustache +44 -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 +196 -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-Input/text-input.js.mustache +43 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/config.json.mustache +111 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/demo.stories.jsx.mustache +44 -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 +189 -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-Paragraph/text-paragraph.js.mustache +43 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Phone/config.json.mustache +123 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Phone/demo.stories.jsx.mustache +44 -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 +223 -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-Phone/text-phone.js.mustache +43 -0
- package/src/tasks/create/templates/Constellation/Field/Text-URL/config.json.mustache +237 -0
- package/src/tasks/create/templates/Constellation/Field/Text-URL/demo.stories.jsx.mustache +44 -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/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.js.mustache +172 -0
- package/src/tasks/create/templates/Constellation/Field/TimeofDay/config.json.mustache +185 -0
- package/src/tasks/create/templates/Constellation/Field/TimeofDay/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/Constellation/Field/TimeofDay/index.jsx.mustache +213 -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 +286 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS/OneColumnDetails.svg +22 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS/config.json.mustache +35 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS/index.jsx.mustache +88 -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 +155 -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 +42 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/index.jsx.mustache +88 -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 +45 -0
- package/src/tasks/create/templates/Constellation/Template/FORM/index.jsx.mustache +49 -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 +27 -0
- package/src/tasks/create/templates/Constellation/Template/FORM-region/index.jsx.mustache +51 -0
- package/src/tasks/create/templates/Constellation/Template/FORM-region/styles.js.mustache +7 -0
- package/src/tasks/create/templates/Constellation/Template/PAGE/GetNextWork.js.mustache +29 -0
- package/src/tasks/create/templates/Constellation/Template/PAGE/OneColumnPage.svg +36 -0
- package/src/tasks/create/templates/Constellation/Template/PAGE/config.json.mustache +32 -0
- package/src/tasks/create/templates/Constellation/Template/PAGE/index.jsx.mustache +68 -0
- package/src/tasks/create/templates/Constellation/Template/PAGE/localizations.json.mustache +4 -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 +226 -0
- package/src/tasks/create/templates/Constellation/Widget/CASE/OneColumnPage.svg +36 -0
- package/src/tasks/create/templates/Constellation/Widget/CASE/config.json.mustache +23 -0
- package/src/tasks/create/templates/Constellation/Widget/CASE/index.jsx.mustache +75 -0
- package/src/tasks/create/templates/Constellation/Widget/CASE/styles.js.mustache +7 -0
- package/src/tasks/create/templates/Constellation/Widget/PAGE/OneColumnPage.svg +36 -0
- package/src/tasks/create/templates/Constellation/Widget/PAGE/config.json.mustache +59 -0
- package/src/tasks/create/templates/Constellation/Widget/PAGE/index.jsx.mustache +48 -0
- package/src/tasks/create/templates/Constellation/Widget/PAGE/styles.js.mustache +7 -0
- package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/Avatar.js.mustache +73 -0
- package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/OneColumnPage.svg +36 -0
- package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/Operator.js.mustache +239 -0
- package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/config.json.mustache +66 -0
- package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/index.jsx.mustache +110 -0
- package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/styles.js.mustache +7 -0
- package/src/tasks/create/templates/SDK-Angular/Field/__components.md +4 -0
- package/src/tasks/create/templates/SDK-Angular/Template/__components.md +4 -0
- package/src/tasks/create/templates/SDK-Angular/Widget/__components.md +4 -0
- package/src/tasks/create/templates/SDK-React/Field/Boolean/config.json.mustache +73 -0
- package/src/tasks/create/templates/SDK-React/Field/Boolean/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/SDK-React/Field/Boolean/index.tsx.mustache +109 -0
- package/src/tasks/create/templates/SDK-React/Field/Boolean/styles.js.mustache +7 -0
- package/src/tasks/create/templates/SDK-React/Field/Date/config.json.mustache +133 -0
- package/src/tasks/create/templates/SDK-React/Field/Date/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/SDK-React/Field/Date/index.tsx.mustache +122 -0
- package/src/tasks/create/templates/SDK-React/Field/Date/styles.js.mustache +7 -0
- package/src/tasks/create/templates/SDK-React/Field/DateTime/config.json.mustache +190 -0
- package/src/tasks/create/templates/SDK-React/Field/DateTime/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/SDK-React/Field/DateTime/index.tsx.mustache +112 -0
- package/src/tasks/create/templates/SDK-React/Field/DateTime/styles.js.mustache +7 -0
- package/src/tasks/create/templates/SDK-React/Field/Decimal/config.json.mustache +80 -0
- package/src/tasks/create/templates/SDK-React/Field/Decimal/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/SDK-React/Field/Decimal/index.tsx.mustache +105 -0
- package/src/tasks/create/templates/SDK-React/Field/Decimal/styles.js.mustache +7 -0
- package/src/tasks/create/templates/SDK-React/Field/Decimal-Currency/config.json.mustache +111 -0
- package/src/tasks/create/templates/SDK-React/Field/Decimal-Currency/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/SDK-React/Field/Decimal-Currency/index.tsx.mustache +131 -0
- package/src/tasks/create/templates/SDK-React/Field/Decimal-Currency/styles.js.mustache +7 -0
- package/src/tasks/create/templates/SDK-React/Field/Decimal-Percentage/config.json.mustache +80 -0
- package/src/tasks/create/templates/SDK-React/Field/Decimal-Percentage/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/SDK-React/Field/Decimal-Percentage/index.tsx.mustache +128 -0
- package/src/tasks/create/templates/SDK-React/Field/Decimal-Percentage/styles.js.mustache +7 -0
- package/src/tasks/create/templates/SDK-React/Field/Integer/config.json.mustache +74 -0
- package/src/tasks/create/templates/SDK-React/Field/Integer/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/SDK-React/Field/Integer/index.tsx.mustache +124 -0
- package/src/tasks/create/templates/SDK-React/Field/Integer/styles.js.mustache +7 -0
- package/src/tasks/create/templates/SDK-React/Field/Picklist/config.json.mustache +72 -0
- package/src/tasks/create/templates/SDK-React/Field/Picklist/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/SDK-React/Field/Picklist/index.tsx.mustache +141 -0
- package/src/tasks/create/templates/SDK-React/Field/Picklist/styles.js.mustache +7 -0
- package/src/tasks/create/templates/SDK-React/Field/Text/config.json.mustache +69 -0
- package/src/tasks/create/templates/SDK-React/Field/Text/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/SDK-React/Field/Text/index.tsx.mustache +119 -0
- package/src/tasks/create/templates/SDK-React/Field/Text/styles.js.mustache +7 -0
- package/src/tasks/create/templates/SDK-React/Field/Text-Email/config.json.mustache +69 -0
- package/src/tasks/create/templates/SDK-React/Field/Text-Email/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/SDK-React/Field/Text-Email/index.tsx.mustache +121 -0
- package/src/tasks/create/templates/SDK-React/Field/Text-Email/styles.js.mustache +7 -0
- package/src/tasks/create/templates/SDK-React/Field/Text-Input/config.json.mustache +69 -0
- package/src/tasks/create/templates/SDK-React/Field/Text-Input/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/SDK-React/Field/Text-Input/index.tsx.mustache +119 -0
- package/src/tasks/create/templates/SDK-React/Field/Text-Input/styles.js.mustache +7 -0
- package/src/tasks/create/templates/SDK-React/Field/Text-Paragraph/config.json.mustache +69 -0
- package/src/tasks/create/templates/SDK-React/Field/Text-Paragraph/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/SDK-React/Field/Text-Paragraph/index.tsx.mustache +123 -0
- package/src/tasks/create/templates/SDK-React/Field/Text-Paragraph/styles.js.mustache +7 -0
- package/src/tasks/create/templates/SDK-React/Field/Text-Phone/config.json.mustache +81 -0
- package/src/tasks/create/templates/SDK-React/Field/Text-Phone/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/SDK-React/Field/Text-Phone/index.tsx.mustache +147 -0
- package/src/tasks/create/templates/SDK-React/Field/Text-Phone/styles.js.mustache +7 -0
- package/src/tasks/create/templates/SDK-React/Field/Text-URL/config.json.mustache +111 -0
- package/src/tasks/create/templates/SDK-React/Field/Text-URL/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/SDK-React/Field/Text-URL/index.tsx.mustache +98 -0
- package/src/tasks/create/templates/SDK-React/Field/Text-URL/styles.js.mustache +7 -0
- package/src/tasks/create/templates/SDK-React/Field/TimeofDay/config.json.mustache +121 -0
- package/src/tasks/create/templates/SDK-React/Field/TimeofDay/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/SDK-React/Field/TimeofDay/index.tsx.mustache +120 -0
- package/src/tasks/create/templates/SDK-React/Field/TimeofDay/styles.js.mustache +7 -0
- package/src/tasks/create/templates/SDK-React/Template/DETAILS/DefaultForm.svg +29 -0
- package/src/tasks/create/templates/SDK-React/Template/DETAILS/config.json.mustache +21 -0
- package/src/tasks/create/templates/SDK-React/Template/DETAILS/index.tsx.mustache +45 -0
- package/src/tasks/create/templates/SDK-React/Template/DETAILS/styles.js.mustache +7 -0
- package/src/tasks/create/templates/SDK-React/Template/DETAILS-region/TwoColumnDetails.svg +28 -0
- package/src/tasks/create/templates/SDK-React/Template/DETAILS-region/config.json.mustache +27 -0
- package/src/tasks/create/templates/SDK-React/Template/DETAILS-region/index.tsx.mustache +53 -0
- package/src/tasks/create/templates/SDK-React/Template/DETAILS-region/styles.js.mustache +7 -0
- package/src/tasks/create/templates/SDK-React/Template/FORM/DefaultForm.css +25 -0
- package/src/tasks/create/templates/SDK-React/Template/FORM/DefaultForm.svg +29 -0
- package/src/tasks/create/templates/SDK-React/Template/FORM/config.json.mustache +45 -0
- package/src/tasks/create/templates/SDK-React/Template/FORM/index.tsx.mustache +63 -0
- package/src/tasks/create/templates/SDK-React/Template/FORM/styles.js.mustache +7 -0
- package/src/tasks/create/templates/SDK-React/Template/FORM-region/TwoColumn.svg +38 -0
- package/src/tasks/create/templates/SDK-React/Template/FORM-region/config.json.mustache +49 -0
- package/src/tasks/create/templates/SDK-React/Template/FORM-region/index.tsx.mustache +69 -0
- package/src/tasks/create/templates/SDK-React/Template/FORM-region/styles.js.mustache +7 -0
- package/src/tasks/create/templates/SDK-React/Template/PAGE/OneColumn.tsx.mustache +32 -0
- package/src/tasks/create/templates/SDK-React/Template/PAGE/OneColumnPage.svg +28 -0
- package/src/tasks/create/templates/SDK-React/Template/PAGE/config.json.mustache +32 -0
- package/src/tasks/create/templates/SDK-React/Template/PAGE/index.tsx.mustache +31 -0
- package/src/tasks/create/templates/SDK-React/Template/PAGE/styles.js.mustache +7 -0
- package/src/tasks/create/templates/SDK-React/Widget/CASE/OneColumnPage.svg +36 -0
- package/src/tasks/create/templates/SDK-React/Widget/CASE/config.json.mustache +23 -0
- package/src/tasks/create/templates/SDK-React/Widget/CASE/index.tsx.mustache +183 -0
- package/src/tasks/create/templates/SDK-React/Widget/CASE/styles.js.mustache +7 -0
- package/src/tasks/create/templates/SDK-React/Widget/PAGE/OneColumnPage.svg +36 -0
- package/src/tasks/create/templates/SDK-React/Widget/PAGE/config.json.mustache +59 -0
- package/src/tasks/create/templates/SDK-React/Widget/PAGE/index.tsx.mustache +78 -0
- package/src/tasks/create/templates/SDK-React/Widget/PAGE/styles.js.mustache +7 -0
- package/src/tasks/create/templates/SDK-React/Widget/PAGE-CASE/OneColumnPage.svg +36 -0
- package/src/tasks/create/templates/SDK-React/Widget/PAGE-CASE/config.json.mustache +66 -0
- package/src/tasks/create/templates/SDK-React/Widget/PAGE-CASE/index.tsx.mustache +239 -0
- package/src/tasks/create/templates/SDK-React/Widget/PAGE-CASE/styles.js.mustache +7 -0
- package/src/tasks/create/templates/SDK-WebComponents/Field/__components.md +4 -0
- package/src/tasks/create/templates/SDK-WebComponents/Template/__components.md +4 -0
- package/src/tasks/create/templates/SDK-WebComponents/Widget/__components.md +4 -0
- package/src/tasks/delete/helper.js +122 -0
- package/src/tasks/delete/index.js +45 -0
- package/src/tasks/delete-all/helper.js +177 -0
- package/src/tasks/delete-all/index.js +45 -0
- package/src/tasks/index.js +11 -0
- package/src/tasks/linter/index.js +46 -0
- package/src/tasks/list/helper.js +118 -0
- package/src/tasks/list/index.js +51 -0
- package/src/tasks/map/map.js +118 -0
- package/src/tasks/publish/helper.js +147 -0
- package/src/tasks/publish/index.js +72 -0
- package/src/tasks/publish-all/helper.js +139 -0
- package/src/tasks/publish-all/index.js +84 -0
- package/src/tasks/update/index.js +5 -0
- package/src/tasks/upgrade/index.js +31 -0
- package/src/tasks/validator/index.js +216 -0
- package/src/util.js +442 -0
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import { URL, fileURLToPath } from 'url';
|
|
3
|
+
import fs from 'fs';
|
|
4
|
+
import { promisify } from 'util';
|
|
5
|
+
import { createRequire } from "module";
|
|
6
|
+
import { join } from 'path';
|
|
7
|
+
|
|
8
|
+
import inquirer from 'inquirer';
|
|
9
|
+
import ncp from 'ncp';
|
|
10
|
+
import chalk from 'chalk';
|
|
11
|
+
|
|
12
|
+
import { checkPathAccess, getTokenUrl } from '../../util.js';
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
export const DXCB_CONFIG_JSON_FILENAME = 'dxcb.config.json';
|
|
16
|
+
export const DXCB_CONFIG_INTERNAL_JSON_FILENAME = 'src/dxcb.config.json';
|
|
17
|
+
|
|
18
|
+
const pegaConfigJsonPath = path.join(path.resolve(), DXCB_CONFIG_JSON_FILENAME);
|
|
19
|
+
const pegaConfigInternalJsonPath = path.join(path.resolve(), DXCB_CONFIG_INTERNAL_JSON_FILENAME);
|
|
20
|
+
|
|
21
|
+
import {
|
|
22
|
+
convertIntoPascalCase,
|
|
23
|
+
compileMustacheTemplate,
|
|
24
|
+
getComponentDirectoryPath,
|
|
25
|
+
getComponents,
|
|
26
|
+
getComponentDefaults,
|
|
27
|
+
sanitize,
|
|
28
|
+
validateSemver
|
|
29
|
+
} from '../../util.js';
|
|
30
|
+
import { COMPONENT_SCHEMA } from '../../constants.js';
|
|
31
|
+
|
|
32
|
+
const copy = promisify(ncp);
|
|
33
|
+
|
|
34
|
+
const copyComponentTemplate = async options => {
|
|
35
|
+
return copy(options.templateDirectory, options.targetDirectory, {
|
|
36
|
+
clobber: false
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const compileMustacheTemplates = async (
|
|
41
|
+
componentDirectory,
|
|
42
|
+
{
|
|
43
|
+
componentKey,
|
|
44
|
+
componentName,
|
|
45
|
+
componentLabel,
|
|
46
|
+
library,
|
|
47
|
+
version,
|
|
48
|
+
type,
|
|
49
|
+
subtype,
|
|
50
|
+
description,
|
|
51
|
+
organization,
|
|
52
|
+
allowedApplications
|
|
53
|
+
}
|
|
54
|
+
) => {
|
|
55
|
+
const files = fs.readdirSync(componentDirectory);
|
|
56
|
+
const componentClassName = convertIntoPascalCase(componentKey);
|
|
57
|
+
|
|
58
|
+
const isTemplate = type === 'Template';
|
|
59
|
+
const isPicklist = subtype === 'Picklist';
|
|
60
|
+
const isBool = subtype === 'Boolean';
|
|
61
|
+
const isPhone = subtype === 'Phone';
|
|
62
|
+
|
|
63
|
+
if (Array.isArray(subtype) && subtype.length === 1) {
|
|
64
|
+
subtype = subtype.toString();
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
let mustacheSubType = subtype;
|
|
68
|
+
|
|
69
|
+
// overrides
|
|
70
|
+
if (typeof(mustacheSubType) == "string") {
|
|
71
|
+
switch (mustacheSubType) {
|
|
72
|
+
case "FORM-region" :
|
|
73
|
+
mustacheSubType = "FORM";
|
|
74
|
+
break;
|
|
75
|
+
case "DETAILS-region" :
|
|
76
|
+
mustacheSubType = "DETAILS";
|
|
77
|
+
break;
|
|
78
|
+
case "Text-Input" :
|
|
79
|
+
mustacheSubType = "Text";
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (allowedApplications.trim() === '') {
|
|
86
|
+
allowedApplications = [];
|
|
87
|
+
} else {
|
|
88
|
+
if (allowedApplications.indexOf(',') !== -1) {
|
|
89
|
+
allowedApplications = allowedApplications.split(',');
|
|
90
|
+
}
|
|
91
|
+
allowedApplications = [].concat(allowedApplications);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
allowedApplications = allowedApplications.filter(el => !!el.trim()).map(el => el.trim());
|
|
95
|
+
files.forEach(file => {
|
|
96
|
+
const filePath = path.join(componentDirectory, file);
|
|
97
|
+
|
|
98
|
+
const output = compileMustacheTemplate(filePath, {
|
|
99
|
+
COMPONENT_KEY: componentKey,
|
|
100
|
+
COMPONENT_NAME: componentName,
|
|
101
|
+
COMPONENT_LABEL: componentLabel,
|
|
102
|
+
COMPONENT_CLASS_NAME: componentClassName,
|
|
103
|
+
ORGANIZATION: organization,
|
|
104
|
+
VERSION: version,
|
|
105
|
+
LIBRARY: library,
|
|
106
|
+
ALLOWEDAPPS: JSON.stringify(allowedApplications),
|
|
107
|
+
TYPE: type,
|
|
108
|
+
SUB_TYPE: JSON.stringify(mustacheSubType),
|
|
109
|
+
DESCRIPTION: description || componentLabel,
|
|
110
|
+
IS_TEMPLATE: isTemplate,
|
|
111
|
+
IS_PICKLIST: isPicklist,
|
|
112
|
+
IS_BOOLEAN: isBool,
|
|
113
|
+
IS_PHONE: isPhone
|
|
114
|
+
});
|
|
115
|
+
fs.writeFileSync(filePath, output);
|
|
116
|
+
fs.renameSync(filePath, filePath.replace('.mustache', ''));
|
|
117
|
+
});
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
const validateCompile = async (
|
|
125
|
+
{
|
|
126
|
+
library,
|
|
127
|
+
organization,
|
|
128
|
+
componentName,
|
|
129
|
+
componentLabel,
|
|
130
|
+
version,
|
|
131
|
+
framework,
|
|
132
|
+
type,
|
|
133
|
+
subtype,
|
|
134
|
+
description,
|
|
135
|
+
allowedApplications
|
|
136
|
+
},
|
|
137
|
+
options
|
|
138
|
+
) => {
|
|
139
|
+
|
|
140
|
+
let sSubType = subtype;
|
|
141
|
+
if (Array.isArray(subtype)) {
|
|
142
|
+
sSubType = subtype.join("-");
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
await checkPathAccess(pegaConfigInternalJsonPath);
|
|
146
|
+
|
|
147
|
+
let internalData = fs.readFileSync(pegaConfigInternalJsonPath, { encoding: 'utf8' });
|
|
148
|
+
internalData = internalData && JSON.parse(internalData);
|
|
149
|
+
|
|
150
|
+
framework = internalData.sdkType;
|
|
151
|
+
|
|
152
|
+
const templateDir = `./templates/${framework}/${type}/${sSubType}`;
|
|
153
|
+
const templateDirectory = fileURLToPath(new URL(templateDir, import.meta.url));
|
|
154
|
+
|
|
155
|
+
const componentKey = `${organization}_${library}_${componentName}`;
|
|
156
|
+
|
|
157
|
+
const typeLC = type.toLowerCase();
|
|
158
|
+
const targetDirectory = await getComponentDirectoryPath(join(typeLC, "/",componentKey));
|
|
159
|
+
|
|
160
|
+
const components = await getComponents(false);
|
|
161
|
+
if (components.includes(componentKey)) {
|
|
162
|
+
console.log(chalk.red(`${componentKey} component already exists in ${targetDirectory}`));
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
await copyComponentTemplate({
|
|
167
|
+
...options,
|
|
168
|
+
targetDirectory,
|
|
169
|
+
templateDirectory
|
|
170
|
+
});
|
|
171
|
+
await compileMustacheTemplates(targetDirectory, {
|
|
172
|
+
componentKey,
|
|
173
|
+
componentName,
|
|
174
|
+
componentLabel,
|
|
175
|
+
library,
|
|
176
|
+
version,
|
|
177
|
+
type,
|
|
178
|
+
subtype,
|
|
179
|
+
description,
|
|
180
|
+
organization,
|
|
181
|
+
allowedApplications
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
console.log(chalk.green(`created ${componentKey} component in ${targetDirectory}`));
|
|
185
|
+
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
export default async options => {
|
|
189
|
+
if (options.params[10]) {
|
|
190
|
+
const componentName = options.params[3];
|
|
191
|
+
const componentLabel = options.params[4];
|
|
192
|
+
const library = options.params[5];
|
|
193
|
+
const version = options.params[6];
|
|
194
|
+
const framework = options.params[7];
|
|
195
|
+
const type = options.params[8];
|
|
196
|
+
const subtype = options.params[9];
|
|
197
|
+
const description = options.params[10];
|
|
198
|
+
|
|
199
|
+
await validateCompile(
|
|
200
|
+
{
|
|
201
|
+
componentName,
|
|
202
|
+
componentLabel,
|
|
203
|
+
library,
|
|
204
|
+
version,
|
|
205
|
+
framework,
|
|
206
|
+
type,
|
|
207
|
+
subtype,
|
|
208
|
+
description,
|
|
209
|
+
organization
|
|
210
|
+
},
|
|
211
|
+
options
|
|
212
|
+
);
|
|
213
|
+
} else {
|
|
214
|
+
|
|
215
|
+
await checkPathAccess(pegaConfigJsonPath);
|
|
216
|
+
|
|
217
|
+
let data = fs.readFileSync(pegaConfigJsonPath, { encoding: 'utf8' });
|
|
218
|
+
data = data && JSON.parse(data);
|
|
219
|
+
|
|
220
|
+
const componentData = data['component'];
|
|
221
|
+
|
|
222
|
+
const { organization, library} = componentData;
|
|
223
|
+
|
|
224
|
+
let componentDefaults = await getComponentDefaults();
|
|
225
|
+
componentDefaults.library = library;
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
const questions = [
|
|
229
|
+
{
|
|
230
|
+
name: 'componentName',
|
|
231
|
+
message: 'Enter component name (required)',
|
|
232
|
+
validate: value => {
|
|
233
|
+
/* value should not be empty
|
|
234
|
+
It should not have spaces
|
|
235
|
+
It should not start with a number
|
|
236
|
+
Only case-insensitive alphanumeric values are allowed
|
|
237
|
+
*/
|
|
238
|
+
if (value && !/^\d/.test(value) && value === sanitize(value)) {
|
|
239
|
+
return true;
|
|
240
|
+
}
|
|
241
|
+
return 'Only alphanumeric values are allowed, starting with alphabets';
|
|
242
|
+
}
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
name: 'componentLabel',
|
|
246
|
+
message: 'Enter component label for display (required)',
|
|
247
|
+
validate: value => {
|
|
248
|
+
if (value) {
|
|
249
|
+
return true;
|
|
250
|
+
}
|
|
251
|
+
return 'Please provide value for label';
|
|
252
|
+
}
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
name: 'version',
|
|
256
|
+
message: 'Enter component version',
|
|
257
|
+
default: componentDefaults.version,
|
|
258
|
+
validate: value => {
|
|
259
|
+
if (validateSemver(value)) {
|
|
260
|
+
return true;
|
|
261
|
+
}
|
|
262
|
+
return 'Please provide semver compatible version e.g 0.0.1';
|
|
263
|
+
}
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
name: 'library',
|
|
267
|
+
message: 'Enter library name (required)',
|
|
268
|
+
default: componentDefaults.library,
|
|
269
|
+
validate: value => {
|
|
270
|
+
/* value should not be empty
|
|
271
|
+
It should not have spaces
|
|
272
|
+
It should not start with a number
|
|
273
|
+
Only case-insensitive alphanumeric values are allowed
|
|
274
|
+
*/
|
|
275
|
+
if (value && !/^\d/.test(value) && value === sanitize(value)) {
|
|
276
|
+
return true;
|
|
277
|
+
}
|
|
278
|
+
return 'Only alphanumeric values are allowed, starting with alphabets';
|
|
279
|
+
}
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
name: 'allowedApplications',
|
|
283
|
+
message: 'Please enter the application names to be supported (comma-separated). ',
|
|
284
|
+
suffix: 'Keep empty for all applications'
|
|
285
|
+
},
|
|
286
|
+
// {
|
|
287
|
+
// name: 'framework',
|
|
288
|
+
// type: 'rawlist',
|
|
289
|
+
// message: 'Enter framework a',
|
|
290
|
+
// default: 'COSMOS_React',
|
|
291
|
+
// choices: COMPONENT_SCHEMA.framework
|
|
292
|
+
// },
|
|
293
|
+
{
|
|
294
|
+
name: 'type',
|
|
295
|
+
type: 'rawlist',
|
|
296
|
+
message: 'Enter type of component',
|
|
297
|
+
default: componentDefaults.type,
|
|
298
|
+
choices: COMPONENT_SCHEMA.type
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
name: 'subtype',
|
|
302
|
+
type: 'rawlist',
|
|
303
|
+
message: 'Enter subtype of component',
|
|
304
|
+
default: componentDefaults.subtype,
|
|
305
|
+
choices: COMPONENT_SCHEMA.subtype.field,
|
|
306
|
+
when(answers) {
|
|
307
|
+
return answers.type === 'Field';
|
|
308
|
+
}
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
name: 'subtype',
|
|
312
|
+
type: 'rawlist',
|
|
313
|
+
message: 'Enter subtype of component',
|
|
314
|
+
default: componentDefaults.subtype,
|
|
315
|
+
choices: COMPONENT_SCHEMA.subtype.template,
|
|
316
|
+
when(answers) {
|
|
317
|
+
return answers.type === 'Template';
|
|
318
|
+
}
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
name: 'subtype',
|
|
322
|
+
type: 'rawlist',
|
|
323
|
+
message: 'Enter subtype of component',
|
|
324
|
+
default: [componentDefaults.subtype || COMPONENT_SCHEMA.subtype.widget[0]],
|
|
325
|
+
choices: COMPONENT_SCHEMA.subtype.widget,
|
|
326
|
+
when(answers) {
|
|
327
|
+
return answers.type === 'Widget';
|
|
328
|
+
},
|
|
329
|
+
validate: value => {
|
|
330
|
+
/* value should not be empty */
|
|
331
|
+
if (Array.isArray(value) && value.length) {
|
|
332
|
+
return true;
|
|
333
|
+
}
|
|
334
|
+
return 'Please select subtype';
|
|
335
|
+
}
|
|
336
|
+
},
|
|
337
|
+
{
|
|
338
|
+
name: 'description',
|
|
339
|
+
message: 'Enter description for the component',
|
|
340
|
+
default: componentDefaults.description,
|
|
341
|
+
/* if left blank and no defaults, mustache will use componentLabel, because description is used in app studio and
|
|
342
|
+
shouldn't be blank */
|
|
343
|
+
}
|
|
344
|
+
];
|
|
345
|
+
|
|
346
|
+
// get package version, so can display at create
|
|
347
|
+
const require = createRequire(import.meta.url);
|
|
348
|
+
const pData = require("../../../package.json");
|
|
349
|
+
|
|
350
|
+
console.log(chalk.green("DX Component Builder - SDK v" + pData.version));
|
|
351
|
+
await inquirer.prompt(questions).then(async answers => {
|
|
352
|
+
const {
|
|
353
|
+
componentName,
|
|
354
|
+
componentLabel,
|
|
355
|
+
library,
|
|
356
|
+
version,
|
|
357
|
+
framework,
|
|
358
|
+
type,
|
|
359
|
+
subtype,
|
|
360
|
+
description,
|
|
361
|
+
allowedApplications
|
|
362
|
+
} = answers;
|
|
363
|
+
await validateCompile(
|
|
364
|
+
{
|
|
365
|
+
componentName,
|
|
366
|
+
componentLabel,
|
|
367
|
+
library,
|
|
368
|
+
version,
|
|
369
|
+
framework,
|
|
370
|
+
type,
|
|
371
|
+
subtype,
|
|
372
|
+
description,
|
|
373
|
+
allowedApplications,
|
|
374
|
+
organization
|
|
375
|
+
},
|
|
376
|
+
options
|
|
377
|
+
);
|
|
378
|
+
});
|
|
379
|
+
}
|
|
380
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
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
|
+
"type": "{{TYPE}}",
|
|
11
|
+
"subtype": {{{SUB_TYPE}}},
|
|
12
|
+
{{#IS_TEMPLATE}}
|
|
13
|
+
"icon": "images/pz-text-input-active.svg",
|
|
14
|
+
{{/IS_TEMPLATE}}
|
|
15
|
+
"properties": [
|
|
16
|
+
{
|
|
17
|
+
"name": "label",
|
|
18
|
+
"label": "Label value",
|
|
19
|
+
"format": "TEXT"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"name": "placeholder",
|
|
23
|
+
"label": "Placeholder",
|
|
24
|
+
"format": "TEXT"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"name": "visibility",
|
|
28
|
+
"label": "Visible",
|
|
29
|
+
"format": "VISIBILITY"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"name": "disabled",
|
|
33
|
+
"label": "Disabled",
|
|
34
|
+
"format": "DISABLED"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"name": "required",
|
|
38
|
+
"label": "Required",
|
|
39
|
+
"format": "REQUIRED"
|
|
40
|
+
}
|
|
41
|
+
],
|
|
42
|
+
"defaultConfig": {
|
|
43
|
+
{{#IS_PICKLIST}}
|
|
44
|
+
"label": "@L $this.label",
|
|
45
|
+
"placeholder": "@L Select...",
|
|
46
|
+
"listType": "associated",
|
|
47
|
+
"datasource": "@ASSOCIATED .$this.name"
|
|
48
|
+
{{/IS_PICKLIST}}
|
|
49
|
+
{{#IS_BOOLEAN}}
|
|
50
|
+
"trueText": "True",
|
|
51
|
+
"falseText": "False"
|
|
52
|
+
{{/IS_BOOLEAN}}
|
|
53
|
+
{{#IS_PHONE}}
|
|
54
|
+
"datasource": {
|
|
55
|
+
"source": "@DATASOURCE D_pyCountryCallingCodeList.pxResults",
|
|
56
|
+
"fields": {
|
|
57
|
+
"value": "@P .pyCallingCode"
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
{{/IS_PHONE}}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import { withKnobs, text, boolean } from '@storybook/addon-knobs';
|
|
3
|
+
|
|
4
|
+
import {{COMPONENT_CLASS_NAME}} from './index.jsx';
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: '{{COMPONENT_CLASS_NAME}}',
|
|
8
|
+
decorators: [withKnobs],
|
|
9
|
+
component: {{COMPONENT_CLASS_NAME}}
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const base{{COMPONENT_CLASS_NAME}} = () => {
|
|
13
|
+
const [value, setValue] = useState('test value');
|
|
14
|
+
|
|
15
|
+
const props = {
|
|
16
|
+
getPConnect: () => {
|
|
17
|
+
return {
|
|
18
|
+
getActionsApi: () => {
|
|
19
|
+
return {
|
|
20
|
+
updateFieldValue: (propName, value) => {
|
|
21
|
+
setValue(value);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
},
|
|
25
|
+
getStateProps: () => {
|
|
26
|
+
return { value: '.name' };
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
},
|
|
30
|
+
value,
|
|
31
|
+
placeholder: text('Placeholder', 'Test placeholder'),
|
|
32
|
+
disabled: boolean('Disabled', false),
|
|
33
|
+
readOnly: boolean('Disabled', false),
|
|
34
|
+
required: boolean('Disabled', false),
|
|
35
|
+
label: text('Label', 'Sample Label'),
|
|
36
|
+
testId: text('Test id', 'text-12344566')
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<>
|
|
41
|
+
<{{COMPONENT_CLASS_NAME}} {...props} />
|
|
42
|
+
</>
|
|
43
|
+
);
|
|
44
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
import { Input, Label } from '@pega/cosmos-react-core';
|
|
3
|
+
|
|
4
|
+
import Styled{{COMPONENT_CLASS_NAME}}Wrapper from './styles';
|
|
5
|
+
|
|
6
|
+
const {{COMPONENT_CLASS_NAME}} = props => {
|
|
7
|
+
const { getPConnect, value, placeholder, disabled, readOnly, required, label, testId } = props;
|
|
8
|
+
|
|
9
|
+
const pConn = getPConnect();
|
|
10
|
+
const actions = pConn.getActionsApi();
|
|
11
|
+
const propName = pConn?.getStateProps()?.value;
|
|
12
|
+
|
|
13
|
+
const handleOnChange = event => {
|
|
14
|
+
const { value: updatedValue } = event.target;
|
|
15
|
+
actions.updateFieldValue(propName, updatedValue);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<Styled{{COMPONENT_CLASS_NAME}}Wrapper>
|
|
20
|
+
<Label>{label}</Label>
|
|
21
|
+
<Input
|
|
22
|
+
type='text'
|
|
23
|
+
value={value}
|
|
24
|
+
placeholder={placeholder}
|
|
25
|
+
disabled={disabled}
|
|
26
|
+
readOnly={readOnly}
|
|
27
|
+
required={required}
|
|
28
|
+
onChange={handleOnChange}
|
|
29
|
+
testId={testId}
|
|
30
|
+
/>
|
|
31
|
+
</Styled{{COMPONENT_CLASS_NAME}}Wrapper>
|
|
32
|
+
);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
{{COMPONENT_CLASS_NAME}}.defaultProps = {
|
|
36
|
+
value: '',
|
|
37
|
+
placeholder: '',
|
|
38
|
+
disabled: false,
|
|
39
|
+
readOnly: false,
|
|
40
|
+
required: false,
|
|
41
|
+
testId: null
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
{{COMPONENT_CLASS_NAME}}.propTypes = {
|
|
45
|
+
label: PropTypes.string,
|
|
46
|
+
value: PropTypes.string,
|
|
47
|
+
placeholder: PropTypes.string,
|
|
48
|
+
getPConnect: PropTypes.func.isRequired,
|
|
49
|
+
disabled: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
|
|
50
|
+
readOnly: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
|
|
51
|
+
required: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
|
|
52
|
+
testId: PropTypes.string
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export default {{COMPONENT_CLASS_NAME}};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
function Boolean(value, { allowEmpty = true, tick = "", cross = "" } = {}) {
|
|
2
|
+
if (
|
|
3
|
+
(!allowEmpty && !value) ||
|
|
4
|
+
value === false ||
|
|
5
|
+
value?.toString()?.toLowerCase() === "false" ||
|
|
6
|
+
value === 0 ||
|
|
7
|
+
value === "0"
|
|
8
|
+
) {
|
|
9
|
+
return cross || "";
|
|
10
|
+
}
|
|
11
|
+
if (
|
|
12
|
+
value === true ||
|
|
13
|
+
value?.toString()?.toLowerCase() === "true" ||
|
|
14
|
+
value === 1 ||
|
|
15
|
+
value === "1"
|
|
16
|
+
) {
|
|
17
|
+
return tick || "";
|
|
18
|
+
}
|
|
19
|
+
if (
|
|
20
|
+
allowEmpty &&
|
|
21
|
+
(value === "null" ||
|
|
22
|
+
value === "" ||
|
|
23
|
+
value === null ||
|
|
24
|
+
typeof value === "undefined")
|
|
25
|
+
) {
|
|
26
|
+
return "––";
|
|
27
|
+
}
|
|
28
|
+
return value;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export default {
|
|
32
|
+
TrueFalse: (value, options) =>
|
|
33
|
+
Boolean(value, {
|
|
34
|
+
...options,
|
|
35
|
+
tick: "True",
|
|
36
|
+
cross: "False"
|
|
37
|
+
})
|
|
38
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import Boolean from "./Boolean";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
...Boolean
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
export function format(value, type, options) {
|
|
11
|
+
let formattedValue;
|
|
12
|
+
|
|
13
|
+
switch (type?.toLowerCase()) {
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
case "boolean":
|
|
17
|
+
case "checkbox": {
|
|
18
|
+
formattedValue = Boolean.TrueFalse(value, { allowEmpty: false });
|
|
19
|
+
break;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
default:
|
|
23
|
+
formattedValue = value;
|
|
24
|
+
}
|
|
25
|
+
return formattedValue;
|
|
26
|
+
}
|