@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,256 @@
|
|
|
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
|
+
"icon": "images/pz-text-input-active.svg",
|
|
13
|
+
"properties": [
|
|
14
|
+
{
|
|
15
|
+
"name": "label",
|
|
16
|
+
"label": "Field label",
|
|
17
|
+
"format": "TEXT",
|
|
18
|
+
"required": true
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"name": "readOnly",
|
|
22
|
+
"label": "Edit mode",
|
|
23
|
+
"format": "READONLY"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"format": "SELECT",
|
|
27
|
+
"name": "clockFormat",
|
|
28
|
+
"label": "Clock",
|
|
29
|
+
"defaultValue": "0",
|
|
30
|
+
"source": [
|
|
31
|
+
{
|
|
32
|
+
"key": "0",
|
|
33
|
+
"value": "use locale"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"key": "12",
|
|
37
|
+
"value": "12 hours"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"key": "24",
|
|
41
|
+
"value": "24 hours"
|
|
42
|
+
}
|
|
43
|
+
]
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"name": "withSeconds",
|
|
47
|
+
"label": "Display seconds",
|
|
48
|
+
"format": "BOOLEAN"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"label": "Column settings",
|
|
52
|
+
"format": "GROUP",
|
|
53
|
+
"visibility": "@VIEWTYPE == 'MultiRecordDisplayAsTable'",
|
|
54
|
+
"properties": [
|
|
55
|
+
{
|
|
56
|
+
"name": "columnWidth",
|
|
57
|
+
"label": "Column width",
|
|
58
|
+
"format": "SELECT",
|
|
59
|
+
"source": [
|
|
60
|
+
{
|
|
61
|
+
"key": "auto",
|
|
62
|
+
"value": "Auto"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"key": "custom",
|
|
66
|
+
"value": "Custom"
|
|
67
|
+
}
|
|
68
|
+
]
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"name": "width",
|
|
72
|
+
"label": "Width (px)",
|
|
73
|
+
"format": "NUMBER",
|
|
74
|
+
"visibility": "$this.columnWidth == 'custom'"
|
|
75
|
+
}
|
|
76
|
+
]
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"label": "Input settings",
|
|
80
|
+
"format": "GROUP",
|
|
81
|
+
"visibility": "(!readOnly = true)",
|
|
82
|
+
"properties": [
|
|
83
|
+
{
|
|
84
|
+
"format": "LABEL",
|
|
85
|
+
"label": "Year range",
|
|
86
|
+
"variant": "secondary"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"format": "INLINE",
|
|
90
|
+
"elements": [
|
|
91
|
+
{
|
|
92
|
+
"key": "next",
|
|
93
|
+
"format": "LABEL",
|
|
94
|
+
"label": "Next",
|
|
95
|
+
"variant": "secondary"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"key": "nextYears",
|
|
99
|
+
"format": "NUMBER",
|
|
100
|
+
"label": "",
|
|
101
|
+
"name": "nextYearRange",
|
|
102
|
+
"min": 0
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"key": "year",
|
|
106
|
+
"format": "LABEL",
|
|
107
|
+
"label": "years",
|
|
108
|
+
"variant": "secondary"
|
|
109
|
+
}
|
|
110
|
+
]
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"format": "INLINE",
|
|
114
|
+
"elements": [
|
|
115
|
+
{
|
|
116
|
+
"key": "previous",
|
|
117
|
+
"format": "LABEL",
|
|
118
|
+
"label": "Previous",
|
|
119
|
+
"variant": "secondary"
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"key": "previousYears",
|
|
123
|
+
"format": "NUMBER",
|
|
124
|
+
"label": "",
|
|
125
|
+
"name": "previousYearRange",
|
|
126
|
+
"min": 0
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
"key": "year",
|
|
130
|
+
"format": "LABEL",
|
|
131
|
+
"label": "years",
|
|
132
|
+
"variant": "secondary"
|
|
133
|
+
}
|
|
134
|
+
]
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
"name": "showWeekNumber",
|
|
138
|
+
"label": "Display week numbers on calendar",
|
|
139
|
+
"format": "BOOLEAN"
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
"format": "SELECT",
|
|
143
|
+
"name": "pickerInterval",
|
|
144
|
+
"label": "Time picker",
|
|
145
|
+
"defaultValue": "30",
|
|
146
|
+
"source": [
|
|
147
|
+
{
|
|
148
|
+
"key": "5",
|
|
149
|
+
"value": "5 min"
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
"key": "10",
|
|
153
|
+
"value": "10 min"
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
"key": "15",
|
|
157
|
+
"value": "15 min"
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
"key": "20",
|
|
161
|
+
"value": "20 min"
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
"key": "30",
|
|
165
|
+
"value": "30 min"
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
"key": "60",
|
|
169
|
+
"value": "1 hr"
|
|
170
|
+
}
|
|
171
|
+
]
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
"name": "helperText",
|
|
175
|
+
"label": "Helper text",
|
|
176
|
+
"format": "TEXT"
|
|
177
|
+
}
|
|
178
|
+
]
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
"label": "Read-only settings",
|
|
182
|
+
"format": "GROUP",
|
|
183
|
+
"properties": [
|
|
184
|
+
{
|
|
185
|
+
"name": "showAsFormattedText",
|
|
186
|
+
"label": "Show as formatted text",
|
|
187
|
+
"format": "BOOLEAN"
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
"format": "SELECT",
|
|
191
|
+
"name": "formatter",
|
|
192
|
+
"label": "Format",
|
|
193
|
+
"defaultValue": "defaultDateTime",
|
|
194
|
+
"source": [
|
|
195
|
+
{
|
|
196
|
+
"key": "defaultDateTime",
|
|
197
|
+
"value": "Default"
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
"key": "DateTime-Short",
|
|
201
|
+
"value": "Date"
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
"key": "DateTime-Since",
|
|
205
|
+
"value": "Since"
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
"key": "Time-Only",
|
|
209
|
+
"value": "Time only"
|
|
210
|
+
}
|
|
211
|
+
]
|
|
212
|
+
}
|
|
213
|
+
]
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
"label": "Conditions",
|
|
217
|
+
"format": "GROUP",
|
|
218
|
+
"properties": [
|
|
219
|
+
{
|
|
220
|
+
"name": "required",
|
|
221
|
+
"label": "Required",
|
|
222
|
+
"format": "REQUIRED",
|
|
223
|
+
"visibility": "(!readOnly = true)"
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
"name": "disabled",
|
|
227
|
+
"label": "Disabled",
|
|
228
|
+
"format": "DISABLED",
|
|
229
|
+
"visibility": "(!readOnly = true)"
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
"name": "visibility",
|
|
233
|
+
"label": "Visibility",
|
|
234
|
+
"format": "VISIBILITY"
|
|
235
|
+
}
|
|
236
|
+
]
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
"label": "Advanced",
|
|
240
|
+
"format": "GROUP",
|
|
241
|
+
"collapsible": true,
|
|
242
|
+
"properties": [
|
|
243
|
+
{
|
|
244
|
+
"name": "testId",
|
|
245
|
+
"label": "Test ID",
|
|
246
|
+
"format": "TEXT",
|
|
247
|
+
"ignorePattern": "[^-_\\p{N}\\p{L}]",
|
|
248
|
+
"includeAnnotations": false
|
|
249
|
+
}
|
|
250
|
+
]
|
|
251
|
+
}
|
|
252
|
+
],
|
|
253
|
+
"defaultConfig": {
|
|
254
|
+
"label": "@L $this.label"
|
|
255
|
+
}
|
|
256
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
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
|
+
// value should be in ISO 8601 format.
|
|
15
|
+
function DateFormatter(
|
|
16
|
+
value,
|
|
17
|
+
{ type = types[1], format = "DD/MM/YYYY", timezone, fieldType } = {}
|
|
18
|
+
) {
|
|
19
|
+
if (!value) return value;
|
|
20
|
+
switch (type) {
|
|
21
|
+
case types[1]:
|
|
22
|
+
if (timezone && fieldType !== 'Date') return dayjs(value).tz(timezone).format(format); // Date only value should be formatted without timezone
|
|
23
|
+
return dayjs(value).format(format);
|
|
24
|
+
case types[0]:
|
|
25
|
+
return dayjs(value).from(dayjs());
|
|
26
|
+
default:
|
|
27
|
+
return value;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
// value should be in hh:mm:ss format (00:00:00 - 23:59:59).
|
|
31
|
+
function TimeFormatter(value, options) {
|
|
32
|
+
if (!value) return value;
|
|
33
|
+
const { locale = "en-US" } = options;
|
|
34
|
+
const timeOnlyRegex = /^(?:[01]\d|2[0123]):(?:[012345]\d):(?:[012345]\d)$/;
|
|
35
|
+
if (value.length === 8 && timeOnlyRegex.test(value)) {
|
|
36
|
+
const { timeOptions = {} } = options;
|
|
37
|
+
const tempDate = new Date();
|
|
38
|
+
const hours = parseInt(value.substr(0, 2), 10);
|
|
39
|
+
const minutes = parseInt(value.substr(3, 2), 10);
|
|
40
|
+
const seconds = parseInt(value.substr(6, 2), 10);
|
|
41
|
+
tempDate.setHours(hours);
|
|
42
|
+
tempDate.setMinutes(minutes);
|
|
43
|
+
tempDate.setSeconds(seconds);
|
|
44
|
+
return tempDate.toLocaleTimeString(locale, timeOptions);
|
|
45
|
+
}
|
|
46
|
+
return DateFormatter(value, options);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export const DateTimeShortFormatter = (value, options) => {
|
|
50
|
+
//export function DateTimeShortFormatter(value, options) {
|
|
51
|
+
return DateFormatter(value, {
|
|
52
|
+
...options,
|
|
53
|
+
type: "customFormat",
|
|
54
|
+
format: "MMM DD, YYYY"
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export default {
|
|
59
|
+
"DateTime-Long": (value, options) =>
|
|
60
|
+
DateFormatter(value, { ...options, type: "customFormat", format: "LLL" }),
|
|
61
|
+
"DateTime-Short": DateTimeShortFormatter,
|
|
62
|
+
"DateTime-Since": (value) => DateFormatter(value, { type: "fromNow" }),
|
|
63
|
+
"Time-Only": (value, options) =>
|
|
64
|
+
TimeFormatter(value, {
|
|
65
|
+
...options,
|
|
66
|
+
type: "customFormat",
|
|
67
|
+
format: "hh:mm:ss A"
|
|
68
|
+
}),
|
|
69
|
+
convertToTimezone: (value, options) => {
|
|
70
|
+
return value && options && options.timezone
|
|
71
|
+
? DateFormatter(value, {
|
|
72
|
+
...options,
|
|
73
|
+
type: "customFormat",
|
|
74
|
+
format: "YYYY-MM-DDTHH:mm:ss"
|
|
75
|
+
})
|
|
76
|
+
: value;
|
|
77
|
+
},
|
|
78
|
+
convertFromTimezone: (value, timezone) =>
|
|
79
|
+
value && timezone
|
|
80
|
+
? dayjs.tz(value, timezone).utc().format("YYYY-MM-DDTHH:mm:ss[Z]")
|
|
81
|
+
: value,
|
|
82
|
+
Date: (value, options) =>
|
|
83
|
+
DateFormatter(value, { type: "customFormat", ...options }),
|
|
84
|
+
"Date-Default": DateTimeShortFormatter,
|
|
85
|
+
"Date-Time-Default": (value, options) =>
|
|
86
|
+
DateFormatter(value, { ...options, type: "customFormat", format: "lll" }),
|
|
87
|
+
"Time-Default": (value, options) =>
|
|
88
|
+
TimeFormatter(value, {
|
|
89
|
+
...options,
|
|
90
|
+
type: "customFormat",
|
|
91
|
+
format: "hh:mm A"
|
|
92
|
+
})
|
|
93
|
+
};
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
import dayjs from "dayjs";
|
|
2
|
+
|
|
3
|
+
const relativeTime = require("dayjs/plugin/relativeTime");
|
|
4
|
+
|
|
5
|
+
dayjs.extend(relativeTime);
|
|
6
|
+
|
|
7
|
+
const utc = require("dayjs/plugin/utc");
|
|
8
|
+
|
|
9
|
+
dayjs.extend(utc);
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Return relative time in fromNow for the given datetime
|
|
13
|
+
* @description Convert and return the given datetime in dayJSObject
|
|
14
|
+
*
|
|
15
|
+
* @param {string} text datetime
|
|
16
|
+
* @returns {object} datetime as a dayjs object
|
|
17
|
+
*/
|
|
18
|
+
export const getDayJSObject = (text) => {
|
|
19
|
+
const momObj = dayjs(text);
|
|
20
|
+
if (momObj.isValid()) return momObj;
|
|
21
|
+
const timeStamp = text;
|
|
22
|
+
const isDateTime = timeStamp.indexOf("GMT") !== -1;
|
|
23
|
+
const year = parseInt(timeStamp.substr(0, 4), 10);
|
|
24
|
+
const month = parseInt(timeStamp.substr(4, 2), 10) - 1;
|
|
25
|
+
const day = parseInt(timeStamp.substr(6, 2), 10);
|
|
26
|
+
|
|
27
|
+
const CurrentTz = PCore.getLocaleUtils().getTimeZoneInUse();
|
|
28
|
+
|
|
29
|
+
let mom = new Date();
|
|
30
|
+
|
|
31
|
+
mom.setUTCDate(day);
|
|
32
|
+
mom.setUTCMonth(month);
|
|
33
|
+
mom.setUTCFullYear(year);
|
|
34
|
+
|
|
35
|
+
/* istanbul ignore else */
|
|
36
|
+
if (isDateTime) {
|
|
37
|
+
const hours = parseInt(timeStamp.substr(9, 2), 10);
|
|
38
|
+
const minutes = parseInt(timeStamp.substr(11, 2), 10);
|
|
39
|
+
const seconds = parseInt(timeStamp.substr(13, 2), 10);
|
|
40
|
+
const ms = parseInt(timeStamp.substr(16, 3), 10);
|
|
41
|
+
mom.setUTCHours(hours);
|
|
42
|
+
mom.setUTCMinutes(minutes);
|
|
43
|
+
mom.setUTCSeconds(seconds);
|
|
44
|
+
mom.setUTCMilliseconds(ms);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
mom = dayjs(
|
|
48
|
+
mom.toLocaleString("en-US", {
|
|
49
|
+
timeZone: CurrentTz
|
|
50
|
+
})
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
return mom;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Return relative time in fromNow for the given datetime
|
|
58
|
+
*
|
|
59
|
+
* @param {string} time datetime
|
|
60
|
+
* @returns {object} relative time from now
|
|
61
|
+
*/
|
|
62
|
+
export const getRelativeTime = (time) => {
|
|
63
|
+
let relativetime = "";
|
|
64
|
+
if (dayjs(time).isUTC()) {
|
|
65
|
+
relativetime = dayjs(time).fromNow();
|
|
66
|
+
} else {
|
|
67
|
+
const dayjstime = getDayJSObject(time);
|
|
68
|
+
relativetime = dayjs(dayjstime).fromNow();
|
|
69
|
+
}
|
|
70
|
+
return relativetime;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Return year for the date passed
|
|
75
|
+
*
|
|
76
|
+
* @param {string} value from which Year needs to be taken out
|
|
77
|
+
* @returns {number} year for the date passed
|
|
78
|
+
*/
|
|
79
|
+
export const getFullYear = (value) =>
|
|
80
|
+
value ? new Date(value).getFullYear() : new Date().getFullYear();
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Return maxDate for the date passed
|
|
84
|
+
*
|
|
85
|
+
* @param {number} nextYears next number of years
|
|
86
|
+
* @param {number} currentYear current year
|
|
87
|
+
* @param {number} yearFromValue year set on value in redux
|
|
88
|
+
*
|
|
89
|
+
* @returns {string} maxDate calculated based on inputs
|
|
90
|
+
*/
|
|
91
|
+
export const getMaxDate = (nextYears, currentYear, yearFromValue) => {
|
|
92
|
+
if (Number.isNaN(nextYears)) {
|
|
93
|
+
nextYears = 20;
|
|
94
|
+
}
|
|
95
|
+
let maxYear = currentYear + nextYears;
|
|
96
|
+
if (yearFromValue > maxYear) {
|
|
97
|
+
maxYear = yearFromValue;
|
|
98
|
+
}
|
|
99
|
+
return `${maxYear}-01-01`;
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Return minDate for the date passed
|
|
104
|
+
*
|
|
105
|
+
* @param {number} previousYears previous number of years
|
|
106
|
+
* @param {number} currentYear current year
|
|
107
|
+
* @param {number} yearFromValue year set on value in redux
|
|
108
|
+
*
|
|
109
|
+
* @returns {string} minDate calculated based on inputs
|
|
110
|
+
*/
|
|
111
|
+
export const getMinDate = (previousYears, currentYear, yearFromValue) => {
|
|
112
|
+
if (Number.isNaN(previousYears)) {
|
|
113
|
+
previousYears = 100;
|
|
114
|
+
}
|
|
115
|
+
let minYear = currentYear - previousYears;
|
|
116
|
+
if (yearFromValue < minYear) {
|
|
117
|
+
minYear = yearFromValue;
|
|
118
|
+
}
|
|
119
|
+
return `${minYear}-12-31`;
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Return clockFormat after parsing
|
|
124
|
+
*
|
|
125
|
+
* @param {number | string} clockFormat chosen by user
|
|
126
|
+
*
|
|
127
|
+
* @returns {number} clockFormat
|
|
128
|
+
*/
|
|
129
|
+
export const parseClockFormat = (clockFormat) =>
|
|
130
|
+
typeof clockFormat === "string" ? parseInt(clockFormat, 10) : clockFormat;
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Return datetime value string off to seconds
|
|
134
|
+
*
|
|
135
|
+
* @param {string} datetime in ISO format
|
|
136
|
+
* @param {boolean} withSeconds to specify if seconds is needed or not
|
|
137
|
+
*
|
|
138
|
+
* @returns {string} datetime after stripping of ms and seconds if selected to
|
|
139
|
+
*/
|
|
140
|
+
export const correctDateTimeToSeconds = (datetime, withSeconds) => {
|
|
141
|
+
if (withSeconds) {
|
|
142
|
+
return `${datetime.substring(0, datetime.indexOf("Z"))}.000Z`;
|
|
143
|
+
}
|
|
144
|
+
return `${datetime.substring(0, datetime.lastIndexOf(":"))}:00.000Z`;
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Return time value string off to seconds
|
|
149
|
+
*
|
|
150
|
+
* @param {string} datetime in ISO format
|
|
151
|
+
* @param {boolean} withSeconds to specify if seconds is needed or not
|
|
152
|
+
*
|
|
153
|
+
* @returns {string} just time after stripping of ms and seconds if selected to
|
|
154
|
+
*/
|
|
155
|
+
export const timeCorrectedToSeconds = (datetime, withSeconds) => {
|
|
156
|
+
if (withSeconds) {
|
|
157
|
+
return datetime.substring(datetime.indexOf("T") + 1, datetime.indexOf("."));
|
|
158
|
+
}
|
|
159
|
+
return `${datetime.substring(
|
|
160
|
+
datetime.indexOf("T") + 1,
|
|
161
|
+
datetime.lastIndexOf(":")
|
|
162
|
+
)}:00`;
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* This function handles the cosmos blur handler of DateTime components
|
|
167
|
+
*
|
|
168
|
+
* @param {string | undefined} errorState for the selected datetime value
|
|
169
|
+
* @param {string} actualValue present in redux
|
|
170
|
+
* @param {string} formattedValue retrieved by trimming ISO to just Date/Time, also applying timezone if DateTime
|
|
171
|
+
* @param {object} actions object which has fire and blur callbacks
|
|
172
|
+
* @param {string} propName name of the property bound
|
|
173
|
+
* @param {object} pConn component's PConnect object which is useful to invoke validationApi
|
|
174
|
+
*
|
|
175
|
+
* @returns {void}
|
|
176
|
+
*/
|
|
177
|
+
export const datetimeFireChangeBlurEvents = (
|
|
178
|
+
errorState,
|
|
179
|
+
actualValue,
|
|
180
|
+
formattedValue,
|
|
181
|
+
actions,
|
|
182
|
+
propName,
|
|
183
|
+
pConn
|
|
184
|
+
) => {
|
|
185
|
+
|
|
186
|
+
// TODO - clean up, we should not rely on timestamp from cosmos to check InComplete validation
|
|
187
|
+
// above triggerFieldChange should have validated this
|
|
188
|
+
if (errorState) {
|
|
189
|
+
pConn.getValidationApi().validate(errorState);
|
|
190
|
+
}
|
|
191
|
+
// BUG-640834 In errorState presist old values avoiding store update & re-render.
|
|
192
|
+
else{
|
|
193
|
+
if (formattedValue !== actualValue) {
|
|
194
|
+
actions.updateFieldValue(propName, formattedValue);
|
|
195
|
+
}
|
|
196
|
+
actions.triggerFieldChange(propName, formattedValue);
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Return Date format for the locale passed
|
|
202
|
+
*
|
|
203
|
+
* @param {string} locale locale string
|
|
204
|
+
* @param {object} options options for format string
|
|
205
|
+
* @returns {string} dateformat for the locale
|
|
206
|
+
* Example : getDateFormat("pl-PL") returns "DD.MM.YYYY"
|
|
207
|
+
*/
|
|
208
|
+
export const getDateFormat = (locale, options) => {
|
|
209
|
+
return new Intl.DateTimeFormat(locale, options)
|
|
210
|
+
.formatToParts()
|
|
211
|
+
.map(({ type, value }) => {
|
|
212
|
+
switch (type) {
|
|
213
|
+
case "day":
|
|
214
|
+
return "DD";
|
|
215
|
+
case "month":
|
|
216
|
+
return "MM";
|
|
217
|
+
case "year":
|
|
218
|
+
return "YYYY";
|
|
219
|
+
case "hour":
|
|
220
|
+
return "hh";
|
|
221
|
+
case "minute":
|
|
222
|
+
return "mm";
|
|
223
|
+
case "second":
|
|
224
|
+
return "ss";
|
|
225
|
+
case "dayPeriod":
|
|
226
|
+
return "A";
|
|
227
|
+
case "literal":
|
|
228
|
+
return value;
|
|
229
|
+
default:
|
|
230
|
+
return "";
|
|
231
|
+
}
|
|
232
|
+
})
|
|
233
|
+
.join("");
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Return boolean for the locale passed to specify if locale uses 12 hour format
|
|
238
|
+
*
|
|
239
|
+
* @param {string} locale locale string
|
|
240
|
+
* @returns {boolean} True or False for the locale
|
|
241
|
+
* Example : getDateFormat("pl-PL") returns false
|
|
242
|
+
*/
|
|
243
|
+
export const is12HClockFormat = (locale) => {
|
|
244
|
+
const meridiem = new Intl.DateTimeFormat(locale, {
|
|
245
|
+
hour: "numeric"
|
|
246
|
+
})
|
|
247
|
+
.formatToParts()
|
|
248
|
+
.find(({ type }) => type === "dayPeriod");
|
|
249
|
+
return !!(meridiem === null || meridiem === undefined
|
|
250
|
+
? undefined
|
|
251
|
+
: meridiem.value);
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* Return Option object for Time formatting
|
|
256
|
+
*
|
|
257
|
+
* @param {boolean} withSeconds true or false depending on seconds to be included
|
|
258
|
+
* @param {boolean} is12h 12 hour format
|
|
259
|
+
* @returns {object} options object time formatting
|
|
260
|
+
* Example : getTimeOptions(false, true) returns {hour: 'numeric',minute: 'numeric',hour12: true}
|
|
261
|
+
*/
|
|
262
|
+
export const getTimeOptions = (withSeconds, is12h = false) => {
|
|
263
|
+
return {
|
|
264
|
+
hour: "numeric",
|
|
265
|
+
minute: "numeric",
|
|
266
|
+
...(withSeconds && { second: "numeric" }),
|
|
267
|
+
hour12: is12h
|
|
268
|
+
};
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* Return Option object for Datetime formatting
|
|
273
|
+
*
|
|
274
|
+
* @param {boolean} withSeconds true or false depending on seconds to be included
|
|
275
|
+
* @param {boolean} is12h 12 hour format
|
|
276
|
+
* @returns {object} options object datetime formatting
|
|
277
|
+
* Example : getDateTimeOptions(false, true) returns {year: 'numeric',month: 'numeric',day: 'numeric',hour: 'numeric',minute: 'numeric',hour12: true}
|
|
278
|
+
*/
|
|
279
|
+
export const getDateTimeOptions = (withSeconds, is12h = false) => {
|
|
280
|
+
return {
|
|
281
|
+
year: "numeric",
|
|
282
|
+
month: "numeric",
|
|
283
|
+
day: "numeric",
|
|
284
|
+
...getTimeOptions(withSeconds, is12h)
|
|
285
|
+
};
|
|
286
|
+
};
|