diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 42cce276..982867ff 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -4,7 +4,6 @@ about: Create a report to help us improve title: '' labels: '' assignees: '' - --- **Describe the bug** @@ -15,6 +14,7 @@ What release version or branch are you experiencing the behavior **To Reproduce** Steps to reproduce the behavior: + 1. Create form... 2. Add component... 3. Use form... diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index bbcbbe7d..2f28cead 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -4,7 +4,6 @@ about: Suggest an idea for this project title: '' labels: '' assignees: '' - --- **Is your feature request related to a problem? Please describe.** diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 35ec1a47..1e393e0f 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -6,23 +6,23 @@ https://formio.atlassian.net/browse/FIO-XXXX **What changed?** -*Use this section to provide a summary description of the changes you've made* +_Use this section to provide a summary description of the changes you've made_ **Why have you chosen this solution?** -*Use this section to justify your choices* +_Use this section to justify your choices_ ## Breaking Changes / Backwards Compatibility -*Use this section to describe any potentially breaking changes this PR introduces or any effects this PR might have on backwards compatibility* +_Use this section to describe any potentially breaking changes this PR introduces or any effects this PR might have on backwards compatibility_ ## Dependencies -*Use this section to list any dependent changes/PRs in other Form.io modules* +_Use this section to list any dependent changes/PRs in other Form.io modules_ ## How has this PR been tested? -*Use this section to describe how you tested your changes; if you haven't included automated tests, justify your reasoning* +_Use this section to describe how you tested your changes; if you haven't included automated tests, justify your reasoning_ ## Checklist: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f2b0b447..35a36f8d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -94,7 +94,7 @@ jobs: run: | git fetch origin ${{ github.event.pull_request.base.ref }}:${{ github.event.pull_request.base.ref }} git merge ${{ github.event.pull_request.base.ref }} --no-commit --no-ff - + - name: Check for merge conflicts run: | if ! git merge --no-commit --no-ff ${{ github.event.pull_request.base.ref }}; then @@ -167,17 +167,17 @@ jobs: # Extract the pull request number and the short SHA of the commit PR_NUMBER=$(echo ${{ github.event.number }}) COMMIT_SHORT_SHA=$(echo "${{ github.event.pull_request.head.sha }}" | cut -c1-7) - + # Extract the current version from package.json CURRENT_VERSION=$(node -p "require('./package.json').version") - + # If the current version includes '-rc.', remove it and everything after # This step ensures that we start with a base version like '3.0.0' even if it was a release candidate BASE_VERSION=$(echo "$CURRENT_VERSION" | cut -d'-' -f1) - + # Construct the new version string NEW_VERSION="${BASE_VERSION}-dev.${PR_NUMBER}.${COMMIT_SHORT_SHA}" - + # Output the new version for use in subsequent GitHub Actions steps echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV @@ -188,4 +188,4 @@ jobs: - name: Publish to npm run: | npm version $NEW_VERSION - yarn publish --tag dev \ No newline at end of file + yarn publish --tag dev diff --git a/.husky/.gitignore b/.husky/.gitignore new file mode 100644 index 00000000..31354ec1 --- /dev/null +++ b/.husky/.gitignore @@ -0,0 +1 @@ +_ diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 00000000..2312dc58 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1 @@ +npx lint-staged diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 00000000..f5664018 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,11 @@ +/node_modules/ +/dist/ +/build/ +/lib/ +/artifacts/ +/coverage/ +/docs/ +.git/ +.nyc_output/ +.vscode/ +yarn.lock diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 00000000..554f2a3b --- /dev/null +++ b/.prettierrc @@ -0,0 +1,4 @@ +{ + "singleQuote": true, + "printWidth": 100 +} diff --git a/Changelog.md b/Changelog.md index 3ddf2628..377ef3c0 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,282 +1,364 @@ ## [Unreleased: 2.3.1-rc.1] + ### Changed - - Regression | Nested Form | Components in Nested forms should not validate hidden components without Validate When Hidden = true - - FIO-8807: fixed an issue where conditionals based on selectBoxes component do not work - - FIO-8778: add case for map component model type in filter; add tests - - FIO-8347: Added ability to skip mask validation - - FIO-8731: Update fix to nested hidden components - - FIO-8731: Fixes component gets validated when being in a hidden parent - - FIO-8273 fixed advanced logic for data components - - FIO-8730: Fix submission has hidden fields when 'Clear value when hidden' is checked - - FIO-8626: Updated conditionally hidden logic - - FIO-7733: update most form params to optional - - fixing child components being displayed when they should be removed when clearOnHide is set - - FIO-8639 fixed validation for select component if onlyAvailableItems is set to false - - FIO-8645: added tests and translations for validateRequiredDay - - FIO-8537: Fixing the filter processor to handle nested component data properly - - FIO-8597: fixed an issue with an empty array value for a number component with multiple values enabled - - FIO-8798: updated day component validation - - FIO-8885 & FIO-8886: use strict equality check for conditional component paths rather than Array.prototype.includes - - FIO-8810: fixed an issue where user unables to resubmit (change) the form with several levels of nested forms with required fields - - FIO-8848 fixed validation for TextArea with Save as Json - - FIO-8769: added check for the simpleConditional properties state - - FIO-8901: fixed incorrect handling of excessive rows in nested array model - - FIO-8912: update validateMultiple to account for model types - - fix formiojs tests - - FIO-8798: update normalization for day component - - FIO-8986 fixed validation for Day component with two hidden fields - - FIO-8912: updates to model types, naming - - FIO-8414: fixed required validation not working in Data Grid - - FIO-8986: fixed normalization for day with default value and hidden fields - - FIO-9059: fixed an issue where the string type returns for textarea with json type - - FIO-9033 tagpad data is not saved - - FIO-9028: update README - - FIO-9085: Fix components data removed from submission when conditional set for Address component value - - FIO-9055: separate rowPath from componentPath in getComponentActualValue fn - - FIO-8723: Clear values from submission for hidden comp with clearOnHide flag - - FIO-9143 fixed getValidationFormat error - - FIO-9002: fix issue with conditionally hidden duplicate nested form paths - - FIO-9085: Fix address submission logic - - FIO-8954: added Allow only available values validation for Data Source Type = URL + +- Regression | Nested Form | Components in Nested forms should not validate hidden components without Validate When Hidden = true +- FIO-8807: fixed an issue where conditionals based on selectBoxes component do not work +- FIO-8778: add case for map component model type in filter; add tests +- FIO-8347: Added ability to skip mask validation +- FIO-8731: Update fix to nested hidden components +- FIO-8731: Fixes component gets validated when being in a hidden parent +- FIO-8273 fixed advanced logic for data components +- FIO-8730: Fix submission has hidden fields when 'Clear value when hidden' is checked +- FIO-8626: Updated conditionally hidden logic +- FIO-7733: update most form params to optional +- fixing child components being displayed when they should be removed when clearOnHide is set +- FIO-8639 fixed validation for select component if onlyAvailableItems is set to false +- FIO-8645: added tests and translations for validateRequiredDay +- FIO-8537: Fixing the filter processor to handle nested component data properly +- FIO-8597: fixed an issue with an empty array value for a number component with multiple values enabled +- FIO-8798: updated day component validation +- FIO-8885 & FIO-8886: use strict equality check for conditional component paths rather than Array.prototype.includes +- FIO-8810: fixed an issue where user unables to resubmit (change) the form with several levels of nested forms with required fields +- FIO-8848 fixed validation for TextArea with Save as Json +- FIO-8769: added check for the simpleConditional properties state +- FIO-8901: fixed incorrect handling of excessive rows in nested array model +- FIO-8912: update validateMultiple to account for model types +- fix formiojs tests +- FIO-8798: update normalization for day component +- FIO-8986 fixed validation for Day component with two hidden fields +- FIO-8912: updates to model types, naming +- FIO-8414: fixed required validation not working in Data Grid +- FIO-8986: fixed normalization for day with default value and hidden fields +- FIO-9059: fixed an issue where the string type returns for textarea with json type +- FIO-9033 tagpad data is not saved +- FIO-9028: update README +- FIO-9085: Fix components data removed from submission when conditional set for Address component value +- FIO-9055: separate rowPath from componentPath in getComponentActualValue fn +- FIO-8723: Clear values from submission for hidden comp with clearOnHide flag +- FIO-9143 fixed getValidationFormat error +- FIO-9002: fix issue with conditionally hidden duplicate nested form paths +- FIO-9085: Fix address submission logic +- FIO-8954: added Allow only available values validation for Data Source Type = URL ## 2.3.0-rc.1 + ### Changed - - updated thresholds to current values - - FIO-8450: Fix custom error message for unique validation - - FIO-8598 fixed normalization of radio component values depending on storage type - - FIO-8650 -- returning empty array for empty edit grids - - FIO-8477: Fix the timezones issue in formatDate function - + +- updated thresholds to current values +- FIO-8450: Fix custom error message for unique validation +- FIO-8598 fixed normalization of radio component values depending on storage type +- FIO-8650 -- returning empty array for empty edit grids +- FIO-8477: Fix the timezones issue in formatDate function + ## 2.2.0-rc.1 + ### Changed - - FIO-8177: fix unsetting empty array values - - FIO-8185: Fixing issues with EditGrid and DataGrid clearOnHide with Conditionally visible elements - - FIO-8178: correctly add "validator" param to interpolated error object - - FIO-8121: Fix json and custom validation errors response - - FIO-8128: allow export of dist minified js - - FIO-8143: update eachComponent to be able to return proper pathing - - FIO-8210: fix nested form validation - - change filter processor to be more verbose and have compModelType in scope (replaces pull #78) - - FIO 7488: improve error handling - - Fixed required validation considering false value falsy (pull #31) - - Revert "Merge pull request #31 from ralfeis/master" - - FIO-8037: fixed an issue where number component can be sent text through API - - FIO-7964: add resource-based select component validation - - FIO-8218: Fix tests for PR 79 - - FIO-8218: add tests for FIO-8210 - - Fix/implement pattern message - - FIO-8128: adds includeAll flag to eachComponentData and eachComponentDataAsync - - FIO-7507: publish-dev-tag-to-npm - - FIO-8264: update validate required - - FIO-8336 fix validation on multiple values - - FIO-8037: added number component normalization - - FIO-8288: do not validate dates in textfield components with calendar widgets - - FIO-8254 fixed available values validation error for Select component - - FIO-8281: fixed sync validation error for select component with url data src - - update validate required recursion to not recurse when nested data type - - FIO-7675: remove Map Key From Core (cycled out) - - FIO-8027 added Cloudflare Turnstile as a captcha Provider - - Fixing the truncate multiple spaces so it does not mutate the data in the validation system - - FIO-8354: fallback to passing response in argument if response.body is undefined - - Changes to the Experimental Exports, and changes for 5.x Renderer - - Experimental component changes - - FIO-8597: fixed an issue with a blank value for a number component with multiple values enabled - - FIO-8512: fixed an issue where conditionally visible data inside layout components inside editGrid/dataGrid is unset on server side - - FIO-8316 invalid data submitted in nested form - - fix path/import issue with JSONLogicEvaluator +- FIO-8177: fix unsetting empty array values +- FIO-8185: Fixing issues with EditGrid and DataGrid clearOnHide with Conditionally visible elements +- FIO-8178: correctly add "validator" param to interpolated error object +- FIO-8121: Fix json and custom validation errors response +- FIO-8128: allow export of dist minified js +- FIO-8143: update eachComponent to be able to return proper pathing +- FIO-8210: fix nested form validation +- change filter processor to be more verbose and have compModelType in scope (replaces pull #78) +- FIO 7488: improve error handling +- Fixed required validation considering false value falsy (pull #31) +- Revert "Merge pull request #31 from ralfeis/master" +- FIO-8037: fixed an issue where number component can be sent text through API +- FIO-7964: add resource-based select component validation +- FIO-8218: Fix tests for PR 79 +- FIO-8218: add tests for FIO-8210 +- Fix/implement pattern message +- FIO-8128: adds includeAll flag to eachComponentData and eachComponentDataAsync +- FIO-7507: publish-dev-tag-to-npm +- FIO-8264: update validate required +- FIO-8336 fix validation on multiple values +- FIO-8037: added number component normalization +- FIO-8288: do not validate dates in textfield components with calendar widgets +- FIO-8254 fixed available values validation error for Select component +- FIO-8281: fixed sync validation error for select component with url data src +- update validate required recursion to not recurse when nested data type +- FIO-7675: remove Map Key From Core (cycled out) +- FIO-8027 added Cloudflare Turnstile as a captcha Provider +- Fixing the truncate multiple spaces so it does not mutate the data in the validation system +- FIO-8354: fallback to passing response in argument if response.body is undefined +- Changes to the Experimental Exports, and changes for 5.x Renderer +- Experimental component changes +- FIO-8597: fixed an issue with a blank value for a number component with multiple values enabled +- FIO-8512: fixed an issue where conditionally visible data inside layout components inside editGrid/dataGrid is unset on server side +- FIO-8316 invalid data submitted in nested form +- fix path/import issue with JSONLogicEvaluator ## 2.0.0-rc.24 + ### Changed - - FIO-8106: add default storeas value to tags - - FIO-8106: add invalidDate error translation + +- FIO-8106: add default storeas value to tags +- FIO-8106: add invalidDate error translation ## 2.0.0-rc.23 + ### Changed - - Fix: JSONLogic validations should get same context as calculations - + +- Fix: JSONLogic validations should get same context as calculations + ## 2.0.0-rc.22 + ### Changed - - FIO-7146: gh actions for repository - - FIO-8100: add clearhidden processor to cover logic, conditions, and custom - - FIO-8101: always process json validation even if value is falsy - - FIO-8107: correct small error in normalize processor - + +- FIO-7146: gh actions for repository +- FIO-8100: add clearhidden processor to cover logic, conditions, and custom +- FIO-8101: always process json validation even if value is falsy +- FIO-8107: correct small error in normalize processor + ## 2.0.0-rc.21 + ### Changed - - FIO-8092: update isEmpty to isComponentDataEmpty and account for differing component data types + +- FIO-8092: update isEmpty to isComponentDataEmpty and account for differing component data types ## 2.0.0-rc.20 + ### Changed - - FIO-8086: don't multiple validate select components - - FIO-8079: add stricter time validation - + +- FIO-8086: don't multiple validate select components +- FIO-8079: add stricter time validation + ## 2.0.0-rc.19 + ### Changed - - FIO-8047: add dereferencing processor for datatable comp - + +- FIO-8047: add dereferencing processor for datatable comp + ## 2.0.0-rc.18 + ### Changed - - FIO-8055: validate components that include custom validations, even when their data is empty - - FIO-8049: fix value prop in evaluations - - FIO-8040: add functions from formiojs - - restructure conditional processor to fix conditional components in emails + +- FIO-8055: validate components that include custom validations, even when their data is empty +- FIO-8049: fix value prop in evaluations +- FIO-8040: add functions from formiojs +- restructure conditional processor to fix conditional components in emails ## 2.0.0-rc.17 + ### Changed - - FIO-8023: Fixing issues with the parent traversal on deeply nested components within nested forms - + +- FIO-8023: Fixing issues with the parent traversal on deeply nested components within nested forms + ## 2.0.0-rc.16 - - FIO-7884: Fixed issues with processing data within nested form data structures + +- FIO-7884: Fixed issues with processing data within nested form data structures ## 2.0.0-rc.14 + ### Changed - - FIO-7884: Fixed an issue with nested form data where it would not set correctly - - FIO-7938: Fixing issues where components within Array components (like datagrid) would get the path of the first index assigned and would never update again - - FIO-7958: add asynchronous rule set - - FIO-7958: fix typo in normalize processor fn - - FIO-7998: add validate captcha rule - - FIO-7991: Fixing the time validation to use the dataFormat for validation, which is what the client passes along to the server - - skip processing if row is null or undefined + +- FIO-7884: Fixed an issue with nested form data where it would not set correctly +- FIO-7938: Fixing issues where components within Array components (like datagrid) would get the path of the first index assigned and would never update again +- FIO-7958: add asynchronous rule set +- FIO-7958: fix typo in normalize processor fn +- FIO-7998: add validate captcha rule +- FIO-7991: Fixing the time validation to use the dataFormat for validation, which is what the client passes along to the server +- skip processing if row is null or undefined ## 2.0.0-rc.13 - - FIO-7958: add normalize processor fn and derive context.value rather than mutate it directly - + +- FIO-7958: add normalize processor fn and derive context.value rather than mutate it directly + ## 2.0.0-rc.11 - - FIO-7883: include premium components in 'multiple' validation conditional - - FIO-7885: Make the core validator run the skipValidation checks similar to renderer checks - - fix calculation for nested forms - - FIO-7938: Fixing the fetch process to evaluate properly on the server - - FIO-7874: Fixed issues with 'Invalid Time' when submitting a time component - - FIO-7733: move unused 'experimental' features to a new folder and remove them f - - Processor changes to work with other forms and validation processes - - scopes updated and other little updates - - Adding processors for server-side data processing - - Ensure we do not 'append' jwt tokens but set them - + +- FIO-7883: include premium components in 'multiple' validation conditional +- FIO-7885: Make the core validator run the skipValidation checks similar to renderer checks +- fix calculation for nested forms +- FIO-7938: Fixing the fetch process to evaluate properly on the server +- FIO-7874: Fixed issues with 'Invalid Time' when submitting a time component +- FIO-7733: move unused 'experimental' features to a new folder and remove them f +- Processor changes to work with other forms and validation processes +- scopes updated and other little updates +- Adding processors for server-side data processing +- Ensure we do not 'append' jwt tokens but set them + ## 2.0.0-rc.10 + ### Breaking Changes - - This version of the renderer will now produce different "binary" build files. The following are created. - - dist/formio.core.js => The complete core binary. This used to be "dist/index.js". - - dist/formio.base.js => The base components of the core library. This used to be "dist/base/index.js" - - dist/formio.components.js => The extended components classes of the core library. This used to be "dist/components/index.js" - - dist/formio.model.js => This is the data model base classes for the renderer. This used to be "dist/model/index.js" - - dist/formio.modules.js => The different modules such as "jsonlogic" used when rendering. This used to be "dist/modules/index.js" - - dist/formio.js => The Formio SDK => this used to be "dist/sdk/index.js" - - dist/formio.utils.js => The Formio Utils library => this used to be "dist/utils/index.js" - - dist/formio.template.js => The template handling library => this used to be "dist/template/index.js" - - dist/formio.process.js => The processing engine, such as validation => this used to be "dist/process/index.js" - - - This version introduces the "processors" concept to our core library. This will become the "core" validation engine and data processing engine for - our renderer as well as server side logic. - - - This version introduces the "template" handling logic so that it can be used by other libraries to manage templates. + +- This version of the renderer will now produce different "binary" build files. The following are created. + + - dist/formio.core.js => The complete core binary. This used to be "dist/index.js". + - dist/formio.base.js => The base components of the core library. This used to be "dist/base/index.js" + - dist/formio.components.js => The extended components classes of the core library. This used to be "dist/components/index.js" + - dist/formio.model.js => This is the data model base classes for the renderer. This used to be "dist/model/index.js" + - dist/formio.modules.js => The different modules such as "jsonlogic" used when rendering. This used to be "dist/modules/index.js" + - dist/formio.js => The Formio SDK => this used to be "dist/sdk/index.js" + - dist/formio.utils.js => The Formio Utils library => this used to be "dist/utils/index.js" + - dist/formio.template.js => The template handling library => this used to be "dist/template/index.js" + - dist/formio.process.js => The processing engine, such as validation => this used to be "dist/process/index.js" + +- This version introduces the "processors" concept to our core library. This will become the "core" validation engine and data processing engine for + our renderer as well as server side logic. + +- This version introduces the "template" handling logic so that it can be used by other libraries to manage templates. ## 1.3.0-rc.22 + ### Fixed - - FIO-7462: fix failing tests + +- FIO-7462: fix failing tests ## 1.3.0-rc.20 + ### Changed - - Adding form and instance proxies + +- Adding form and instance proxies ## 1.3.0-rc.18 + ### Fixed - - revert accidental deletion of templateSettings + +- revert accidental deletion of templateSettings ## 1.3.0-rc.16 + ### Fixed - - Adding exports to libraries. + +- Adding exports to libraries. ## 1.3.0-rc.14 + ### Fixed - - Issue with invalid alias when loading a form with form revision. + +- Issue with invalid alias when loading a form with form revision. ## 1.3.0-rc.13 + ### Fixed - - FIO-6832: fixed issue where submission used wrong _fvid + +- FIO-6832: fixed issue where submission used wrong \_fvid ### Changed - - Upgrade all dependencies to latest versions. + +- Upgrade all dependencies to latest versions. ## 1.3.0-rc.9 - - Upgrade all dependencies to latest versions. + +- Upgrade all dependencies to latest versions. ## 1.3.0-rc.8 + ## 1.3.0-rc.7 + ### Fixed - - Fixed the ejs.js template import. + +- Fixed the ejs.js template import. ## 1.3.0-rc.6 + ### Changed - - Fixed the export lib to contain relative paths for easy import. + +- Fixed the export lib to contain relative paths for easy import. ## 1.3.0-rc.5 + ### Changed - - Fixing the lib to contain production build of js files. + +- Fixing the lib to contain production build of js files. ## 1.3.0-rc.4 + ### Changed - - "main" in package.json changed to "dist" to support imports into other libraries. + +- "main" in package.json changed to "dist" to support imports into other libraries. ## 1.3.0-rc.2 - 1.3.0-rc.3 + ### Changed - - Experiment with typescript paths and imports. + +- Experiment with typescript paths and imports. ## 1.3.0-rc.1 + ### Changed - - Added types for core formio entities - - Missing commits from formio.js implemented + +- Added types for core formio entities +- Missing commits from formio.js implemented ## 1.2.0 + ### Fixed - - FIO-6123: Added an array cleanup to the removeAttachedListeners method and wrote test for it + +- FIO-6123: Added an array cleanup to the removeAttachedListeners method and wrote test for it ## 1.1.0 + ### Changed - - FIO-5147: Added a check for an empty value + +- FIO-5147: Added a check for an empty value ## 1.0.0 + ### Changed - - Official Release + +- Official Release ## 1.0.0-rc.5 + ### Fixed - - FIO-3999: Fixed Data Table loading for IE11 + +- FIO-3999: Fixed Data Table loading for IE11 ## 1.0.0-rc.2 + ### Fixed - - FIO-599: Fixes no values on pdf download for components inside nested form - - FIO-2849: Fix: Evaluator does not interpolate expressions with optional chaining properly + +- FIO-599: Fixes no values on pdf download for components inside nested form +- FIO-2849: Fix: Evaluator does not interpolate expressions with optional chaining properly ## 0.0.8 + ### Changed - - Added override method. + +- Added override method. ## 0.0.7 + ### Changed - - Refactored array types. + +- Refactored array types. ## 0.0.6 + ### Changed - - Added a Components.render method. + +- Added a Components.render method. ## 0.0.5 + ### Changed - - How certain packages are imported. + +- How certain packages are imported. ## 0.0.4 + ### Chaanged - - Added unwind functionality and more functions to the utils. + +- Added unwind functionality and more functions to the utils. ## 0.0.3 + ### Changed - - Added some date conversion methods. + +- Added some date conversion methods. ## 0.0.2 + ### Changed - - Many refactorings and added data handling and basic inputs. + +- Many refactorings and added data handling and basic inputs. ## 0.0.1 + ### Changed - - Initial commit. + +- Initial commit. diff --git a/Readme.md b/Readme.md index b7720bf6..38aa71cd 100644 --- a/Readme.md +++ b/Readme.md @@ -31,54 +31,54 @@ To run a suite of processor functions on a form and a submission, the `process` import { processSync } from '@formio/core'; const form = { - display: 'form', - components: [ - { - type: 'textfield', - key: 'firstName', - label: 'First Name', - input: true, - }, - { - type: 'textfield', - key: 'lastName', - label: 'Last Name', - input: true, - }, - { - type: 'button', - key: 'submit', - action: 'submit', - label: 'Submit', - }, - ], + display: 'form', + components: [ + { + type: 'textfield', + key: 'firstName', + label: 'First Name', + input: true, + }, + { + type: 'textfield', + key: 'lastName', + label: 'Last Name', + input: true, + }, + { + type: 'button', + key: 'submit', + action: 'submit', + label: 'Submit', + }, + ], }; const submission = { - data: { - firstName: 'John', - lastName: 'Doe', - }, + data: { + firstName: 'John', + lastName: 'Doe', + }, }; const addExclamationSync = (context) => { - const { component, data, scope, path, value } = context; + const { component, data, scope, path, value } = context; - if (!scope.addExclamation) scope.addExclamation = {}; - let newValue = `${value}!`; + if (!scope.addExclamation) scope.addExclamation = {}; + let newValue = `${value}!`; - // The scope is a rolling "results" object that tracks which components have been operated on by which processor functions - scope.addExclamation[path] = true; - _.set(data, path, newValue); - return; + // The scope is a rolling "results" object that tracks which components have been operated on by which processor functions + scope.addExclamation[path] = true; + _.set(data, path, newValue); + return; }; // The context object is mutated depending on which component is being processed; after `processSync` it will contain the processed components and data const context = { - components: form.components, - data: submission.data, - processors: [{ processSync: addExclamationSync }], - scope: {}, + components: form.components, + data: submission.data, + processors: [{ processSync: addExclamationSync }], + scope: {}, }; // The `process` family of functions returns the scope object @@ -114,8 +114,8 @@ Next, you can create a new component as follows. ```js import { Components } from '@formio/core/experimental'; Components.addComponent({ - type: 'h3', - template: (ctx) => `
The Form.io Core Framework provides two plain JavaScript libraries described as the following.
++ The Form.io Core Framework provides two plain JavaScript libraries described as the + following. +
This is a library which allows JavaScript access to the Form.io API's.
-<script src="https://cdn.jsdelivr.net/npm/@formio/base@latest/dist/formio.min.js"></script>
+ This is a library which allows JavaScript access to the Form.io API's. +
++<script src="https://cdn.jsdelivr.net/npm/@formio/base@latest/dist/formio.min.js"></script>+
This library provides a framework for rendering JSON schemas within a web application.
-<script src="https://cdn.jsdelivr.net/npm/@formio/core@latest/dist/formio.core.min.js"></script>
+ This library provides a framework for rendering JSON schemas within a web application. +
++<script src="https://cdn.jsdelivr.net/npm/@formio/core@latest/dist/formio.core.min.js"></script>+
Examples | -Demo | +Examples | +Demo | -
---|---|
- Simple HTML Rendering-You can render a simple HTML element as follows: - - |
- - - - - | -
- Nested HTML Components-This allows you to created Nested HTML Components - - |
- - - - - | -
- Data Table Component-Provides an easy way to render a data table. - - |
- - - - - | -
- Input Component-Provides an easy way to add input components. - - |
- - - - - | -
- Input with Label-You can create an input with label by providing an htmlcontainer + html + input component. - - |
- - - - - | -
- Custom Component-Provides an easy way to create your own components. - - |
- - - - - | -
+ Simple HTML Rendering+You can render a simple HTML element as follows: + + |
+ + + + + | +
+ Nested HTML Components+This allows you to created Nested HTML Components + + |
+ + + + + | +
+ Data Table Component+Provides an easy way to render a data table. + + |
+ + + + + | +
+ Input Component+Provides an easy way to add input components. + + |
+ + + + + | +
+ Input with Label++ You can create an input with label by providing an htmlcontainer + html + input + component. + + + |
+ + + + + | +
+ Custom Component+Provides an easy way to create your own components. + + |
+ + + + + | +