@tsed/react-formio 3.0.0-alpha.1 → 3.0.0-alpha.10
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/dist/atoms/icon/Icon.d.ts +6 -0
- package/dist/atoms/icon/Icon.js +12 -0
- package/dist/atoms/icon/Icon.js.map +1 -0
- package/dist/chunks/_commonjsHelpers.js +7 -0
- package/dist/chunks/_commonjsHelpers.js.map +1 -0
- package/dist/chunks/index.js +16 -18
- package/dist/chunks/index.js.map +1 -1
- package/dist/chunks/index.module.js +56 -0
- package/dist/chunks/index.module.js.map +1 -0
- package/dist/chunks/react-select-animated.esm.js +3513 -0
- package/dist/chunks/react-select-animated.esm.js.map +1 -0
- package/dist/index.d.ts +0 -6
- package/dist/index.js +12 -105
- package/dist/index.js.map +1 -1
- package/dist/interfaces/ActionType.d.ts +23 -0
- package/dist/interfaces/ActionType.js +2 -0
- package/dist/interfaces/ActionType.js.map +1 -0
- package/dist/interfaces/ComponentType.d.ts +2 -0
- package/dist/interfaces/ComponentType.js +2 -0
- package/dist/interfaces/ComponentType.js.map +1 -0
- package/dist/interfaces/FormOptions.d.ts +3 -0
- package/dist/interfaces/{FormSchema.d.ts → FormType.d.ts} +3 -3
- package/dist/interfaces/FormType.js +2 -0
- package/dist/interfaces/FormType.js.map +1 -0
- package/dist/interfaces/Operation.d.ts +1 -2
- package/dist/interfaces/{RoleSchema.d.ts → RoleType.d.ts} +1 -1
- package/dist/interfaces/RoleType.js +2 -0
- package/dist/interfaces/RoleType.js.map +1 -0
- package/dist/interfaces/SubmissionType.d.ts +29 -0
- package/dist/interfaces/SubmissionType.js +2 -0
- package/dist/interfaces/SubmissionType.js.map +1 -0
- package/dist/interfaces/index.d.ts +5 -4
- package/dist/molecules/alert/Alert.d.ts +6 -0
- package/dist/{components/alert/alert.component.js → molecules/alert/Alert.js} +10 -7
- package/dist/molecules/alert/Alert.js.map +1 -0
- package/dist/molecules/button/Button.d.ts +8 -0
- package/dist/molecules/button/Button.js +52 -0
- package/dist/molecules/button/Button.js.map +1 -0
- package/dist/molecules/card/Card.js +12 -0
- package/dist/molecules/card/Card.js.map +1 -0
- package/dist/molecules/forms/form-control/FormControl.d.ts +17 -0
- package/dist/molecules/forms/form-control/FormControl.js +51 -0
- package/dist/molecules/forms/form-control/FormControl.js.map +1 -0
- package/dist/molecules/forms/input-tags/InputTags.d.ts +2 -0
- package/dist/molecules/forms/input-tags/InputTags.interface.d.ts +7 -0
- package/dist/molecules/forms/input-tags/InputTags.interface.js +2 -0
- package/dist/molecules/forms/input-tags/InputTags.interface.js.map +1 -0
- package/dist/molecules/forms/input-tags/InputTags.js +25 -0
- package/dist/molecules/forms/input-tags/InputTags.js.map +1 -0
- package/dist/molecules/forms/input-tags/all.d.ts +2 -0
- package/dist/molecules/forms/input-tags/all.js +9 -0
- package/dist/molecules/forms/input-tags/all.js.map +1 -0
- package/dist/molecules/forms/input-tags/components/ChoicesTags.d.ts +307 -0
- package/dist/molecules/forms/input-tags/components/ChoicesTags.js +51 -0
- package/dist/molecules/forms/input-tags/components/ChoicesTags.js.map +1 -0
- package/dist/molecules/forms/input-tags/components/ReactTags.d.ts +2 -0
- package/dist/molecules/forms/input-tags/components/ReactTags.js +1937 -0
- package/dist/molecules/forms/input-tags/components/ReactTags.js.map +1 -0
- package/dist/molecules/forms/input-text/InputText.d.ts +2 -0
- package/dist/molecules/forms/input-text/InputText.interface.d.ts +4 -0
- package/dist/molecules/forms/input-text/InputText.interface.js +2 -0
- package/dist/molecules/forms/input-text/InputText.interface.js.map +1 -0
- package/dist/molecules/forms/input-text/InputText.js +54 -0
- package/dist/molecules/forms/input-text/InputText.js.map +1 -0
- package/dist/molecules/forms/select/Select.d.ts +2 -0
- package/dist/molecules/forms/select/Select.interface.d.ts +38 -0
- package/dist/molecules/forms/select/Select.interface.js +2 -0
- package/dist/molecules/forms/select/Select.interface.js.map +1 -0
- package/dist/molecules/forms/select/Select.js +16 -0
- package/dist/molecules/forms/select/Select.js.map +1 -0
- package/dist/molecules/forms/select/all.d.ts +2 -0
- package/dist/molecules/forms/select/all.js +9 -0
- package/dist/molecules/forms/select/all.js.map +1 -0
- package/dist/molecules/forms/select/components/ChoicesSelect.d.ts +7 -0
- package/dist/molecules/forms/select/components/ChoicesSelect.js +115 -0
- package/dist/molecules/forms/select/components/ChoicesSelect.js.map +1 -0
- package/dist/molecules/forms/select/components/HtmlSelect.d.ts +2 -0
- package/dist/molecules/forms/select/components/HtmlSelect.js +35 -0
- package/dist/molecules/forms/select/components/HtmlSelect.js.map +1 -0
- package/dist/molecules/forms/select/components/ReactSelect.d.ts +2 -0
- package/dist/molecules/forms/select/components/ReactSelect.js +46 -0
- package/dist/molecules/forms/select/components/ReactSelect.js.map +1 -0
- package/dist/molecules/forms/select/components/choices.template.d.ts +7 -0
- package/dist/molecules/forms/select/components/choices.template.js +9654 -0
- package/dist/molecules/forms/select/components/choices.template.js.map +1 -0
- package/dist/molecules/forms/select/hooks/useOptions.d.ts +9 -0
- package/dist/molecules/forms/select/hooks/useOptions.js +35 -0
- package/dist/molecules/forms/select/hooks/useOptions.js.map +1 -0
- package/dist/{components/loader/loader.component.d.ts → molecules/loader/Loader.d.ts} +0 -9
- package/dist/molecules/loader/Loader.js +19 -0
- package/dist/molecules/loader/Loader.js.map +1 -0
- package/dist/{components/modal/modal.component.js → molecules/modal/Modal.js} +1 -1
- package/dist/molecules/modal/Modal.js.map +1 -0
- package/dist/{components/pagination/pagination.component.d.ts → molecules/pagination/Pagination.d.ts} +6 -5
- package/dist/molecules/pagination/Pagination.js +77 -0
- package/dist/molecules/pagination/Pagination.js.map +1 -0
- package/dist/molecules/pagination/PaginationButton.d.ts +7 -0
- package/dist/molecules/pagination/PaginationButton.js +21 -0
- package/dist/molecules/pagination/PaginationButton.js.map +1 -0
- package/dist/molecules/pagination/all.d.ts +2 -0
- package/dist/molecules/pagination/all.js +12 -0
- package/dist/molecules/pagination/all.js.map +1 -0
- package/dist/molecules/pagination/utils/getPageNumbers.js.map +1 -0
- package/dist/molecules/table/Table.d.ts +9 -0
- package/dist/molecules/table/Table.js +58 -0
- package/dist/molecules/table/Table.js.map +1 -0
- package/dist/molecules/table/all.d.ts +0 -0
- package/dist/molecules/table/all.js +19 -0
- package/dist/molecules/table/all.js.map +1 -0
- package/dist/molecules/table/components/DefaultArrowSort.d.ts +5 -0
- package/dist/molecules/table/components/DefaultArrowSort.js +22 -0
- package/dist/molecules/table/components/DefaultArrowSort.js.map +1 -0
- package/dist/molecules/table/components/DefaultCell.d.ts +5 -0
- package/dist/molecules/table/components/DefaultCell.js +13 -0
- package/dist/molecules/table/components/DefaultCell.js.map +1 -0
- package/dist/molecules/table/components/DefaultCellFooter.d.ts +6 -0
- package/dist/molecules/table/components/DefaultCellFooter.js +12 -0
- package/dist/molecules/table/components/DefaultCellFooter.js.map +1 -0
- package/dist/molecules/table/components/DefaultCellHeader.d.ts +6 -0
- package/dist/molecules/table/components/DefaultCellHeader.js +30 -0
- package/dist/molecules/table/components/DefaultCellHeader.js.map +1 -0
- package/dist/molecules/table/components/DefaultCellOperations.d.ts +10 -0
- package/dist/molecules/table/components/DefaultCellOperations.js +24 -0
- package/dist/molecules/table/components/DefaultCellOperations.js.map +1 -0
- package/dist/molecules/table/components/DefaultFilter.d.ts +11 -0
- package/dist/molecules/table/components/DefaultFilter.js +15 -0
- package/dist/molecules/table/components/DefaultFilter.js.map +1 -0
- package/dist/molecules/table/components/DefaultOperationButton.d.ts +11 -0
- package/dist/molecules/table/components/DefaultOperationButton.js +30 -0
- package/dist/molecules/table/components/DefaultOperationButton.js.map +1 -0
- package/dist/molecules/table/filters/Filters.d.js +2 -0
- package/dist/molecules/table/filters/Filters.d.js.map +1 -0
- package/dist/molecules/table/filters/RangeFilter.d.ts +3 -0
- package/dist/molecules/table/filters/RangeFilter.js +42 -0
- package/dist/molecules/table/filters/RangeFilter.js.map +1 -0
- package/dist/molecules/table/filters/SelectFilter.d.ts +3 -0
- package/dist/molecules/table/filters/SelectFilter.js +35 -0
- package/dist/molecules/table/filters/SelectFilter.js.map +1 -0
- package/dist/molecules/table/filters/TextFieldFilter.d.ts +3 -0
- package/dist/molecules/table/filters/TextFieldFilter.js +27 -0
- package/dist/molecules/table/filters/TextFieldFilter.js.map +1 -0
- package/dist/molecules/table/hooks/useTable.d.ts +15 -0
- package/dist/molecules/table/hooks/useTable.js +34 -0
- package/dist/molecules/table/hooks/useTable.js.map +1 -0
- package/dist/molecules/table/hooks/useUniqValues.d.ts +5 -0
- package/dist/molecules/table/hooks/useUniqValues.js +11 -0
- package/dist/molecules/table/hooks/useUniqValues.js.map +1 -0
- package/dist/molecules/table/interfaces/extends.d.ts +14 -0
- package/dist/molecules/table/interfaces/extends.js +2 -0
- package/dist/molecules/table/interfaces/extends.js.map +1 -0
- package/dist/molecules/table/utils/mapFormToColumns.d.ts +3 -0
- package/dist/molecules/table/utils/mapFormToColumns.js +39 -0
- package/dist/molecules/table/utils/mapFormToColumns.js.map +1 -0
- package/dist/{components/tabs/tabs.component.js → molecules/tabs/Tabs.js} +12 -12
- package/dist/molecules/tabs/Tabs.js.map +1 -0
- package/dist/organisms/form/Form.d.ts +22 -0
- package/dist/organisms/form/Form.js +15 -0
- package/dist/organisms/form/Form.js.map +1 -0
- package/dist/{components/form-access/formAccess.component.d.ts → organisms/form/access/FormAccess.d.ts} +2 -2
- package/dist/{components/form-access/formAccess.component.js → organisms/form/access/FormAccess.js} +4 -5
- package/dist/organisms/form/access/FormAccess.js.map +1 -0
- package/dist/organisms/form/access/FormAccess.schema.d.ts +4 -0
- package/dist/{components/form-access/formAccess.schema.js → organisms/form/access/FormAccess.schema.js} +1 -1
- package/dist/organisms/form/access/FormAccess.schema.js.map +1 -0
- package/dist/organisms/form/access/FormAccess.utils.d.ts +23 -0
- package/dist/{components/form-access/formAccess.utils.js → organisms/form/access/FormAccess.utils.js} +2 -2
- package/dist/organisms/form/access/FormAccess.utils.js.map +1 -0
- package/dist/{components/form-action/formAction.component.d.ts → organisms/form/action/FormAction.d.ts} +4 -4
- package/dist/{components/form-action/formAction.component.js → organisms/form/action/FormAction.js} +2 -2
- package/dist/organisms/form/action/FormAction.js.map +1 -0
- package/dist/organisms/form/builder/FormBuilder.d.ts +7 -0
- package/dist/organisms/form/builder/FormBuilder.js +17 -0
- package/dist/organisms/form/builder/FormBuilder.js.map +1 -0
- package/dist/organisms/form/builder/FormEdit.d.ts +8 -0
- package/dist/organisms/form/builder/FormEdit.js +70 -0
- package/dist/organisms/form/builder/FormEdit.js.map +1 -0
- package/dist/organisms/form/builder/FormEdit.reducer.d.ts +10 -0
- package/dist/{components/form-edit/formEdit.reducer.js → organisms/form/builder/FormEdit.reducer.js} +1 -1
- package/dist/organisms/form/builder/FormEdit.reducer.js.map +1 -0
- package/dist/organisms/form/builder/FormEditCtas.d.ts +15 -0
- package/dist/organisms/form/builder/FormEditCtas.js +52 -0
- package/dist/organisms/form/builder/FormEditCtas.js.map +1 -0
- package/dist/organisms/form/builder/FormParameters.d.ts +24 -0
- package/dist/organisms/form/builder/FormParameters.js +84 -0
- package/dist/organisms/form/builder/FormParameters.js.map +1 -0
- package/dist/organisms/form/builder/all.d.ts +6 -0
- package/dist/organisms/form/builder/all.js +26 -0
- package/dist/organisms/form/builder/all.js.map +1 -0
- package/dist/organisms/form/builder/useFormBuilder.d.ts +28 -0
- package/dist/organisms/form/builder/useFormBuilder.js +71 -0
- package/dist/organisms/form/builder/useFormBuilder.js.map +1 -0
- package/dist/{components/form-edit/useFormEdit.hook.d.ts → organisms/form/builder/useFormEdit.d.ts} +7 -7
- package/dist/{components/form-edit/useFormEdit.hook.js → organisms/form/builder/useFormEdit.js} +2 -2
- package/dist/organisms/form/builder/useFormEdit.js.map +1 -0
- package/dist/{components/form-settings/formSettings.component.d.ts → organisms/form/settings/FormSettings.d.ts} +2 -2
- package/dist/{components/form-settings/formSettings.component.js → organisms/form/settings/FormSettings.js} +4 -4
- package/dist/organisms/form/settings/FormSettings.js.map +1 -0
- package/dist/organisms/form/settings/FormSettings.schema.d.ts +2 -0
- package/dist/{components/form-settings/formSettings.schema.js → organisms/form/settings/FormSettings.schema.js} +1 -1
- package/dist/organisms/form/settings/FormSettings.schema.js.map +1 -0
- package/dist/organisms/form/settings/FormSettings.utils.d.ts +8 -0
- package/dist/{components/form-settings/formSettings.utils.js → organisms/form/settings/FormSettings.utils.js} +1 -1
- package/dist/organisms/form/settings/FormSettings.utils.js.map +1 -0
- package/dist/organisms/form/types.d.ts +15 -0
- package/dist/organisms/form/types.js +2 -0
- package/dist/organisms/form/types.js.map +1 -0
- package/dist/organisms/form/useForm.d.ts +65 -0
- package/dist/organisms/form/useForm.js +776 -0
- package/dist/organisms/form/useForm.js.map +1 -0
- package/dist/{components/modal/removeModal.component.d.ts → organisms/modal/RemoveModal.d.ts} +1 -1
- package/dist/{components/modal/removeModal.component.js → organisms/modal/RemoveModal.js} +10 -10
- package/dist/organisms/modal/RemoveModal.js.map +1 -0
- package/dist/organisms/table/actions/ActionsTable.d.ts +10 -0
- package/dist/organisms/table/actions/ActionsTable.js +46 -0
- package/dist/organisms/table/actions/ActionsTable.js.map +1 -0
- package/dist/organisms/table/forms/FormsTable.d.ts +9 -0
- package/dist/organisms/table/forms/FormsTable.js +57 -0
- package/dist/organisms/table/forms/FormsTable.js.map +1 -0
- package/dist/organisms/table/forms/components/FormsCell.d.ts +5 -0
- package/dist/organisms/table/forms/components/FormsCell.js +50 -0
- package/dist/organisms/table/forms/components/FormsCell.js.map +1 -0
- package/dist/organisms/table/submissions/SubmissionsTable.d.ts +6 -0
- package/dist/organisms/table/submissions/SubmissionsTable.js +11 -0
- package/dist/organisms/table/submissions/SubmissionsTable.js.map +1 -0
- package/dist/registries/components.d.ts +3 -0
- package/dist/registries/components.js +19 -0
- package/dist/registries/components.js.map +1 -0
- package/package.json +10 -8
- package/readme.md +27 -14
- package/src/atoms/icon/Icon.stories.tsx +124 -0
- package/src/atoms/icon/Icon.tsx +16 -0
- package/src/index.ts +1 -6
- package/src/interfaces/ActionType.ts +26 -0
- package/src/interfaces/ComponentType.ts +3 -0
- package/src/interfaces/FormOptions.ts +4 -1
- package/src/interfaces/{FormSchema.ts → FormType.ts} +3 -3
- package/src/interfaces/Operation.ts +2 -2
- package/src/interfaces/{RoleSchema.ts → RoleType.ts} +1 -1
- package/src/interfaces/SubmissionType.ts +20 -0
- package/src/interfaces/index.ts +5 -4
- package/src/molecules/__fixtures__/build.js +28 -0
- package/src/molecules/__fixtures__/form-firstname.fixture.json +256 -0
- package/src/molecules/__fixtures__/form-schema.json +350 -0
- package/src/molecules/__fixtures__/form-submissions.json +11942 -0
- package/src/molecules/__fixtures__/form-wizard.fixture.json +2042 -0
- package/src/molecules/__fixtures__/products.json +81539 -0
- package/src/molecules/__fixtures__/useValue.hook.ts +14 -0
- package/src/{components/alert/alert.component.spec.tsx → molecules/alert/Alert.spec.tsx} +12 -14
- package/src/molecules/alert/Alert.stories.tsx +39 -0
- package/src/{components/alert/alert.component.tsx → molecules/alert/Alert.tsx} +10 -7
- package/src/molecules/button/Button.stories.tsx +106 -0
- package/src/molecules/button/Button.tsx +54 -0
- package/src/{components/card/card.component.spec.tsx → molecules/card/Card.spec.tsx} +3 -2
- package/src/{components/card/card.stories.tsx → molecules/card/Card.stories.tsx} +9 -2
- package/src/{components/form-control/formControl.component.spec.tsx → molecules/forms/form-control/FormControl.spec.tsx} +9 -8
- package/src/molecules/forms/form-control/FormControl.stories.tsx +58 -0
- package/src/molecules/forms/form-control/FormControl.tsx +86 -0
- package/src/molecules/forms/input-tags/InputTags.interface.ts +9 -0
- package/src/molecules/forms/input-tags/InputTags.tsx +30 -0
- package/src/molecules/forms/input-tags/all.ts +6 -0
- package/src/molecules/forms/input-tags/components/ChoicesTags.stories.tsx +110 -0
- package/src/molecules/forms/input-tags/components/ChoicesTags.tsx +72 -0
- package/src/molecules/forms/input-tags/components/ReactTags.stories.tsx +140 -0
- package/src/molecules/forms/input-tags/components/ReactTags.tsx +38 -0
- package/src/molecules/forms/input-text/InputText.interface.ts +5 -0
- package/src/{components/input-text/inputText.component.spec.tsx → molecules/forms/input-text/InputText.spec.tsx} +8 -7
- package/src/molecules/forms/input-text/InputText.stories.tsx +179 -0
- package/src/molecules/forms/input-text/InputText.tsx +63 -0
- package/src/molecules/forms/select/Select.interface.ts +45 -0
- package/src/molecules/forms/select/Select.tsx +28 -0
- package/src/molecules/forms/select/all.ts +7 -0
- package/src/molecules/forms/select/components/ChoicesSelect.stories.tsx +332 -0
- package/src/molecules/forms/select/components/ChoicesSelect.tsx +159 -0
- package/src/molecules/forms/select/components/HtmlSelect.stories.tsx +305 -0
- package/src/molecules/forms/select/components/HtmlSelect.tsx +54 -0
- package/src/molecules/forms/select/components/ReactSelect.stories.tsx +287 -0
- package/src/molecules/forms/select/components/ReactSelect.tsx +60 -0
- package/src/molecules/forms/select/components/choices.template.tsx +38 -0
- package/src/molecules/forms/select/hooks/useOptions.spec.ts +154 -0
- package/src/molecules/forms/select/hooks/useOptions.ts +53 -0
- package/src/{components/loader/loader.component.spec.tsx → molecules/loader/Loader.spec.tsx} +3 -3
- package/src/molecules/loader/Loader.stories.tsx +43 -0
- package/src/{components/loader/loader.component.tsx → molecules/loader/Loader.tsx} +2 -10
- package/src/{components/modal/modal.component.spec.tsx → molecules/modal/Modal.spec.tsx} +131 -4
- package/src/molecules/modal/Modal.stories.tsx +178 -0
- package/src/{components/pagination/pagination.component.spec.tsx → molecules/pagination/Pagination.spec.tsx} +20 -14
- package/src/molecules/pagination/Pagination.stories.tsx +99 -0
- package/src/{components/pagination/pagination.component.tsx → molecules/pagination/Pagination.tsx} +34 -47
- package/src/molecules/pagination/PaginationButton.tsx +30 -0
- package/src/molecules/pagination/all.ts +3 -0
- package/src/molecules/table/Table.stories.tsx +272 -0
- package/src/molecules/table/Table.tsx +100 -0
- package/src/molecules/table/all.ts +16 -0
- package/src/molecules/table/components/DefaultArrowSort.tsx +26 -0
- package/src/molecules/table/components/DefaultCell.tsx +22 -0
- package/src/molecules/table/components/DefaultCellFooter.tsx +16 -0
- package/src/molecules/table/components/DefaultCellHeader.tsx +42 -0
- package/src/molecules/table/components/DefaultCellOperations.tsx +42 -0
- package/src/molecules/table/components/DefaultFilter.tsx +42 -0
- package/src/molecules/table/components/DefaultOperationButton.tsx +40 -0
- package/src/molecules/table/filters/Filters.d.ts +31 -0
- package/src/molecules/table/filters/RangeFilter.tsx +43 -0
- package/src/molecules/table/filters/SelectFilter.tsx +47 -0
- package/src/molecules/table/filters/TextFieldFilter.tsx +36 -0
- package/src/molecules/table/hooks/useTable.tsx +75 -0
- package/src/molecules/table/hooks/useUniqValues.tsx +10 -0
- package/src/molecules/table/interfaces/extends.ts +18 -0
- package/src/molecules/table/utils/mapFormToColumns.tsx +74 -0
- package/src/{components/tabs/tabs.component.spec.tsx → molecules/tabs/Tabs.spec.tsx} +4 -4
- package/src/molecules/tabs/Tabs.stories.tsx +141 -0
- package/src/organisms/__fixtures__/WrapComponent.tsx +11 -0
- package/src/organisms/__fixtures__/form-actions.json +240 -0
- package/src/organisms/__fixtures__/form-firstname.fixture.json +256 -0
- package/src/organisms/__fixtures__/form-wizard.fixture.json +2042 -0
- package/src/organisms/__fixtures__/form.fixture.json +2067 -0
- package/src/organisms/__fixtures__/useEditForm.tsx +84 -0
- package/src/organisms/__fixtures__/utils.ts +74 -0
- package/src/{components/form/form.component.spec.tsx → organisms/form/Form.spec.tsx} +5 -6
- package/src/organisms/form/Form.stories.tsx +698 -0
- package/src/organisms/form/Form.tsx +29 -0
- package/src/{components/form-access/formAccess.schema.ts → organisms/form/access/FormAccess.schema.ts} +4 -6
- package/src/{components/form-access/formAccess.stories.tsx → organisms/form/access/FormAccess.stories.tsx} +8 -2
- package/src/{components/form-access/formAccess.component.tsx → organisms/form/access/FormAccess.tsx} +15 -17
- package/src/{components/form-access/formAccess.utils.spec.ts → organisms/form/access/FormAccess.utils.spec.ts} +13 -7
- package/src/{components/form-access/formAccess.utils.ts → organisms/form/access/FormAccess.utils.ts} +23 -20
- package/src/{components/form-action/formAction.stories.tsx → organisms/form/action/FormAction.stories.tsx} +11 -11
- package/src/{components/form-action/formAction.component.tsx → organisms/form/action/FormAction.tsx} +7 -7
- package/src/organisms/form/builder/FormBuilder.stories.tsx +97 -0
- package/src/organisms/form/builder/FormBuilder.tsx +28 -0
- package/src/{components/form-edit/formEdit.reducer.ts → organisms/form/builder/FormEdit.reducer.ts} +6 -6
- package/src/{components/form-edit/formEdit.stories.tsx → organisms/form/builder/FormEdit.stories.tsx} +89 -43
- package/src/organisms/form/builder/FormEdit.tsx +75 -0
- package/src/organisms/form/builder/FormEditCtas.tsx +97 -0
- package/src/{components/form-edit/formParameters.component.tsx → organisms/form/builder/FormParameters.tsx} +28 -28
- package/src/organisms/form/builder/all.ts +17 -0
- package/src/organisms/form/builder/useFormBuilder.ts +143 -0
- package/src/{components/form-edit/useFormEdit.hook.ts → organisms/form/builder/useFormEdit.ts} +8 -8
- package/src/{components/form-settings/formSettings.component.spec.tsx → organisms/form/settings/FormSettings.component.spec.tsx} +2 -2
- package/src/{components/form-settings/formSettings.schema.ts → organisms/form/settings/FormSettings.schema.ts} +2 -2
- package/src/{components/form-settings/formSettings.stories.tsx → organisms/form/settings/FormSettings.stories.tsx} +10 -8
- package/src/{components/form-settings/formSettings.component.tsx → organisms/form/settings/FormSettings.tsx} +7 -8
- package/src/{components/form-settings/formSettings.utils.spec.ts → organisms/form/settings/FormSettings.utils.spec.ts} +1 -1
- package/src/{components/form-settings/formSettings.utils.ts → organisms/form/settings/FormSettings.utils.ts} +4 -4
- package/src/organisms/form/types.ts +8 -0
- package/src/organisms/form/useForm.ts +223 -0
- package/src/organisms/modal/RemoveModal.stories.tsx +59 -0
- package/src/{components/modal/removeModal.component.tsx → organisms/modal/RemoveModal.tsx} +2 -2
- package/src/{components/actions-table/actionsTable.component.spec.tsx → organisms/table/actions/ActionsTable.spec.tsx} +11 -7
- package/src/{components/actions-table/actionsTable.stories.tsx → organisms/table/actions/ActionsTable.stories.tsx} +22 -24
- package/src/{components/actions-table/actionsTable.component.tsx → organisms/table/actions/ActionsTable.tsx} +13 -20
- package/src/{components/forms-table/formsTable.stories.tsx → organisms/table/forms/FormsTable.stories.tsx} +24 -27
- package/src/organisms/table/forms/FormsTable.tsx +66 -0
- package/src/organisms/table/forms/components/FormsCell.tsx +53 -0
- package/src/{components/submissions-table/submissionsTable.stories.tsx → organisms/table/submissions/SubmissionsTable.stories.tsx} +24 -27
- package/src/organisms/table/submissions/SubmissionsTable.tsx +13 -0
- package/src/registries/components.ts +23 -0
- package/tsconfig.app.json +1 -1
- package/tsconfig.json +3 -0
- package/tsconfig.node.json +13 -0
- package/dist/components/actions-table/actionsTable.component.d.ts +0 -10
- package/dist/components/actions-table/actionsTable.component.js +0 -53
- package/dist/components/actions-table/actionsTable.component.js.map +0 -1
- package/dist/components/alert/alert.component.d.ts +0 -5
- package/dist/components/alert/alert.component.js.map +0 -1
- package/dist/components/card/card.component.js +0 -12
- package/dist/components/card/card.component.js.map +0 -1
- package/dist/components/form/form.component.d.ts +0 -62
- package/dist/components/form/form.component.js +0 -64
- package/dist/components/form/form.component.js.map +0 -1
- package/dist/components/form/useForm.hook.d.ts +0 -59
- package/dist/components/form/useForm.hook.js +0 -64
- package/dist/components/form/useForm.hook.js.map +0 -1
- package/dist/components/form-access/formAccess.component.js.map +0 -1
- package/dist/components/form-access/formAccess.schema.d.ts +0 -5
- package/dist/components/form-access/formAccess.schema.js.map +0 -1
- package/dist/components/form-access/formAccess.utils.d.ts +0 -24
- package/dist/components/form-access/formAccess.utils.js.map +0 -1
- package/dist/components/form-action/formAction.component.js.map +0 -1
- package/dist/components/form-builder/formBuilder.component.d.ts +0 -53
- package/dist/components/form-builder/formBuilder.component.js +0 -142
- package/dist/components/form-builder/formBuilder.component.js.map +0 -1
- package/dist/components/form-control/formControl.component.d.ts +0 -14
- package/dist/components/form-control/formControl.component.js +0 -26
- package/dist/components/form-control/formControl.component.js.map +0 -1
- package/dist/components/form-edit/formCtas.component.d.ts +0 -28
- package/dist/components/form-edit/formCtas.component.js +0 -70
- package/dist/components/form-edit/formCtas.component.js.map +0 -1
- package/dist/components/form-edit/formEdit.component.d.ts +0 -18
- package/dist/components/form-edit/formEdit.component.js +0 -57
- package/dist/components/form-edit/formEdit.component.js.map +0 -1
- package/dist/components/form-edit/formEdit.reducer.d.ts +0 -10
- package/dist/components/form-edit/formEdit.reducer.js.map +0 -1
- package/dist/components/form-edit/formParameters.component.d.ts +0 -34
- package/dist/components/form-edit/formParameters.component.js +0 -92
- package/dist/components/form-edit/formParameters.component.js.map +0 -1
- package/dist/components/form-edit/useFormEdit.hook.js.map +0 -1
- package/dist/components/form-settings/formSettings.component.js.map +0 -1
- package/dist/components/form-settings/formSettings.schema.d.ts +0 -2
- package/dist/components/form-settings/formSettings.schema.js.map +0 -1
- package/dist/components/form-settings/formSettings.utils.d.ts +0 -8
- package/dist/components/form-settings/formSettings.utils.js.map +0 -1
- package/dist/components/forms-table/components/formCell.component.d.ts +0 -6
- package/dist/components/forms-table/components/formCell.component.js +0 -50
- package/dist/components/forms-table/components/formCell.component.js.map +0 -1
- package/dist/components/forms-table/formsTable.component.d.ts +0 -10
- package/dist/components/forms-table/formsTable.component.js +0 -29
- package/dist/components/forms-table/formsTable.component.js.map +0 -1
- package/dist/components/index.d.ts +0 -25
- package/dist/components/index.js +0 -86
- package/dist/components/index.js.map +0 -1
- package/dist/components/input-tags/inputTags.component.d.ts +0 -18
- package/dist/components/input-tags/inputTags.component.js +0 -37
- package/dist/components/input-tags/inputTags.component.js.map +0 -1
- package/dist/components/input-text/inputText.component.d.ts +0 -27
- package/dist/components/input-text/inputText.component.js +0 -70
- package/dist/components/input-text/inputText.component.js.map +0 -1
- package/dist/components/loader/loader.component.js +0 -26
- package/dist/components/loader/loader.component.js.map +0 -1
- package/dist/components/modal/modal.component.js.map +0 -1
- package/dist/components/modal/removeModal.component.js.map +0 -1
- package/dist/components/pagination/pagination.component.js +0 -87
- package/dist/components/pagination/pagination.component.js.map +0 -1
- package/dist/components/select/select.component.d.ts +0 -14
- package/dist/components/select/select.component.js +0 -60
- package/dist/components/select/select.component.js.map +0 -1
- package/dist/components/submissions-table/submissionsTable.component.d.ts +0 -6
- package/dist/components/submissions-table/submissionsTable.component.js +0 -11
- package/dist/components/submissions-table/submissionsTable.component.js.map +0 -1
- package/dist/components/table/components/defaultArrowSort.component.d.ts +0 -1
- package/dist/components/table/components/defaultArrowSort.component.js +0 -10
- package/dist/components/table/components/defaultArrowSort.component.js.map +0 -1
- package/dist/components/table/components/defaultCell.component.d.ts +0 -1
- package/dist/components/table/components/defaultCell.component.js +0 -11
- package/dist/components/table/components/defaultCell.component.js.map +0 -1
- package/dist/components/table/components/defaultCellHeader.component.d.ts +0 -5
- package/dist/components/table/components/defaultCellHeader.component.js +0 -14
- package/dist/components/table/components/defaultCellHeader.component.js.map +0 -1
- package/dist/components/table/components/defaultCellOperations.component.d.ts +0 -12
- package/dist/components/table/components/defaultCellOperations.component.js +0 -21
- package/dist/components/table/components/defaultCellOperations.component.js.map +0 -1
- package/dist/components/table/components/defaultCells.component.d.ts +0 -4
- package/dist/components/table/components/defaultCells.component.js +0 -23
- package/dist/components/table/components/defaultCells.component.js.map +0 -1
- package/dist/components/table/components/defaultOperationButton.component.d.ts +0 -15
- package/dist/components/table/components/defaultOperationButton.component.js +0 -45
- package/dist/components/table/components/defaultOperationButton.component.js.map +0 -1
- package/dist/components/table/components/defaultRow.component.d.ts +0 -12
- package/dist/components/table/components/defaultRow.component.js +0 -25
- package/dist/components/table/components/defaultRow.component.js.map +0 -1
- package/dist/components/table/components/dragNDropContainer.d.ts +0 -4
- package/dist/components/table/components/dragNDropContainer.js +0 -10
- package/dist/components/table/components/dragNDropContainer.js.map +0 -1
- package/dist/components/table/filters/defaultColumnFilter.component.d.ts +0 -5
- package/dist/components/table/filters/defaultColumnFilter.component.js +0 -32
- package/dist/components/table/filters/defaultColumnFilter.component.js.map +0 -1
- package/dist/components/table/filters/selectColumnFilter.component.d.ts +0 -10
- package/dist/components/table/filters/selectColumnFilter.component.js +0 -34
- package/dist/components/table/filters/selectColumnFilter.component.js.map +0 -1
- package/dist/components/table/filters/sliderColumnFilter.component.d.ts +0 -2
- package/dist/components/table/filters/sliderColumnFilter.component.js +0 -27
- package/dist/components/table/filters/sliderColumnFilter.component.js.map +0 -1
- package/dist/components/table/hooks/useCustomTable.hook.d.ts +0 -128
- package/dist/components/table/hooks/useCustomTable.hook.js +0 -130
- package/dist/components/table/hooks/useCustomTable.hook.js.map +0 -1
- package/dist/components/table/hooks/useDragnDropRow.hook.d.ts +0 -272
- package/dist/components/table/hooks/useDragnDropRow.hook.js +0 -40
- package/dist/components/table/hooks/useDragnDropRow.hook.js.map +0 -1
- package/dist/components/table/hooks/useOperations.hook.d.ts +0 -11
- package/dist/components/table/hooks/useOperations.hook.js +0 -25
- package/dist/components/table/hooks/useOperations.hook.js.map +0 -1
- package/dist/components/table/index.d.ts +0 -15
- package/dist/components/table/index.js +0 -35
- package/dist/components/table/index.js.map +0 -1
- package/dist/components/table/table.component.d.ts +0 -3
- package/dist/components/table/table.component.js +0 -81
- package/dist/components/table/table.component.js.map +0 -1
- package/dist/components/table/utils/getPageNumbers.js.map +0 -1
- package/dist/components/table/utils/mapFormToColumns.d.ts +0 -3
- package/dist/components/table/utils/mapFormToColumns.js +0 -23
- package/dist/components/table/utils/mapFormToColumns.js.map +0 -1
- package/dist/components/table/utils/swapElements.d.ts +0 -1
- package/dist/components/table/utils/swapElements.js +0 -5
- package/dist/components/table/utils/swapElements.js.map +0 -1
- package/dist/components/tabs/tabs.component.js.map +0 -1
- package/dist/interfaces/ActionSchema.d.ts +0 -23
- package/dist/interfaces/ActionSchema.js +0 -2
- package/dist/interfaces/ActionSchema.js.map +0 -1
- package/dist/interfaces/FormSchema.js +0 -2
- package/dist/interfaces/FormSchema.js.map +0 -1
- package/dist/interfaces/RoleSchema.js +0 -2
- package/dist/interfaces/RoleSchema.js.map +0 -1
- package/dist/interfaces/Submission.d.ts +0 -5
- package/dist/interfaces/Submission.js +0 -2
- package/dist/interfaces/Submission.js.map +0 -1
- package/dist/utils/callLast.d.ts +0 -1
- package/dist/utils/callLast.js +0 -10
- package/dist/utils/callLast.js.map +0 -1
- package/src/components/alert/alert.stories.tsx +0 -16
- package/src/components/form/form.component.tsx +0 -72
- package/src/components/form/form.stories.tsx +0 -253
- package/src/components/form/useForm.hook.ts +0 -216
- package/src/components/form-builder/formBuilder.component.tsx +0 -195
- package/src/components/form-builder/formBuilder.stories.tsx +0 -3665
- package/src/components/form-control/formControl.component.tsx +0 -58
- package/src/components/form-control/formControl.stories.tsx +0 -63
- package/src/components/form-edit/formCtas.component.tsx +0 -106
- package/src/components/form-edit/formEdit.component.tsx +0 -59
- package/src/components/forms-table/components/formCell.component.tsx +0 -47
- package/src/components/forms-table/formsTable.component.tsx +0 -40
- package/src/components/index.ts +0 -25
- package/src/components/input-tags/inputTags.component.tsx +0 -58
- package/src/components/input-tags/inputTags.stories.tsx +0 -97
- package/src/components/input-text/inputText.component.tsx +0 -85
- package/src/components/input-text/inputText.stories.tsx +0 -126
- package/src/components/loader/loader.stories.tsx +0 -16
- package/src/components/modal/modal.stories.tsx +0 -190
- package/src/components/pagination/pagination.stories.tsx +0 -40
- package/src/components/select/select.component.spec.tsx +0 -84
- package/src/components/select/select.component.tsx +0 -88
- package/src/components/select/select.stories.tsx +0 -173
- package/src/components/submissions-table/submissionsTable.component.tsx +0 -14
- package/src/components/table/components/defaultArrowSort.component.tsx +0 -10
- package/src/components/table/components/defaultCell.component.tsx +0 -13
- package/src/components/table/components/defaultCellHeader.component.tsx +0 -18
- package/src/components/table/components/defaultCellOperations.component.tsx +0 -37
- package/src/components/table/components/defaultCells.component.tsx +0 -30
- package/src/components/table/components/defaultOperationButton.component.tsx +0 -56
- package/src/components/table/components/defaultRow.component.tsx +0 -51
- package/src/components/table/components/dragNDropContainer.tsx +0 -7
- package/src/components/table/filters/defaultColumnFilter.component.spec.tsx +0 -31
- package/src/components/table/filters/defaultColumnFilter.component.tsx +0 -39
- package/src/components/table/filters/selectColumnFilter.component.spec.tsx +0 -66
- package/src/components/table/filters/selectColumnFilter.component.tsx +0 -51
- package/src/components/table/filters/sliderColumnFilter.component.tsx +0 -28
- package/src/components/table/hooks/useCustomTable.hook.tsx +0 -268
- package/src/components/table/hooks/useDragnDropRow.hook.ts +0 -80
- package/src/components/table/hooks/useOperations.hook.tsx +0 -39
- package/src/components/table/index.ts +0 -15
- package/src/components/table/table.component.tsx +0 -100
- package/src/components/table/table.stories.tsx +0 -120
- package/src/components/table/utils/mapFormToColumns.tsx +0 -33
- package/src/components/table/utils/swapElements.spec.ts +0 -7
- package/src/components/table/utils/swapElements.ts +0 -7
- package/src/components/tabs/tabs.component.stories.tsx +0 -127
- package/src/interfaces/ActionSchema.ts +0 -26
- package/src/interfaces/Submission.ts +0 -5
- package/src/utils/callLast.ts +0 -12
- /package/dist/{components/card/card.component.d.ts → molecules/card/Card.d.ts} +0 -0
- /package/dist/{components/modal/modal.component.d.ts → molecules/modal/Modal.d.ts} +0 -0
- /package/dist/{components/table → molecules/pagination}/utils/getPageNumbers.d.ts +0 -0
- /package/dist/{components/table → molecules/pagination}/utils/getPageNumbers.js +0 -0
- /package/dist/{components/tabs/tabs.component.d.ts → molecules/tabs/Tabs.d.ts} +0 -0
- /package/src/{components → molecules}/__fixtures__/form-actions.json +0 -0
- /package/src/{components → molecules}/__fixtures__/form.fixture.json +0 -0
- /package/src/{components/card/card.component.tsx → molecules/card/Card.tsx} +0 -0
- /package/src/{components/modal/modal.component.tsx → molecules/modal/Modal.tsx} +0 -0
- /package/src/{components/table → molecules/pagination}/utils/getPageNumbers.ts +0 -0
- /package/src/{components/tabs/tabs.component.tsx → molecules/tabs/Tabs.tsx} +0 -0
- /package/src/{components → organisms}/__fixtures__/form-schema.json +0 -0
- /package/src/{components → organisms}/__fixtures__/form-submissions.json +0 -0
- /package/src/{components/actions-table → organisms/table/actions}/__fixtures__/data.json +0 -0
|
@@ -0,0 +1,698 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { expect, fn, userEvent, waitFor, within } from "@storybook/test";
|
|
3
|
+
import { useEffect, useState } from "react";
|
|
4
|
+
|
|
5
|
+
import { SubmissionType } from "../../interfaces";
|
|
6
|
+
import { InputText } from "../../molecules/forms/input-text/InputText";
|
|
7
|
+
import form from "../__fixtures__/form.fixture.json";
|
|
8
|
+
import formFirstname from "../__fixtures__/form-firstname.fixture.json";
|
|
9
|
+
import { useEditForm } from "../__fixtures__/useEditForm";
|
|
10
|
+
import { Form } from "./Form";
|
|
11
|
+
|
|
12
|
+
async function delay(number: number) {
|
|
13
|
+
return new Promise((resolve) => {
|
|
14
|
+
setTimeout(resolve, number);
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* The form component is the primary component of the system. It is what takes the form definition (json) and renders the
|
|
20
|
+
* form into html. There are multiple ways to send the form to the Form component. The two main ways are to pass the `src`
|
|
21
|
+
* prop with an url to the form definition, usually a form.io server. The other is to pass the `form` prop with the json
|
|
22
|
+
* definition and optionally a `url` prop with the location of the form.
|
|
23
|
+
*
|
|
24
|
+
* ```tsx
|
|
25
|
+
* import {Form} from "@tsed/react-formio/organisms/form/Form";
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export default {
|
|
29
|
+
title: "form/Form",
|
|
30
|
+
component: Form,
|
|
31
|
+
argTypes: {
|
|
32
|
+
form: {
|
|
33
|
+
description:
|
|
34
|
+
"Instead of loading a form from the `src` url, you can preload the form definition and pass it in with the `form` prop. You should also set `url` if you are using any advanced components like file upload or oauth.",
|
|
35
|
+
control: "object"
|
|
36
|
+
},
|
|
37
|
+
src: {
|
|
38
|
+
description:
|
|
39
|
+
"The src of the form definition. This is commonly from a form.io server. When using src, the form will automatically submit the data to that url as well.",
|
|
40
|
+
control: "text"
|
|
41
|
+
},
|
|
42
|
+
url: {
|
|
43
|
+
description:
|
|
44
|
+
"The url of the form definition. The form will not be loaded from this url and the submission will not be saved here either. This is used for file upload, oauth and other components or actions that need to know where the server is. Use this in connection with `form`",
|
|
45
|
+
control: "text"
|
|
46
|
+
},
|
|
47
|
+
submission: {
|
|
48
|
+
description:
|
|
49
|
+
"Submission data to fill the form. You can either load a previous submission or create a submission with some pre-filled data. If you do not provide a submissions the form will initialize an empty submission using default values from the form.",
|
|
50
|
+
control: "object"
|
|
51
|
+
},
|
|
52
|
+
options: {
|
|
53
|
+
description:
|
|
54
|
+
"An options object that can pass options to the formio.js Form that is rendered. You can set options such as `readOnly`, `noAlerts` or `hide`. There are [many options to be found in the formio.js library](https://github.com/formio/formio.js/wiki/Form-Renderer#options).",
|
|
55
|
+
control: "object"
|
|
56
|
+
},
|
|
57
|
+
className: {
|
|
58
|
+
control: "text"
|
|
59
|
+
},
|
|
60
|
+
style: {
|
|
61
|
+
control: "object"
|
|
62
|
+
},
|
|
63
|
+
// onFormReady: {
|
|
64
|
+
// description:
|
|
65
|
+
// "A callback function that gets called when the form has rendered. It is useful for accessing the underlying @formio/js Webform instance.",
|
|
66
|
+
// action: "onFormReady"
|
|
67
|
+
// },
|
|
68
|
+
onPrevPage: {
|
|
69
|
+
description: 'A callback function for Wizard forms that gets called when the "Previous" button is pressed.',
|
|
70
|
+
action: "onPrevPage"
|
|
71
|
+
},
|
|
72
|
+
onNextPage: {
|
|
73
|
+
description: 'A callback function for Wizard forms that gets called when the "Next" button is pressed.',
|
|
74
|
+
action: "onNextPage"
|
|
75
|
+
},
|
|
76
|
+
onCancelSubmit: {
|
|
77
|
+
description: "A callback function that gets called when the submission has been canceled.",
|
|
78
|
+
action: "onCancelSubmit"
|
|
79
|
+
},
|
|
80
|
+
onCancelComponent: {
|
|
81
|
+
description: "A callback function that gets called when a component has been canceled.",
|
|
82
|
+
action: "onCancelComponent"
|
|
83
|
+
},
|
|
84
|
+
// onChange: {
|
|
85
|
+
// description: "A callback function that gets called when a value in the submission has changed.",
|
|
86
|
+
// action: "onChange"
|
|
87
|
+
// },
|
|
88
|
+
onCustomEvent: {
|
|
89
|
+
description: 'A callback function that is triggered from a button component configured with "Event" type.',
|
|
90
|
+
action: "onCustomEvent"
|
|
91
|
+
},
|
|
92
|
+
// onComponentChange: {
|
|
93
|
+
// description: "A callback function that gets called when a specific component changes.",
|
|
94
|
+
// action: "onComponentChange"
|
|
95
|
+
// },
|
|
96
|
+
onSubmit: {
|
|
97
|
+
description:
|
|
98
|
+
"A callback function that gets called when the submission has started. If src is not a Form.io server URL, this will be the final submit event.",
|
|
99
|
+
action: "onSubmit"
|
|
100
|
+
},
|
|
101
|
+
onSubmitDone: {
|
|
102
|
+
description:
|
|
103
|
+
"A callback function that gets called when the submission has successfully been made to the server. This will only fire if src is set to a Form.io server URL.",
|
|
104
|
+
action: "onSubmitDone"
|
|
105
|
+
},
|
|
106
|
+
onSubmitError: {
|
|
107
|
+
description: "A callback function that gets called when an error occurs during submission (e.g. a validation error).",
|
|
108
|
+
action: "onSubmitError"
|
|
109
|
+
},
|
|
110
|
+
onFormLoad: {
|
|
111
|
+
description: "A callback function that gets called when the form is finished loading.",
|
|
112
|
+
action: "onFormLoad"
|
|
113
|
+
},
|
|
114
|
+
onError: {
|
|
115
|
+
description: "A callback function that gets called when an error occurs during submission (e.g. a validation error).",
|
|
116
|
+
action: "onError"
|
|
117
|
+
},
|
|
118
|
+
onRender: {
|
|
119
|
+
description:
|
|
120
|
+
"A callback function that gets called when the form is finished rendering. param will depend on the form and display type.",
|
|
121
|
+
action: "onRender"
|
|
122
|
+
},
|
|
123
|
+
onAttach: {
|
|
124
|
+
description: "Event",
|
|
125
|
+
action: "onAttach"
|
|
126
|
+
},
|
|
127
|
+
onBuild: {
|
|
128
|
+
description: "Event",
|
|
129
|
+
action: "onBuild"
|
|
130
|
+
},
|
|
131
|
+
// onFocus: {
|
|
132
|
+
// description: "Event",
|
|
133
|
+
// action: "onFocus"
|
|
134
|
+
// },
|
|
135
|
+
// onBlur: {
|
|
136
|
+
// description: "Event",
|
|
137
|
+
// action: "onBlur"
|
|
138
|
+
// },
|
|
139
|
+
onInitialized: {
|
|
140
|
+
description: "Event",
|
|
141
|
+
action: "onInitialized"
|
|
142
|
+
},
|
|
143
|
+
onLanguageChanged: {
|
|
144
|
+
description: "Event",
|
|
145
|
+
action: "onLanguageChanged"
|
|
146
|
+
},
|
|
147
|
+
onBeforeSetSubmission: {
|
|
148
|
+
description: "Event",
|
|
149
|
+
action: "onBeforeSetSubmission"
|
|
150
|
+
},
|
|
151
|
+
onSaveDraftBegin: {
|
|
152
|
+
description: "Event",
|
|
153
|
+
action: "onSaveDraftBegin"
|
|
154
|
+
},
|
|
155
|
+
onSaveDraft: {
|
|
156
|
+
description: "Event",
|
|
157
|
+
action: "onSaveDraft"
|
|
158
|
+
},
|
|
159
|
+
onRestoreDraft: {
|
|
160
|
+
description: "Event",
|
|
161
|
+
action: "onRestoreDraft"
|
|
162
|
+
},
|
|
163
|
+
onSubmissionDeleted: {
|
|
164
|
+
description: "Event",
|
|
165
|
+
action: "onSubmissionDeleted"
|
|
166
|
+
},
|
|
167
|
+
onRequestDone: {
|
|
168
|
+
description: "Event",
|
|
169
|
+
action: "onRequestDone"
|
|
170
|
+
},
|
|
171
|
+
otherEvents: {
|
|
172
|
+
description:
|
|
173
|
+
'A "catch-all" prop for subscribing to other events (for a complete list, see [our documentation](https://help.form.io/developers/form-development/form-renderer#form-events)).',
|
|
174
|
+
control: "object"
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
tags: ["autodocs"]
|
|
178
|
+
} satisfies Meta<typeof Form>;
|
|
179
|
+
|
|
180
|
+
type Story = StoryObj<typeof Form>;
|
|
181
|
+
/**
|
|
182
|
+
* Form with `form` property.
|
|
183
|
+
*/
|
|
184
|
+
export const BasicUsageWithForm: Story = {
|
|
185
|
+
args: {
|
|
186
|
+
form: form as any,
|
|
187
|
+
onFormReady: fn(),
|
|
188
|
+
options: { template: "tailwind", iconset: "bx" }
|
|
189
|
+
},
|
|
190
|
+
async play({ canvasElement, args }) {
|
|
191
|
+
const canvas = within(canvasElement);
|
|
192
|
+
|
|
193
|
+
await waitFor(() => {
|
|
194
|
+
expect(canvas.getByTestId("formio-container")).toBeInTheDocument();
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
await waitFor(() => {
|
|
198
|
+
expect(canvas.getByTestId("formio-container")).toHaveClass("formio-form-ready");
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
expect(args.onFormReady).toHaveBeenCalled();
|
|
202
|
+
|
|
203
|
+
expect(canvas.getByRole("textbox", { name: "Text Field" })).toBeInTheDocument();
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
/**
|
|
207
|
+
* Form with `src` property.
|
|
208
|
+
*/
|
|
209
|
+
export const BasicUsageWithSrc: Story = {
|
|
210
|
+
args: {
|
|
211
|
+
src: "https://example.form.io/example",
|
|
212
|
+
options: { template: "tailwind", iconset: "bx" }
|
|
213
|
+
},
|
|
214
|
+
async play({ canvasElement }) {
|
|
215
|
+
const canvas = within(canvasElement);
|
|
216
|
+
|
|
217
|
+
await waitFor(() => {
|
|
218
|
+
expect(canvas.getByTestId("formio-container")).toBeInTheDocument();
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
await waitFor(() => {
|
|
222
|
+
expect(canvas.getByTestId("formio-container")).toHaveClass("formio-form-ready");
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
expect(canvas.getByRole("textbox", { name: "First Name" })).toBeInTheDocument();
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
/**
|
|
229
|
+
* Form with `submission` property.
|
|
230
|
+
*/
|
|
231
|
+
export const WithSubmissionData: Story = {
|
|
232
|
+
args: {
|
|
233
|
+
form: formFirstname as never,
|
|
234
|
+
options: {
|
|
235
|
+
template: "tailwind",
|
|
236
|
+
iconset: "bx"
|
|
237
|
+
},
|
|
238
|
+
submission: {
|
|
239
|
+
data: {
|
|
240
|
+
firstName: "John",
|
|
241
|
+
lastName: "Doe"
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
},
|
|
245
|
+
async play({ canvasElement }) {
|
|
246
|
+
const canvas = within(canvasElement);
|
|
247
|
+
|
|
248
|
+
await waitFor(() => {
|
|
249
|
+
expect(canvas.getByTestId("formio-container")).toBeInTheDocument();
|
|
250
|
+
});
|
|
251
|
+
|
|
252
|
+
await waitFor(() => {
|
|
253
|
+
expect(canvas.getByTestId("formio-container")).toHaveClass("formio-form-ready");
|
|
254
|
+
});
|
|
255
|
+
|
|
256
|
+
const firstnameInput = canvas.getByRole("textbox", { name: "First name" });
|
|
257
|
+
const lastNameInput = canvas.getByRole("textbox", { name: "Last name" });
|
|
258
|
+
|
|
259
|
+
expect(firstnameInput).toHaveValue("John");
|
|
260
|
+
expect(lastNameInput).toHaveValue("Doe");
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
/**
|
|
264
|
+
* Form with `onSubmit` property.
|
|
265
|
+
*/
|
|
266
|
+
export const WithOnSubmit: Story = {
|
|
267
|
+
render(args) {
|
|
268
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
269
|
+
const [data, setData] = useState(() => args.submission!.data);
|
|
270
|
+
|
|
271
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
272
|
+
useEffect(() => {
|
|
273
|
+
setData(args.submission!.data);
|
|
274
|
+
}, [args.submission]);
|
|
275
|
+
|
|
276
|
+
return (
|
|
277
|
+
<>
|
|
278
|
+
<Form
|
|
279
|
+
{...args}
|
|
280
|
+
submission={{
|
|
281
|
+
data: data
|
|
282
|
+
}}
|
|
283
|
+
onSubmit={(submission) => {
|
|
284
|
+
setTimeout(() => {
|
|
285
|
+
setData(submission.data);
|
|
286
|
+
}, 1000);
|
|
287
|
+
}}
|
|
288
|
+
/>
|
|
289
|
+
<div className='flex flex-col space-y-5 pt-5'>
|
|
290
|
+
<strong>Preview:</strong>
|
|
291
|
+
<pre className='bg-gray-200 p-5 rounded-sm text-sm'>
|
|
292
|
+
<code>{JSON.stringify(data, null, 2)}</code>
|
|
293
|
+
</pre>
|
|
294
|
+
|
|
295
|
+
<InputText
|
|
296
|
+
name={"raw-firstName"}
|
|
297
|
+
label={"Raw First name"}
|
|
298
|
+
value={data.firstName}
|
|
299
|
+
onChange={(_, value) => setData({ ...data, firstName: value })}
|
|
300
|
+
/>
|
|
301
|
+
</div>
|
|
302
|
+
</>
|
|
303
|
+
);
|
|
304
|
+
},
|
|
305
|
+
args: {
|
|
306
|
+
form: formFirstname as never,
|
|
307
|
+
options: {
|
|
308
|
+
template: "tailwind",
|
|
309
|
+
iconset: "bx"
|
|
310
|
+
},
|
|
311
|
+
submission: {
|
|
312
|
+
data: {
|
|
313
|
+
firstName: "John",
|
|
314
|
+
lastName: "Doe"
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
},
|
|
318
|
+
async play({ canvasElement }) {
|
|
319
|
+
const canvas = within(canvasElement);
|
|
320
|
+
|
|
321
|
+
await waitFor(() => {
|
|
322
|
+
expect(canvas.getByTestId("formio-container")).toBeInTheDocument();
|
|
323
|
+
});
|
|
324
|
+
|
|
325
|
+
await waitFor(() => {
|
|
326
|
+
expect(canvas.getByTestId("formio-container")).toHaveClass("formio-form-ready");
|
|
327
|
+
});
|
|
328
|
+
|
|
329
|
+
let firstnameInput = canvas.getByRole("textbox", { name: "First name" });
|
|
330
|
+
let lastNameInput = canvas.getByRole("textbox", { name: "Last name" });
|
|
331
|
+
|
|
332
|
+
expect(firstnameInput).toHaveValue("John");
|
|
333
|
+
expect(lastNameInput).toHaveValue("Doe");
|
|
334
|
+
|
|
335
|
+
userEvent.clear(firstnameInput);
|
|
336
|
+
userEvent.type(firstnameInput, "Jane", { delay: 100 });
|
|
337
|
+
|
|
338
|
+
await waitFor(() => {
|
|
339
|
+
expect(firstnameInput).toHaveValue("Jane");
|
|
340
|
+
});
|
|
341
|
+
|
|
342
|
+
userEvent.clear(lastNameInput);
|
|
343
|
+
userEvent.type(lastNameInput, "Smith", { delay: 100 });
|
|
344
|
+
|
|
345
|
+
await waitFor(() => {
|
|
346
|
+
expect(lastNameInput).toHaveValue("Smith");
|
|
347
|
+
});
|
|
348
|
+
|
|
349
|
+
let submitButton = canvas.getByRole("button", { name: "Submit" });
|
|
350
|
+
|
|
351
|
+
userEvent.click(submitButton);
|
|
352
|
+
|
|
353
|
+
await delay(1200);
|
|
354
|
+
|
|
355
|
+
firstnameInput = canvas.getByRole("textbox", { name: "First name" });
|
|
356
|
+
lastNameInput = canvas.getByRole("textbox", { name: "Last name" });
|
|
357
|
+
|
|
358
|
+
userEvent.clear(lastNameInput);
|
|
359
|
+
userEvent.type(lastNameInput, "Endo", { delay: 100 });
|
|
360
|
+
|
|
361
|
+
await delay(1100);
|
|
362
|
+
|
|
363
|
+
await waitFor(() => {
|
|
364
|
+
expect(lastNameInput).toHaveValue("Endo");
|
|
365
|
+
});
|
|
366
|
+
|
|
367
|
+
submitButton = canvas.getByRole("button", { name: "Submit" });
|
|
368
|
+
|
|
369
|
+
userEvent.click(submitButton);
|
|
370
|
+
|
|
371
|
+
await delay(1200);
|
|
372
|
+
|
|
373
|
+
const rawFirstNameInput = canvas.getByRole("textbox", { name: "Raw First name" });
|
|
374
|
+
|
|
375
|
+
await waitFor(() => {
|
|
376
|
+
expect(rawFirstNameInput).toHaveValue("Jane");
|
|
377
|
+
});
|
|
378
|
+
|
|
379
|
+
userEvent.clear(rawFirstNameInput);
|
|
380
|
+
|
|
381
|
+
await delay(100);
|
|
382
|
+
|
|
383
|
+
userEvent.type(rawFirstNameInput, "Romeo", { delay: 100 });
|
|
384
|
+
|
|
385
|
+
await waitFor(() => {
|
|
386
|
+
expect(rawFirstNameInput).toHaveValue("Romeo");
|
|
387
|
+
});
|
|
388
|
+
|
|
389
|
+
firstnameInput = canvas.getByRole("textbox", { name: "First name" });
|
|
390
|
+
|
|
391
|
+
await waitFor(() => {
|
|
392
|
+
expect(firstnameInput).toHaveValue("Romeo");
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
};
|
|
396
|
+
/**
|
|
397
|
+
* Form with custom validation hook
|
|
398
|
+
*/
|
|
399
|
+
export const CustomValidation: Story = {
|
|
400
|
+
parameters: {
|
|
401
|
+
mockData: [
|
|
402
|
+
{
|
|
403
|
+
url: "https://test.dev/todos/1",
|
|
404
|
+
method: "GET",
|
|
405
|
+
status: 500,
|
|
406
|
+
response: {
|
|
407
|
+
message: "My custom message about this field",
|
|
408
|
+
type: "custom",
|
|
409
|
+
path: ["firstName"],
|
|
410
|
+
level: "error"
|
|
411
|
+
},
|
|
412
|
+
delay: 800
|
|
413
|
+
}
|
|
414
|
+
]
|
|
415
|
+
},
|
|
416
|
+
args: {
|
|
417
|
+
form: formFirstname as never,
|
|
418
|
+
options: {
|
|
419
|
+
hooks: {
|
|
420
|
+
async customValidation(submission: SubmissionType, callback: (error: any) => void) {
|
|
421
|
+
const response = await fetch("https://test.dev/todos/1", {
|
|
422
|
+
headers: {
|
|
423
|
+
Accept: "application/json",
|
|
424
|
+
"Content-Type": "application/json"
|
|
425
|
+
},
|
|
426
|
+
method: "GET"
|
|
427
|
+
});
|
|
428
|
+
|
|
429
|
+
const responseData = await response.json();
|
|
430
|
+
|
|
431
|
+
if (response.ok) {
|
|
432
|
+
callback(null);
|
|
433
|
+
} else {
|
|
434
|
+
callback(responseData);
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
},
|
|
440
|
+
play: async ({ canvasElement }) => {
|
|
441
|
+
const canvas = within(canvasElement);
|
|
442
|
+
|
|
443
|
+
await waitFor(() => {
|
|
444
|
+
expect(canvas.getByTestId("formio-container")).toBeInTheDocument();
|
|
445
|
+
});
|
|
446
|
+
|
|
447
|
+
await waitFor(() => {
|
|
448
|
+
expect(canvas.getByTestId("formio-container")).toHaveClass("formio-form-ready");
|
|
449
|
+
});
|
|
450
|
+
|
|
451
|
+
let firstnameInput = canvas.getByRole("textbox", { name: "First name" });
|
|
452
|
+
let lastNameInput = canvas.getByRole("textbox", { name: "Last name" });
|
|
453
|
+
|
|
454
|
+
userEvent.clear(firstnameInput);
|
|
455
|
+
userEvent.type(firstnameInput, "Jane", { delay: 100 });
|
|
456
|
+
|
|
457
|
+
await waitFor(() => {
|
|
458
|
+
expect(firstnameInput).toHaveValue("Jane");
|
|
459
|
+
});
|
|
460
|
+
|
|
461
|
+
userEvent.clear(lastNameInput);
|
|
462
|
+
userEvent.type(lastNameInput, "Smith", { delay: 100 });
|
|
463
|
+
|
|
464
|
+
await waitFor(() => {
|
|
465
|
+
expect(lastNameInput).toHaveValue("Smith");
|
|
466
|
+
});
|
|
467
|
+
|
|
468
|
+
let submitButton = canvas.getByRole("button", { name: "Submit" });
|
|
469
|
+
|
|
470
|
+
userEvent.click(submitButton);
|
|
471
|
+
|
|
472
|
+
await waitFor(async () => {
|
|
473
|
+
expect(canvas.getByText("Please fix the following errors before submitting.")).toBeInTheDocument();
|
|
474
|
+
});
|
|
475
|
+
}
|
|
476
|
+
};
|
|
477
|
+
|
|
478
|
+
/**
|
|
479
|
+
* Fetch submission data from a server then use the custom `onAsyncSubmit` event to update the submission
|
|
480
|
+
* data on a non form.io server.
|
|
481
|
+
*
|
|
482
|
+
* Formio support `form.action` property to send the form data to a custom server.
|
|
483
|
+
* But here we want to handle the submission data manually and perform some custom action before sending the data to the server.
|
|
484
|
+
*/
|
|
485
|
+
export const FetchSubmissionWithCustomAction: Story = {
|
|
486
|
+
args: {
|
|
487
|
+
options: {
|
|
488
|
+
template: "tailwind",
|
|
489
|
+
iconset: "bx"
|
|
490
|
+
}
|
|
491
|
+
},
|
|
492
|
+
parameters: {
|
|
493
|
+
mockData: [
|
|
494
|
+
{
|
|
495
|
+
url: "https://local.dev/form/Test",
|
|
496
|
+
method: "GET",
|
|
497
|
+
status: 200,
|
|
498
|
+
response: formFirstname,
|
|
499
|
+
delay: 200
|
|
500
|
+
},
|
|
501
|
+
{
|
|
502
|
+
url: "https://local.dev/form/Test/submissions/1",
|
|
503
|
+
method: "GET",
|
|
504
|
+
status: 200,
|
|
505
|
+
response: {
|
|
506
|
+
firstName: "John",
|
|
507
|
+
lastName: "Doe"
|
|
508
|
+
},
|
|
509
|
+
delay: 800
|
|
510
|
+
},
|
|
511
|
+
{
|
|
512
|
+
url: "https://local.dev/form/Test/submissions/1",
|
|
513
|
+
method: "PUT",
|
|
514
|
+
status: 200,
|
|
515
|
+
response: {
|
|
516
|
+
firstName: "John",
|
|
517
|
+
lastName: "Doe"
|
|
518
|
+
},
|
|
519
|
+
delay: 800
|
|
520
|
+
}
|
|
521
|
+
]
|
|
522
|
+
},
|
|
523
|
+
render(args) {
|
|
524
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
525
|
+
const { loading, form, data, onSubmit } = useEditForm({
|
|
526
|
+
model: "Test",
|
|
527
|
+
submissionId: "1"
|
|
528
|
+
});
|
|
529
|
+
|
|
530
|
+
if (loading || !form) {
|
|
531
|
+
return <div data-testid='loading'>Loading...</div>;
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
return (
|
|
535
|
+
<div className='flex flex-col space-y-5'>
|
|
536
|
+
<Form {...args} form={form} submission={{ data: data! }} onAsyncSubmit={onSubmit} />
|
|
537
|
+
|
|
538
|
+
<div className='flex flex-col space-y-5'>
|
|
539
|
+
<strong>Preview:</strong>
|
|
540
|
+
<pre className='bg-gray-200 p-5 rounded-sm text-sm'>
|
|
541
|
+
<code>{JSON.stringify(data, null, 2)}</code>
|
|
542
|
+
</pre>
|
|
543
|
+
</div>
|
|
544
|
+
</div>
|
|
545
|
+
);
|
|
546
|
+
},
|
|
547
|
+
play: async ({ canvasElement }) => {
|
|
548
|
+
const canvas = within(canvasElement);
|
|
549
|
+
|
|
550
|
+
await waitFor(() => {
|
|
551
|
+
expect(canvas.getByTestId("loading")).toBeInTheDocument();
|
|
552
|
+
});
|
|
553
|
+
|
|
554
|
+
await waitFor(() => {
|
|
555
|
+
expect(canvas.getByTestId("formio-container")).toBeInTheDocument();
|
|
556
|
+
});
|
|
557
|
+
|
|
558
|
+
await waitFor(() => {
|
|
559
|
+
expect(canvas.getByTestId("formio-container")).toHaveClass("formio-form-ready");
|
|
560
|
+
});
|
|
561
|
+
|
|
562
|
+
let firstnameInput = canvas.getByRole("textbox", { name: "First name" });
|
|
563
|
+
let lastNameInput = canvas.getByRole("textbox", { name: "Last name" });
|
|
564
|
+
|
|
565
|
+
userEvent.clear(firstnameInput);
|
|
566
|
+
userEvent.type(firstnameInput, "Jane", { delay: 100 });
|
|
567
|
+
|
|
568
|
+
await waitFor(() => {
|
|
569
|
+
expect(firstnameInput).toHaveValue("Jane");
|
|
570
|
+
});
|
|
571
|
+
|
|
572
|
+
userEvent.clear(lastNameInput);
|
|
573
|
+
userEvent.type(lastNameInput, "Smith", { delay: 100 });
|
|
574
|
+
|
|
575
|
+
await waitFor(() => {
|
|
576
|
+
expect(lastNameInput).toHaveValue("Smith");
|
|
577
|
+
});
|
|
578
|
+
|
|
579
|
+
let submitButton = canvas.getByRole("button", { name: "Submit" });
|
|
580
|
+
|
|
581
|
+
userEvent.click(submitButton);
|
|
582
|
+
|
|
583
|
+
await delay(1000);
|
|
584
|
+
|
|
585
|
+
await waitFor(() => {
|
|
586
|
+
submitButton = canvas.getByRole("button", { name: "Submit" });
|
|
587
|
+
expect(submitButton.children).toHaveLength(1);
|
|
588
|
+
});
|
|
589
|
+
}
|
|
590
|
+
};
|
|
591
|
+
|
|
592
|
+
export const ErrorOnSubmitServer: Story = {
|
|
593
|
+
args: {
|
|
594
|
+
options: {
|
|
595
|
+
template: "tailwind",
|
|
596
|
+
iconset: "bx"
|
|
597
|
+
}
|
|
598
|
+
},
|
|
599
|
+
parameters: {
|
|
600
|
+
mockData: [
|
|
601
|
+
{
|
|
602
|
+
url: "https://local.dev/form/Test2",
|
|
603
|
+
method: "GET",
|
|
604
|
+
status: 200,
|
|
605
|
+
response: formFirstname,
|
|
606
|
+
delay: 200
|
|
607
|
+
},
|
|
608
|
+
{
|
|
609
|
+
url: "https://local.dev/form/Test2/submissions/2",
|
|
610
|
+
method: "GET",
|
|
611
|
+
status: 200,
|
|
612
|
+
response: {
|
|
613
|
+
firstName: "John",
|
|
614
|
+
lastName: "Doe"
|
|
615
|
+
},
|
|
616
|
+
delay: 800
|
|
617
|
+
},
|
|
618
|
+
{
|
|
619
|
+
url: "https://local.dev/form/Test2/submissions/2",
|
|
620
|
+
method: "PUT",
|
|
621
|
+
status: 400,
|
|
622
|
+
response: {
|
|
623
|
+
message: "My custom message about this field",
|
|
624
|
+
type: "custom",
|
|
625
|
+
path: ["firstName"],
|
|
626
|
+
level: "error"
|
|
627
|
+
},
|
|
628
|
+
delay: 800
|
|
629
|
+
}
|
|
630
|
+
]
|
|
631
|
+
},
|
|
632
|
+
render(args) {
|
|
633
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
634
|
+
const { loading, form, data, onSubmit } = useEditForm({
|
|
635
|
+
model: "Test2",
|
|
636
|
+
submissionId: "2"
|
|
637
|
+
});
|
|
638
|
+
|
|
639
|
+
if (loading || !form) {
|
|
640
|
+
return <div data-testid='loading'>Loading...</div>;
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
return (
|
|
644
|
+
<div className='flex flex-col space-y-5'>
|
|
645
|
+
<Form {...args} form={form} submission={{ data: data! }} onAsyncSubmit={onSubmit} />
|
|
646
|
+
|
|
647
|
+
<div className='flex flex-col space-y-5'>
|
|
648
|
+
<strong>Preview:</strong>
|
|
649
|
+
<pre className='bg-gray-200 p-5 rounded-sm text-sm'>
|
|
650
|
+
<code>{JSON.stringify(data, null, 2)}</code>
|
|
651
|
+
</pre>
|
|
652
|
+
</div>
|
|
653
|
+
</div>
|
|
654
|
+
);
|
|
655
|
+
},
|
|
656
|
+
play: async ({ canvasElement }) => {
|
|
657
|
+
const canvas = within(canvasElement);
|
|
658
|
+
|
|
659
|
+
await waitFor(() => {
|
|
660
|
+
expect(canvas.getByTestId("loading")).toBeInTheDocument();
|
|
661
|
+
});
|
|
662
|
+
|
|
663
|
+
await waitFor(() => {
|
|
664
|
+
expect(canvas.getByTestId("formio-container")).toBeInTheDocument();
|
|
665
|
+
});
|
|
666
|
+
|
|
667
|
+
await waitFor(() => {
|
|
668
|
+
expect(canvas.getByTestId("formio-container")).toHaveClass("formio-form-ready");
|
|
669
|
+
});
|
|
670
|
+
|
|
671
|
+
let firstnameInput = canvas.getByRole("textbox", { name: "First name" });
|
|
672
|
+
let lastNameInput = canvas.getByRole("textbox", { name: "Last name" });
|
|
673
|
+
|
|
674
|
+
userEvent.clear(firstnameInput);
|
|
675
|
+
userEvent.type(firstnameInput, "Jane", { delay: 100 });
|
|
676
|
+
|
|
677
|
+
await waitFor(() => {
|
|
678
|
+
expect(firstnameInput).toHaveValue("Jane");
|
|
679
|
+
});
|
|
680
|
+
|
|
681
|
+
userEvent.clear(lastNameInput);
|
|
682
|
+
userEvent.type(lastNameInput, "Smith", { delay: 100 });
|
|
683
|
+
|
|
684
|
+
await waitFor(() => {
|
|
685
|
+
expect(lastNameInput).toHaveValue("Smith");
|
|
686
|
+
});
|
|
687
|
+
|
|
688
|
+
let submitButton = canvas.getByRole("button", { name: "Submit" });
|
|
689
|
+
|
|
690
|
+
userEvent.click(submitButton);
|
|
691
|
+
|
|
692
|
+
await delay(1000);
|
|
693
|
+
|
|
694
|
+
await waitFor(async () => {
|
|
695
|
+
expect(canvas.getByText("Please fix the following errors before submitting.")).toBeInTheDocument();
|
|
696
|
+
});
|
|
697
|
+
}
|
|
698
|
+
};
|