@tsed/react-formio 2.3.6 → 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 +43 -0
- package/dist/chunks/index.js.map +1 -0
- 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/hooks/useTooltip.d.ts +2 -3
- package/dist/hooks/useTooltip.js +12 -0
- package/dist/hooks/useTooltip.js.map +1 -0
- package/dist/index.d.ts +7 -13
- package/dist/index.js +14 -7653
- 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/ColumnIdentifier.d.ts +14 -14
- package/dist/interfaces/ColumnIdentifier.js +2 -0
- package/dist/interfaces/ColumnIdentifier.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 +13 -10
- package/dist/interfaces/FormOptions.js +2 -0
- package/dist/interfaces/FormOptions.js.map +1 -0
- package/dist/interfaces/{FormSchema.d.ts → FormType.d.ts} +12 -12
- package/dist/interfaces/FormType.js +2 -0
- package/dist/interfaces/FormType.js.map +1 -0
- package/dist/interfaces/Operation.d.ts +28 -29
- package/dist/interfaces/Operation.js +2 -0
- package/dist/interfaces/Operation.js.map +1 -0
- package/dist/interfaces/QueryOptions.d.ts +23 -23
- package/dist/interfaces/QueryOptions.js +2 -0
- package/dist/interfaces/QueryOptions.js.map +1 -0
- package/dist/interfaces/{RoleSchema.d.ts → RoleType.d.ts} +6 -6
- 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 +9 -8
- package/dist/interfaces/index.js +2 -0
- package/dist/interfaces/index.js.map +1 -0
- package/dist/molecules/alert/Alert.d.ts +6 -0
- package/dist/molecules/alert/Alert.js +27 -0
- 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/{components/card/card.component.d.ts → molecules/card/Card.d.ts} +6 -7
- 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/molecules/loader/Loader.d.ts +8 -0
- package/dist/molecules/loader/Loader.js +19 -0
- package/dist/molecules/loader/Loader.js.map +1 -0
- package/dist/{components/modal/modal.component.d.ts → molecules/modal/Modal.d.ts} +15 -15
- package/dist/molecules/modal/Modal.js +62 -0
- package/dist/molecules/modal/Modal.js.map +1 -0
- package/dist/molecules/pagination/Pagination.d.ts +18 -0
- 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/{components/table → molecules/pagination}/utils/getPageNumbers.d.ts +3 -3
- package/dist/molecules/pagination/utils/getPageNumbers.js +25 -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.d.ts → molecules/tabs/Tabs.d.ts} +19 -19
- package/dist/molecules/tabs/Tabs.js +72 -0
- 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/organisms/form/access/FormAccess.d.ts +9 -0
- package/dist/organisms/form/access/FormAccess.js +94 -0
- package/dist/organisms/form/access/FormAccess.js.map +1 -0
- package/dist/organisms/form/access/FormAccess.schema.d.ts +4 -0
- package/dist/organisms/form/access/FormAccess.schema.js +164 -0
- package/dist/organisms/form/access/FormAccess.schema.js.map +1 -0
- package/dist/organisms/form/access/FormAccess.utils.d.ts +23 -0
- package/dist/organisms/form/access/FormAccess.utils.js +68 -0
- package/dist/organisms/form/access/FormAccess.utils.js.map +1 -0
- package/dist/organisms/form/action/FormAction.d.ts +9 -0
- package/dist/organisms/form/action/FormAction.js +32 -0
- 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/organisms/form/builder/FormEdit.reducer.js +65 -0
- 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} +29 -29
- package/dist/organisms/form/builder/useFormEdit.js +36 -0
- 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} +7 -8
- package/dist/organisms/form/settings/FormSettings.js +38 -0
- package/dist/organisms/form/settings/FormSettings.js.map +1 -0
- package/dist/organisms/form/settings/FormSettings.schema.d.ts +2 -0
- package/dist/organisms/form/settings/FormSettings.schema.js +60 -0
- package/dist/organisms/form/settings/FormSettings.schema.js.map +1 -0
- package/dist/organisms/form/settings/FormSettings.utils.d.ts +8 -0
- package/dist/organisms/form/settings/FormSettings.utils.js +23 -0
- 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} +9 -9
- package/dist/organisms/modal/RemoveModal.js +71 -0
- 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/react-app-env.d.js +2 -0
- package/dist/react-app-env.d.js.map +1 -0
- package/dist/react-table.d.js +2 -0
- package/dist/react-table.d.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/dist/typings.d.js +2 -0
- package/dist/typings.d.js.map +1 -0
- package/dist/utils/getEventValue.d.ts +1 -1
- package/dist/utils/getEventValue.js +8 -0
- package/dist/utils/getEventValue.js.map +1 -0
- package/dist/utils/iconClass.d.ts +1 -1
- package/dist/utils/iconClass.js +9 -0
- package/dist/utils/iconClass.js.map +1 -0
- package/dist/utils/mapPagination.d.ts +1 -1
- package/dist/utils/mapPagination.js +11 -0
- package/dist/utils/mapPagination.js.map +1 -0
- package/dist/utils/stopPropagationWrapper.d.ts +1 -1
- package/dist/utils/stopPropagationWrapper.js +7 -0
- package/dist/utils/stopPropagationWrapper.js.map +1 -0
- package/package.json +29 -18
- package/readme.md +33 -20
- 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 -15
- package/src/molecules/alert/Alert.stories.tsx +39 -0
- package/src/{components/alert/alert.component.tsx → molecules/alert/Alert.tsx} +9 -8
- 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 -3
- package/src/{components/card/card.stories.tsx → molecules/card/Card.stories.tsx} +9 -4
- package/src/{components/card/card.component.tsx → molecules/card/Card.tsx} +1 -2
- package/src/{components/form-control/formControl.component.spec.tsx → molecules/forms/form-control/FormControl.spec.tsx} +9 -9
- 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 -8
- 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} +4 -4
- package/src/molecules/loader/Loader.stories.tsx +43 -0
- package/src/{components/loader/loader.component.tsx → molecules/loader/Loader.tsx} +3 -11
- package/src/molecules/modal/Modal.spec.tsx +203 -0
- package/src/molecules/modal/Modal.stories.tsx +178 -0
- package/src/{components/modal/modal.component.tsx → molecules/modal/Modal.tsx} +1 -1
- package/src/{components/pagination/pagination.component.spec.tsx → molecules/pagination/Pagination.spec.tsx} +27 -22
- 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} +6 -6
- package/src/molecules/tabs/Tabs.stories.tsx +141 -0
- package/src/{components/tabs/tabs.component.tsx → molecules/tabs/Tabs.tsx} +1 -1
- 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} +6 -7
- 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} +16 -18
- 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 -13
- package/src/{components/form-action/formAction.component.tsx → organisms/form/action/FormAction.tsx} +8 -8
- 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} +88 -44
- 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} +29 -29
- 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} +3 -4
- 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 -10
- package/src/{components/form-settings/formSettings.component.tsx → organisms/form/settings/FormSettings.tsx} +8 -9
- 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} +3 -3
- package/src/{components/actions-table/actionsTable.component.spec.tsx → organisms/table/actions/ActionsTable.spec.tsx} +14 -11
- 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} +14 -21
- package/src/{components/forms-table/formsTable.stories.tsx → organisms/table/forms/FormsTable.stories.tsx} +24 -28
- 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} +28 -31
- package/src/organisms/table/submissions/SubmissionsTable.tsx +13 -0
- package/src/registries/components.ts +23 -0
- package/src/utils/iconClass.ts +3 -1
- package/tsconfig.app.json +11 -0
- package/tsconfig.json +10 -5
- package/tsconfig.node.json +9 -4
- package/tsconfig.spec.json +14 -0
- package/vite.config.mts +69 -0
- package/vitest.config.mts +21 -0
- package/.eslintignore +0 -13
- package/.eslintrc.js +0 -7
- package/coverage.json +0 -6
- package/dist/components/actions-table/actionsTable.component.d.ts +0 -11
- package/dist/components/actions-table/actionsTable.component.spec.d.ts +0 -1
- package/dist/components/actions-table/actionsTable.stories.d.ts +0 -40
- package/dist/components/alert/alert.component.d.ts +0 -6
- package/dist/components/alert/alert.component.spec.d.ts +0 -1
- package/dist/components/alert/alert.stories.d.ts +0 -15
- package/dist/components/card/card.component.spec.d.ts +0 -1
- package/dist/components/card/card.stories.d.ts +0 -16
- package/dist/components/form/form.component.d.ts +0 -63
- package/dist/components/form/form.component.spec.d.ts +0 -1
- package/dist/components/form/form.stories.d.ts +0 -6445
- package/dist/components/form/useForm.hook.d.ts +0 -60
- package/dist/components/form-access/formAccess.component.d.ts +0 -9
- package/dist/components/form-access/formAccess.schema.d.ts +0 -5
- package/dist/components/form-access/formAccess.stories.d.ts +0 -21
- package/dist/components/form-access/formAccess.utils.d.ts +0 -24
- package/dist/components/form-access/formAccess.utils.spec.d.ts +0 -1
- package/dist/components/form-action/formAction.component.d.ts +0 -9
- package/dist/components/form-action/formAction.stories.d.ts +0 -409
- package/dist/components/form-builder/formBuilder.component.d.ts +0 -53
- package/dist/components/form-builder/formBuilder.stories.d.ts +0 -5989
- package/dist/components/form-control/formControl.component.d.ts +0 -14
- package/dist/components/form-control/formControl.component.spec.d.ts +0 -1
- package/dist/components/form-control/formControl.stories.d.ts +0 -58
- package/dist/components/form-edit/formCtas.component.d.ts +0 -28
- package/dist/components/form-edit/formEdit.component.d.ts +0 -19
- package/dist/components/form-edit/formEdit.reducer.d.ts +0 -10
- package/dist/components/form-edit/formEdit.stories.d.ts +0 -396
- package/dist/components/form-edit/formParameters.component.d.ts +0 -34
- package/dist/components/form-settings/formSettings.component.spec.d.ts +0 -1
- package/dist/components/form-settings/formSettings.schema.d.ts +0 -2
- package/dist/components/form-settings/formSettings.stories.d.ts +0 -58
- package/dist/components/form-settings/formSettings.utils.d.ts +0 -8
- package/dist/components/form-settings/formSettings.utils.spec.d.ts +0 -1
- package/dist/components/forms-table/components/formCell.component.d.ts +0 -7
- package/dist/components/forms-table/formsTable.component.d.ts +0 -11
- package/dist/components/forms-table/formsTable.stories.d.ts +0 -117
- package/dist/components/index.d.ts +0 -26
- package/dist/components/input-tags/inputTags.component.d.ts +0 -19
- package/dist/components/input-tags/inputTags.stories.d.ts +0 -76
- package/dist/components/input-text/inputText.component.d.ts +0 -28
- package/dist/components/input-text/inputText.component.spec.d.ts +0 -1
- package/dist/components/input-text/inputText.stories.d.ts +0 -101
- package/dist/components/loader/loader.component.d.ts +0 -17
- package/dist/components/loader/loader.component.spec.d.ts +0 -1
- package/dist/components/loader/loader.stories.d.ts +0 -15
- package/dist/components/modal/modal.component.spec.d.ts +0 -1
- package/dist/components/modal/modal.stories.d.ts +0 -44
- package/dist/components/pagination/pagination.component.d.ts +0 -18
- package/dist/components/pagination/pagination.component.spec.d.ts +0 -1
- package/dist/components/pagination/pagination.stories.d.ts +0 -16
- package/dist/components/react-component/reactComponent.component.d.ts +0 -90
- package/dist/components/select/select.component.d.ts +0 -14
- package/dist/components/select/select.component.spec.d.ts +0 -1
- package/dist/components/select/select.stories.d.ts +0 -164
- package/dist/components/submissions-table/submissionsTable.component.d.ts +0 -7
- package/dist/components/submissions-table/submissionsTable.stories.d.ts +0 -649
- package/dist/components/table/components/defaultArrowSort.component.d.ts +0 -2
- package/dist/components/table/components/defaultCell.component.d.ts +0 -2
- package/dist/components/table/components/defaultCellHeader.component.d.ts +0 -6
- package/dist/components/table/components/defaultCellOperations.component.d.ts +0 -13
- package/dist/components/table/components/defaultCells.component.d.ts +0 -5
- package/dist/components/table/components/defaultOperationButton.component.d.ts +0 -14
- package/dist/components/table/components/defaultRow.component.d.ts +0 -12
- package/dist/components/table/components/dragNDropContainer.d.ts +0 -4
- package/dist/components/table/filters/defaultColumnFilter.component.d.ts +0 -6
- package/dist/components/table/filters/defaultColumnFilter.component.spec.d.ts +0 -1
- package/dist/components/table/filters/selectColumnFilter.component.d.ts +0 -11
- package/dist/components/table/filters/selectColumnFilter.component.spec.d.ts +0 -1
- package/dist/components/table/filters/sliderColumnFilter.component.d.ts +0 -3
- package/dist/components/table/hooks/useCustomTable.hook.d.ts +0 -128
- package/dist/components/table/hooks/useDragnDropRow.hook.d.ts +0 -274
- package/dist/components/table/hooks/useOperations.hook.d.ts +0 -11
- package/dist/components/table/index.d.ts +0 -15
- package/dist/components/table/table.component.d.ts +0 -3
- package/dist/components/table/table.stories.d.ts +0 -71
- package/dist/components/table/utils/mapFormToColumns.d.ts +0 -3
- package/dist/components/table/utils/swapElements.d.ts +0 -1
- package/dist/components/table/utils/swapElements.spec.d.ts +0 -1
- package/dist/components/tabs/tabs.component.spec.d.ts +0 -1
- package/dist/components/tabs/tabs.component.stories.d.ts +0 -47
- package/dist/index.modern.js +0 -7437
- package/dist/index.modern.js.map +0 -1
- package/dist/interfaces/ActionSchema.d.ts +0 -23
- package/dist/interfaces/Submission.d.ts +0 -5
- package/dist/setupTests.d.ts +0 -1
- package/dist/utils/callLast.d.ts +0 -1
- package/jest.config.js +0 -6
- package/src/components/alert/alert.stories.tsx +0 -18
- package/src/components/form/form.component.tsx +0 -73
- 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 -3667
- package/src/components/form-control/formControl.component.tsx +0 -58
- package/src/components/form-control/formControl.stories.tsx +0 -65
- package/src/components/form-edit/formCtas.component.tsx +0 -106
- package/src/components/form-edit/formEdit.component.tsx +0 -60
- package/src/components/forms-table/components/formCell.component.tsx +0 -48
- package/src/components/forms-table/formsTable.component.tsx +0 -42
- package/src/components/index.ts +0 -26
- 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 -18
- package/src/components/modal/modal.component.spec.tsx +0 -79
- package/src/components/modal/modal.stories.tsx +0 -192
- package/src/components/pagination/pagination.stories.tsx +0 -40
- package/src/components/react-component/reactComponent.component.tsx +0 -197
- package/src/components/select/select.component.spec.tsx +0 -85
- 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 -16
- package/src/components/table/components/defaultArrowSort.component.tsx +0 -12
- package/src/components/table/components/defaultCell.component.tsx +0 -15
- package/src/components/table/components/defaultCellHeader.component.tsx +0 -19
- package/src/components/table/components/defaultCellOperations.component.tsx +0 -39
- package/src/components/table/components/defaultCells.component.tsx +0 -31
- package/src/components/table/components/defaultOperationButton.component.tsx +0 -53
- 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 -34
- package/src/components/table/filters/defaultColumnFilter.component.tsx +0 -39
- package/src/components/table/filters/selectColumnFilter.component.spec.tsx +0 -69
- package/src/components/table/filters/selectColumnFilter.component.tsx +0 -52
- package/src/components/table/filters/sliderColumnFilter.component.tsx +0 -31
- package/src/components/table/hooks/useCustomTable.hook.tsx +0 -272
- 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 -34
- 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/setupTests.tsx +0 -5
- package/src/utils/callLast.ts +0 -12
- /package/src/{components → molecules}/__fixtures__/form-actions.json +0 -0
- /package/src/{components → molecules}/__fixtures__/form.fixture.json +0 -0
- /package/src/{components/table → molecules/pagination}/utils/getPageNumbers.ts +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
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import React, { useState } from "react";
|
|
2
|
-
|
|
3
|
-
import { iconClass } from "../../utils/iconClass";
|
|
4
|
-
import { InputText } from "./inputText.component";
|
|
5
|
-
|
|
6
|
-
const useValue = (args: any) => {
|
|
7
|
-
const [value, setValue] = useState(args.value);
|
|
8
|
-
|
|
9
|
-
return {
|
|
10
|
-
...args,
|
|
11
|
-
value,
|
|
12
|
-
onChange(name: string, value: any) {
|
|
13
|
-
setValue(value);
|
|
14
|
-
args.onChange(name, value);
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export default {
|
|
20
|
-
title: "ReactFormio/InputText",
|
|
21
|
-
component: InputText,
|
|
22
|
-
argTypes: {
|
|
23
|
-
label: {
|
|
24
|
-
control: {
|
|
25
|
-
type: "text"
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
type: {
|
|
29
|
-
control: {
|
|
30
|
-
type: "text"
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
name: {
|
|
34
|
-
control: {
|
|
35
|
-
type: "text"
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
value: {
|
|
39
|
-
control: {
|
|
40
|
-
type: "text"
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
size: {
|
|
44
|
-
control: {
|
|
45
|
-
type: "select",
|
|
46
|
-
options: ["sm", "normal"]
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
placeholder: {
|
|
50
|
-
control: {
|
|
51
|
-
type: "text"
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
|
-
choices: {
|
|
55
|
-
control: {
|
|
56
|
-
type: "object"
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
description: {
|
|
60
|
-
control: {
|
|
61
|
-
type: "text"
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
parameters: {}
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
export const Sandbox = (args: any) => {
|
|
69
|
-
return <InputText {...args} />;
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
Sandbox.args = {
|
|
73
|
-
name: "name",
|
|
74
|
-
label: "Label",
|
|
75
|
-
value: "",
|
|
76
|
-
size: "",
|
|
77
|
-
placeholder: "Placeholder"
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
export const WithPrefix = (args: any) => {
|
|
81
|
-
return <InputText prefix={<i className={iconClass(undefined, "calendar")} />} {...useValue(args)} />;
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
WithPrefix.args = {
|
|
85
|
-
label: "Label",
|
|
86
|
-
value: "",
|
|
87
|
-
size: "",
|
|
88
|
-
placeholder: "Placeholder"
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
export const WithSuffix = (args: any) => {
|
|
92
|
-
return <InputText suffix={<i className={iconClass(undefined, "calendar")} />} {...useValue(args)} />;
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
WithSuffix.args = {
|
|
96
|
-
label: "Label",
|
|
97
|
-
value: "",
|
|
98
|
-
size: "",
|
|
99
|
-
placeholder: "Placeholder"
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
export const TypeNumber = (args: any) => {
|
|
103
|
-
return <InputText suffix={<i className={iconClass(undefined, "dollar")} />} {...useValue(args)} />;
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
TypeNumber.args = {
|
|
107
|
-
label: "Label",
|
|
108
|
-
type: "number",
|
|
109
|
-
value: "",
|
|
110
|
-
size: "",
|
|
111
|
-
placeholder: "Placeholder",
|
|
112
|
-
description: "Use dollars!"
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
export const Sizing = (args: any) => {
|
|
116
|
-
return <InputText suffix={<i className={iconClass(undefined, "dollar")} />} {...useValue(args)} />;
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
Sizing.args = {
|
|
120
|
-
label: "Label",
|
|
121
|
-
type: "number",
|
|
122
|
-
value: "",
|
|
123
|
-
size: "sm",
|
|
124
|
-
placeholder: "Placeholder",
|
|
125
|
-
description: "Use dollars!"
|
|
126
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
|
|
3
|
-
import { Loader } from "./loader.component";
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
title: "ReactFormio/Loader",
|
|
7
|
-
component: Loader,
|
|
8
|
-
argTypes: {},
|
|
9
|
-
parameters: {}
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export const Sandbox = (args: any) => {
|
|
13
|
-
return <Loader {...args} />;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
Sandbox.args = {
|
|
17
|
-
isActive: true
|
|
18
|
-
};
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import "@testing-library/jest-dom/extend-expect";
|
|
2
|
-
|
|
3
|
-
import { fireEvent, render, screen } from "@testing-library/react";
|
|
4
|
-
import React from "react";
|
|
5
|
-
|
|
6
|
-
import { WithFooter, WithTitle } from "./modal.stories";
|
|
7
|
-
|
|
8
|
-
describe("Modal", () => {
|
|
9
|
-
describe("WithTitle", () => {
|
|
10
|
-
it("should display the modal when we click on the button", async () => {
|
|
11
|
-
const onClose = jest.fn();
|
|
12
|
-
|
|
13
|
-
render(<WithTitle {...WithTitle.args} onClose={onClose} />);
|
|
14
|
-
|
|
15
|
-
expect(screen.queryByTestId("modalTitle")).toBeFalsy();
|
|
16
|
-
expect(screen.queryByTestId("modalBody")).toBeFalsy();
|
|
17
|
-
expect(screen.queryByTestId("modalFooter")).toBeFalsy();
|
|
18
|
-
|
|
19
|
-
fireEvent.click(screen.getByRole("button", { name: "Open modal" }));
|
|
20
|
-
|
|
21
|
-
await screen.findByTestId("modalTitle");
|
|
22
|
-
|
|
23
|
-
expect(screen.getByTestId("modalTitle")).toBeTruthy();
|
|
24
|
-
expect(screen.getByTestId("modalTitle")).toHaveTextContent("Modal title");
|
|
25
|
-
expect(screen.getByTestId("modalBody")).toBeTruthy();
|
|
26
|
-
expect(screen.getByTestId("modalBody")).toHaveTextContent("Hello body");
|
|
27
|
-
expect(screen.queryByTestId("modalFooter")).toBeFalsy();
|
|
28
|
-
|
|
29
|
-
fireEvent.click(screen.getByTestId("closeModal"));
|
|
30
|
-
|
|
31
|
-
expect(screen.queryByTestId("modalTitle")).toBeFalsy();
|
|
32
|
-
expect(screen.queryByTestId("modalBody")).toBeFalsy();
|
|
33
|
-
expect(screen.queryByTestId("modalFooter")).toBeFalsy();
|
|
34
|
-
expect(onClose).toHaveBeenCalledWith();
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
describe("WithFooter", () => {
|
|
39
|
-
it("should display the modal when we click on the button", async () => {
|
|
40
|
-
render(<WithFooter {...WithFooter.args} />);
|
|
41
|
-
|
|
42
|
-
expect(screen.queryByTestId("modalTitle")).toBeFalsy();
|
|
43
|
-
expect(screen.queryByTestId("modalBody")).toBeFalsy();
|
|
44
|
-
expect(screen.queryByTestId("modalFooter")).toBeFalsy();
|
|
45
|
-
|
|
46
|
-
fireEvent.click(screen.getByRole("button", { name: "Open modal" }));
|
|
47
|
-
|
|
48
|
-
await screen.findByTestId("modalTitle");
|
|
49
|
-
|
|
50
|
-
expect(screen.getByTestId("modalTitle")).toBeTruthy();
|
|
51
|
-
expect(screen.getByTestId("modalTitle")).toHaveTextContent("Modal title");
|
|
52
|
-
expect(screen.getByTestId("modalBody")).toBeTruthy();
|
|
53
|
-
expect(screen.getByTestId("modalBody")).toHaveTextContent("Hello body");
|
|
54
|
-
expect(screen.getByTestId("modalFooter")).toBeTruthy();
|
|
55
|
-
|
|
56
|
-
fireEvent.click(screen.getByTestId("customCloseModal"));
|
|
57
|
-
|
|
58
|
-
expect(screen.queryByTestId("modalTitle")).toBeFalsy();
|
|
59
|
-
expect(screen.queryByTestId("modalBody")).toBeFalsy();
|
|
60
|
-
expect(screen.queryByTestId("modalFooter")).toBeFalsy();
|
|
61
|
-
});
|
|
62
|
-
it("should call the onSubmit listener", async () => {
|
|
63
|
-
const onSubmit = jest.fn();
|
|
64
|
-
|
|
65
|
-
render(<WithFooter {...WithFooter.args} onSubmit={onSubmit} />);
|
|
66
|
-
|
|
67
|
-
fireEvent.click(screen.getByRole("button", { name: "Open modal" }));
|
|
68
|
-
|
|
69
|
-
await screen.findByTestId("modalTitle");
|
|
70
|
-
|
|
71
|
-
fireEvent.click(screen.getByTestId("customSubmitModal"));
|
|
72
|
-
|
|
73
|
-
expect(onSubmit).toHaveBeenCalled();
|
|
74
|
-
expect(screen.queryByTestId("modalTitle")).toBeFalsy();
|
|
75
|
-
expect(screen.queryByTestId("modalBody")).toBeFalsy();
|
|
76
|
-
expect(screen.queryByTestId("modalFooter")).toBeFalsy();
|
|
77
|
-
});
|
|
78
|
-
});
|
|
79
|
-
});
|
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
|
|
3
|
-
import { Modal, ModalProps, useModal } from "./modal.component";
|
|
4
|
-
import { RemoveModal, RemoveModalProps } from "./removeModal.component";
|
|
5
|
-
|
|
6
|
-
export default {
|
|
7
|
-
title: "ReactFormio/Modal",
|
|
8
|
-
component: Modal,
|
|
9
|
-
argTypes: {
|
|
10
|
-
onSubmit: {
|
|
11
|
-
title: {
|
|
12
|
-
control: {
|
|
13
|
-
type: "text"
|
|
14
|
-
}
|
|
15
|
-
},
|
|
16
|
-
control: {
|
|
17
|
-
action: "onSubmit"
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
|
-
parameters: {}
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export const Sandbox = (args: ModalProps) => {
|
|
25
|
-
const modal = useModal();
|
|
26
|
-
|
|
27
|
-
return (
|
|
28
|
-
<div>
|
|
29
|
-
<div>
|
|
30
|
-
<button className={"btn btn-primary"} onClick={modal.openModal}>
|
|
31
|
-
Open modal
|
|
32
|
-
</button>
|
|
33
|
-
</div>
|
|
34
|
-
<Modal {...args} {...modal}>
|
|
35
|
-
<div className={"p-5"} style={{ height: "900px" }}>
|
|
36
|
-
Hello body
|
|
37
|
-
</div>
|
|
38
|
-
</Modal>
|
|
39
|
-
</div>
|
|
40
|
-
);
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
Sandbox.args = {};
|
|
44
|
-
|
|
45
|
-
export const WithTitle = (args: ModalProps) => {
|
|
46
|
-
const modal = useModal();
|
|
47
|
-
|
|
48
|
-
return (
|
|
49
|
-
<div>
|
|
50
|
-
<div>
|
|
51
|
-
<button className={"btn btn-primary"} onClick={modal.openModal}>
|
|
52
|
-
Open modal
|
|
53
|
-
</button>
|
|
54
|
-
</div>
|
|
55
|
-
<Modal {...args} {...modal}>
|
|
56
|
-
<div className={"p-5"} style={{ height: "900px" }}>
|
|
57
|
-
Hello body
|
|
58
|
-
</div>
|
|
59
|
-
</Modal>
|
|
60
|
-
</div>
|
|
61
|
-
);
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
WithTitle.args = {
|
|
65
|
-
title: "Modal title"
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
export const WithFooter = (args: ModalProps) => {
|
|
69
|
-
const modal = useModal();
|
|
70
|
-
|
|
71
|
-
function ModalFooter({ closeModal, onSubmit }: any) {
|
|
72
|
-
return (
|
|
73
|
-
<div className={"flex items-center justify-center bg-white p-2"}>
|
|
74
|
-
<button
|
|
75
|
-
data-testid='customSubmitModal'
|
|
76
|
-
className={"btn btn-primary mx-1"}
|
|
77
|
-
onClick={(e) => {
|
|
78
|
-
onSubmit(e);
|
|
79
|
-
closeModal();
|
|
80
|
-
}}
|
|
81
|
-
>
|
|
82
|
-
Save
|
|
83
|
-
</button>
|
|
84
|
-
|
|
85
|
-
<button data-testid='customCloseModal' className={"btn btn-danger mx-1"} onClick={closeModal}>
|
|
86
|
-
Close
|
|
87
|
-
</button>
|
|
88
|
-
</div>
|
|
89
|
-
);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
return (
|
|
93
|
-
<div>
|
|
94
|
-
<div>
|
|
95
|
-
<button className={"btn btn-primary"} onClick={modal.openModal}>
|
|
96
|
-
Open modal
|
|
97
|
-
</button>
|
|
98
|
-
</div>
|
|
99
|
-
<Modal {...args} {...modal} footer={ModalFooter}>
|
|
100
|
-
<div className={"px-5"} style={{ height: "900px" }}>
|
|
101
|
-
Hello body
|
|
102
|
-
<br />
|
|
103
|
-
Hello body
|
|
104
|
-
<br />
|
|
105
|
-
Hello body
|
|
106
|
-
<br />
|
|
107
|
-
Hello body
|
|
108
|
-
<br />
|
|
109
|
-
Hello body
|
|
110
|
-
<br />
|
|
111
|
-
Hello body
|
|
112
|
-
<br />
|
|
113
|
-
Hello body
|
|
114
|
-
<br />
|
|
115
|
-
Hello body
|
|
116
|
-
<br />
|
|
117
|
-
Hello body
|
|
118
|
-
<br />
|
|
119
|
-
Hello body
|
|
120
|
-
<br />
|
|
121
|
-
Hello body
|
|
122
|
-
<br />
|
|
123
|
-
Hello body
|
|
124
|
-
<br />
|
|
125
|
-
Hello body
|
|
126
|
-
<br />
|
|
127
|
-
Hello body
|
|
128
|
-
<br />
|
|
129
|
-
Hello body
|
|
130
|
-
<br />
|
|
131
|
-
Hello body
|
|
132
|
-
<br />
|
|
133
|
-
Hello body
|
|
134
|
-
<br />
|
|
135
|
-
Hello body
|
|
136
|
-
<br />
|
|
137
|
-
Hello body
|
|
138
|
-
<br />
|
|
139
|
-
Hello body
|
|
140
|
-
<br />
|
|
141
|
-
Hello body
|
|
142
|
-
<br />
|
|
143
|
-
Hello body
|
|
144
|
-
<br />
|
|
145
|
-
Hello body
|
|
146
|
-
<br />
|
|
147
|
-
Hello body
|
|
148
|
-
<br />
|
|
149
|
-
Hello body
|
|
150
|
-
<br />
|
|
151
|
-
Hello body
|
|
152
|
-
<br />
|
|
153
|
-
Hello body
|
|
154
|
-
<br />
|
|
155
|
-
Hello body
|
|
156
|
-
<br />
|
|
157
|
-
</div>
|
|
158
|
-
</Modal>
|
|
159
|
-
</div>
|
|
160
|
-
);
|
|
161
|
-
};
|
|
162
|
-
|
|
163
|
-
WithFooter.args = {
|
|
164
|
-
title: "Modal title"
|
|
165
|
-
};
|
|
166
|
-
|
|
167
|
-
export const WithRemoveModal = (args: RemoveModalProps) => {
|
|
168
|
-
const modal = useModal();
|
|
169
|
-
|
|
170
|
-
return (
|
|
171
|
-
<div>
|
|
172
|
-
<div>
|
|
173
|
-
<button className={"btn btn-primary"} onClick={modal.openModal}>
|
|
174
|
-
Open modal
|
|
175
|
-
</button>
|
|
176
|
-
</div>
|
|
177
|
-
<RemoveModal
|
|
178
|
-
{...args}
|
|
179
|
-
i18n={(f) => f}
|
|
180
|
-
show={modal.show}
|
|
181
|
-
onSubmit={modal.closeModal}
|
|
182
|
-
onClose={modal.closeModal}
|
|
183
|
-
closeModal={modal.closeModal}
|
|
184
|
-
/>
|
|
185
|
-
</div>
|
|
186
|
-
);
|
|
187
|
-
};
|
|
188
|
-
|
|
189
|
-
WithRemoveModal.args = {
|
|
190
|
-
valueToCompare: "value",
|
|
191
|
-
itemType: "form"
|
|
192
|
-
};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useState } from "react";
|
|
2
|
-
|
|
3
|
-
import { Pagination } from "./pagination.component";
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
title: "ReactFormio/Pagination",
|
|
7
|
-
component: Pagination,
|
|
8
|
-
|
|
9
|
-
parameters: {}
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export const Sandbox = (args: any) => {
|
|
13
|
-
const [currentPageIndex, setPageIndex] = useState(args.pageIndex);
|
|
14
|
-
|
|
15
|
-
useEffect(() => {
|
|
16
|
-
args.gotoPage && args.gotoPage(currentPageIndex);
|
|
17
|
-
}, [currentPageIndex]);
|
|
18
|
-
|
|
19
|
-
return (
|
|
20
|
-
<div>
|
|
21
|
-
<Pagination {...args} pageIndex={currentPageIndex} gotoPage={setPageIndex} />
|
|
22
|
-
</div>
|
|
23
|
-
);
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
Sandbox.args = {
|
|
27
|
-
pageSizes: [10, 25, 50, 100],
|
|
28
|
-
pageCount: 50,
|
|
29
|
-
pageIndex: 1
|
|
30
|
-
// gotoPage,
|
|
31
|
-
// canPreviousPage,
|
|
32
|
-
// previousPage,
|
|
33
|
-
// nextPage,
|
|
34
|
-
// canNextPage,
|
|
35
|
-
// pageCount,
|
|
36
|
-
// pageIndex,
|
|
37
|
-
// pageOptions,
|
|
38
|
-
// pageSize,
|
|
39
|
-
// setPageSize,
|
|
40
|
-
};
|
|
@@ -1,197 +0,0 @@
|
|
|
1
|
-
import { Components, ComponentSchema } from "formiojs";
|
|
2
|
-
import ReactDOM from "react-dom";
|
|
3
|
-
|
|
4
|
-
import { Submission } from "../../interfaces/Submission";
|
|
5
|
-
|
|
6
|
-
export class ReactComponent<Data = any> extends Components.components.field {
|
|
7
|
-
public reactInstance: any;
|
|
8
|
-
public shouldSetValue?: boolean;
|
|
9
|
-
private dataForSetting?: Data;
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* This is the first phase of component building where the component is instantiated.
|
|
13
|
-
*
|
|
14
|
-
* @param component - The component definition created from the settings form.
|
|
15
|
-
* @param options - Any options passed into the renderer.
|
|
16
|
-
* @param data - The submission data where this component's data exists.
|
|
17
|
-
*/
|
|
18
|
-
constructor(component: ComponentSchema, options: any, data: Submission<Data>) {
|
|
19
|
-
super(component, options, data);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
get $reactNode() {
|
|
23
|
-
return (this.refs as any)[`react-${this.id}`];
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* This method is called any time the component needs to be rebuilt. It is most frequently used to listen to other
|
|
28
|
-
* components using the this.on() function.
|
|
29
|
-
*/
|
|
30
|
-
init() {
|
|
31
|
-
return super.init();
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* This method is called before the component is going to be destroyed, which is when the component instance is
|
|
36
|
-
* destroyed. This is different from detach which is when the component instance still exists but the dom instance is
|
|
37
|
-
* removed.
|
|
38
|
-
*/
|
|
39
|
-
destroy() {
|
|
40
|
-
return super.destroy();
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* The second phase of component building where the component is rendered as an HTML string.
|
|
45
|
-
*
|
|
46
|
-
* @returns {string} - The return is the full string of the component
|
|
47
|
-
*/
|
|
48
|
-
render() {
|
|
49
|
-
// For react components, we simply render as a div which will become the react instance.
|
|
50
|
-
// By calling super.render(string) it will wrap the component with the needed wrappers to make it a full component.
|
|
51
|
-
return super.render(`<div ref="react-${this.id}"></div>`);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* The third phase of component building where the component has been attached to the DOM as 'element' and is ready
|
|
56
|
-
* to have its javascript events attached.
|
|
57
|
-
*
|
|
58
|
-
* @param element
|
|
59
|
-
* @returns {Promise<void>} - Return a promise that resolves when the attach is complete.
|
|
60
|
-
*/
|
|
61
|
-
async attach(element: any) {
|
|
62
|
-
super.attach(element);
|
|
63
|
-
|
|
64
|
-
// The loadRefs function will find all dom elements that have the "ref" setting that match the object property.
|
|
65
|
-
// It can load a single element or multiple elements with the same ref.
|
|
66
|
-
this.loadRefs(element, {
|
|
67
|
-
[`react-${this.id}`]: "single"
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
// @ts-ignore
|
|
71
|
-
if (this.refs[`react-${this.id}`]) {
|
|
72
|
-
// @ts-ignore
|
|
73
|
-
this.reactInstance = this.attachReact(this.refs[`react-${this.id}`]);
|
|
74
|
-
|
|
75
|
-
if (this.shouldSetValue) {
|
|
76
|
-
this.setValue(this.dataForSetting);
|
|
77
|
-
this.updateValue(this.dataForSetting);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* The fourth phase of component building where the component is being removed from the page. This could be a redraw
|
|
84
|
-
* or it is being removed from the form.
|
|
85
|
-
*/
|
|
86
|
-
detach() {
|
|
87
|
-
// @ts-ignore
|
|
88
|
-
if (this.refs[`react-${this.id}`]) {
|
|
89
|
-
// @ts-ignore
|
|
90
|
-
this.detachReact(this.refs[`react-${this.id}`]);
|
|
91
|
-
}
|
|
92
|
-
super.detach();
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Override this function to render a react component.
|
|
97
|
-
*/
|
|
98
|
-
renderReact(): any {
|
|
99
|
-
return null;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Override this function to insert your custom component.
|
|
104
|
-
*
|
|
105
|
-
* @param element
|
|
106
|
-
*/
|
|
107
|
-
|
|
108
|
-
attachReact(element?: any) {
|
|
109
|
-
// eslint-disable-next-line react/no-render-return-value,react/no-deprecated
|
|
110
|
-
return ReactDOM.render(this.renderReact(), element);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* Override this function.
|
|
115
|
-
*/
|
|
116
|
-
|
|
117
|
-
detachReact(element?: any) {
|
|
118
|
-
if (element) {
|
|
119
|
-
// eslint-disable-next-line react/no-deprecated
|
|
120
|
-
ReactDOM.unmountComponentAtNode(element);
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* Something external has set a value and our component needs to be updated to reflect that. For example, loading a submission.
|
|
126
|
-
*
|
|
127
|
-
* @param value
|
|
128
|
-
* @param flags
|
|
129
|
-
*/
|
|
130
|
-
setValue(value: any) {
|
|
131
|
-
if (this.reactInstance) {
|
|
132
|
-
this.reactInstance.setState({
|
|
133
|
-
value: value
|
|
134
|
-
});
|
|
135
|
-
this.shouldSetValue = false;
|
|
136
|
-
} else {
|
|
137
|
-
this.shouldSetValue = true;
|
|
138
|
-
this.dataForSetting = value;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
return false;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* The user has changed the value in the component and the value needs to be updated on the main submission object and other components notified of a change event.
|
|
146
|
-
*
|
|
147
|
-
* @param value
|
|
148
|
-
* @param flags
|
|
149
|
-
*/
|
|
150
|
-
updateValue = (value?: Data, flags?: Record<string, any>) => {
|
|
151
|
-
flags = flags || {};
|
|
152
|
-
|
|
153
|
-
const newValue = value === undefined || value === null ? this.getValue() : value;
|
|
154
|
-
|
|
155
|
-
const changed = newValue !== undefined ? this.hasChanged(newValue, this.dataValue) : false;
|
|
156
|
-
|
|
157
|
-
this.dataValue = Array.isArray(newValue) ? [...newValue] : newValue;
|
|
158
|
-
|
|
159
|
-
this.updateOnChange(flags, changed);
|
|
160
|
-
return changed;
|
|
161
|
-
};
|
|
162
|
-
|
|
163
|
-
/**
|
|
164
|
-
* Get the current value of the component. Should return the value set in the react component.
|
|
165
|
-
*
|
|
166
|
-
* @returns {*}
|
|
167
|
-
*/
|
|
168
|
-
getValue(): Data {
|
|
169
|
-
if (this.reactInstance) {
|
|
170
|
-
return this.reactInstance.state.value;
|
|
171
|
-
}
|
|
172
|
-
return this.defaultValue;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
/**
|
|
176
|
-
* Override normal validation check to insert custom validation in react component.
|
|
177
|
-
*
|
|
178
|
-
* @param data
|
|
179
|
-
* @param dirty
|
|
180
|
-
* @param rowData
|
|
181
|
-
* @returns {boolean}
|
|
182
|
-
*/
|
|
183
|
-
checkValidity(data: Data, dirty: boolean, rowData: any) {
|
|
184
|
-
const valid = super.checkValidity(data, dirty, rowData);
|
|
185
|
-
|
|
186
|
-
if (!valid) {
|
|
187
|
-
return false;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
return this.validate(data, dirty, rowData);
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
194
|
-
validate(data: Data, dirty: boolean, rowData: any) {
|
|
195
|
-
return true;
|
|
196
|
-
}
|
|
197
|
-
}
|