@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
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { JSON } from "../../interfaces";
|
|
2
|
+
import { useForm, UseFormProps } from "./useForm";
|
|
3
|
+
|
|
4
|
+
class CSSProperties {}
|
|
5
|
+
|
|
6
|
+
export interface FormProps<Data extends { [key: string]: JSON } = { [key: string]: JSON }> extends UseFormProps<Data> {
|
|
7
|
+
["data-testid"]?: string;
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
*/
|
|
11
|
+
className?: string;
|
|
12
|
+
|
|
13
|
+
style?: CSSProperties;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function Form<Data extends { [key: string]: JSON } = { [key: string]: JSON }>({
|
|
17
|
+
style,
|
|
18
|
+
className,
|
|
19
|
+
"data-testid": dataTestId = "formio-container",
|
|
20
|
+
...props
|
|
21
|
+
}: Partial<FormProps<Data>>) {
|
|
22
|
+
const { element } = useForm<Data>(props);
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<div>
|
|
26
|
+
<div data-testid={dataTestId} style={style} className={className} ref={element} />
|
|
27
|
+
</div>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ComponentType, FormType } from "../../../interfaces";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export function getRoleComponent({ label, key, description, choices, data }: any): ExtendedComponentSchema {
|
|
3
|
+
export function getRoleComponent({ label, key, description, choices, data }: any): ComponentType {
|
|
6
4
|
return {
|
|
7
5
|
label,
|
|
8
6
|
key,
|
|
@@ -34,7 +32,7 @@ function toDescription(description: string, hr = true): string {
|
|
|
34
32
|
return '<span class="text-sm">' + description + "</span> " + (hr ? '<hr class="mt-6 mb-5 border-gray-200 mx-20"/>' : "");
|
|
35
33
|
}
|
|
36
34
|
|
|
37
|
-
export function getSubmissionPermissionForm({ choices }: any):
|
|
35
|
+
export function getSubmissionPermissionForm({ choices }: any): FormType {
|
|
38
36
|
return {
|
|
39
37
|
description: "<strong>Elevated permissions allow users to access and modify other user's entities. Assign with caution.</strong>",
|
|
40
38
|
components: [
|
|
@@ -107,7 +105,7 @@ export function getSubmissionPermissionForm({ choices }: any): FormSchema {
|
|
|
107
105
|
};
|
|
108
106
|
}
|
|
109
107
|
|
|
110
|
-
export function getAccessPermissionForm({ choices }: any):
|
|
108
|
+
export function getAccessPermissionForm({ choices }: any): FormType {
|
|
111
109
|
return {
|
|
112
110
|
description: "<strong>Elevated permissions allow users to access and modify other user's entities. Assign with caution.</strong>",
|
|
113
111
|
components: [
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
2
|
import { expect, fn, userEvent, within } from "@storybook/test";
|
|
3
3
|
|
|
4
|
-
import { FormAccess } from "./
|
|
4
|
+
import { FormAccess } from "./FormAccess";
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
*
|
|
8
|
+
* ```tsx
|
|
9
|
+
* import {FormAccess} from "@tsed/react-formio/organisms/form-access/FormAccess";
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
6
12
|
export default {
|
|
7
|
-
title: "
|
|
13
|
+
title: "form/access/FormAccess",
|
|
8
14
|
component: FormAccess,
|
|
9
15
|
argTypes: {
|
|
10
16
|
onSubmit: { action: "onSubmit" }
|
package/src/{components/form-access/formAccess.component.tsx → organisms/form/access/FormAccess.tsx}
RENAMED
|
@@ -1,22 +1,21 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { PropsWithChildren, useCallback, useEffect, useMemo, useState } from "react";
|
|
2
2
|
|
|
3
|
-
import type { FormOptions,
|
|
4
|
-
import { Card } from "
|
|
5
|
-
import { Form } from "
|
|
6
|
-
import { ChangedSubmission } from "../form/useForm.hook";
|
|
3
|
+
import type { FormOptions, FormType, SubmissionType } from "../../../interfaces";
|
|
4
|
+
import { Card } from "../../../molecules/card/Card";
|
|
5
|
+
import { Form } from "../../form/Form";
|
|
7
6
|
import {
|
|
8
|
-
|
|
7
|
+
AccessRolesType,
|
|
9
8
|
dataAccessToSubmissions,
|
|
10
|
-
|
|
9
|
+
FormAccessType,
|
|
11
10
|
getFormAccess,
|
|
12
11
|
shouldUpdate,
|
|
13
|
-
|
|
12
|
+
SubmissionAccessType,
|
|
14
13
|
submissionsToDataAccess,
|
|
15
14
|
updateSubmissions
|
|
16
|
-
} from "./
|
|
15
|
+
} from "./FormAccess.utils";
|
|
17
16
|
|
|
18
17
|
export interface FormAccessProps {
|
|
19
|
-
form: Partial<
|
|
18
|
+
form: Partial<FormType>;
|
|
20
19
|
roles: any;
|
|
21
20
|
onSubmit?: Function;
|
|
22
21
|
options?: FormOptions;
|
|
@@ -28,7 +27,7 @@ function useFormAccess({ form: formDefinition, roles, onSubmit, options }: FormA
|
|
|
28
27
|
const [submissions, setSubmissions] = useState(() => dataAccessToSubmissions(formDefinition, form));
|
|
29
28
|
|
|
30
29
|
const onChange = useCallback(
|
|
31
|
-
(type: string, submission:
|
|
30
|
+
(type: string, submission: SubmissionType<AccessRolesType>) => {
|
|
32
31
|
updateSubmissions(type, submission, submissions, setSubmissions);
|
|
33
32
|
},
|
|
34
33
|
[submissions]
|
|
@@ -57,12 +56,12 @@ function useFormAccess({ form: formDefinition, roles, onSubmit, options }: FormA
|
|
|
57
56
|
|
|
58
57
|
interface NamedFormAccessProps {
|
|
59
58
|
name: "access" | "submissionAccess";
|
|
60
|
-
form:
|
|
61
|
-
submissions:
|
|
59
|
+
form: FormAccessType;
|
|
60
|
+
submissions: SubmissionAccessType;
|
|
62
61
|
options: any;
|
|
63
62
|
onSubmit: any;
|
|
64
63
|
|
|
65
|
-
onChange(name: "access" | "submissionAccess", submission:
|
|
64
|
+
onChange(name: "access" | "submissionAccess", submission: SubmissionType<AccessRolesType>): void;
|
|
66
65
|
}
|
|
67
66
|
|
|
68
67
|
function NamedFormAccess({ name, form, submissions, options, onChange, onSubmit, children }: PropsWithChildren<NamedFormAccessProps>) {
|
|
@@ -70,12 +69,11 @@ function NamedFormAccess({ name, form, submissions, options, onChange, onSubmit,
|
|
|
70
69
|
|
|
71
70
|
return (
|
|
72
71
|
<>
|
|
73
|
-
<Form
|
|
74
|
-
name={name}
|
|
72
|
+
<Form<AccessRolesType>
|
|
75
73
|
form={form[name]}
|
|
76
74
|
submission={submissions[name]}
|
|
77
|
-
onChange={({ data, isValid }
|
|
78
|
-
isValid && onChange(name, { data });
|
|
75
|
+
onChange={({ data, isValid }) => {
|
|
76
|
+
isValid && onChange(name, { data: data as unknown as AccessRolesType });
|
|
79
77
|
setIsValid(isValid);
|
|
80
78
|
}}
|
|
81
79
|
options={options}
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { FormType } from "../../../interfaces";
|
|
2
|
+
import {
|
|
3
|
+
dataAccessToSubmissions,
|
|
4
|
+
getFormAccess,
|
|
5
|
+
SubmissionAccessType,
|
|
6
|
+
submissionsToDataAccess,
|
|
7
|
+
updateSubmissions
|
|
8
|
+
} from "./FormAccess.utils";
|
|
3
9
|
|
|
4
10
|
const roles: any[] = [
|
|
5
11
|
{
|
|
@@ -13,7 +19,7 @@ const roles: any[] = [
|
|
|
13
19
|
describe("formAccess.utils", () => {
|
|
14
20
|
describe("dataAccessToSubmissions()", () => {
|
|
15
21
|
it("should map data access to form submissions", () => {
|
|
16
|
-
const data:
|
|
22
|
+
const data: FormType = {
|
|
17
23
|
_id: "id",
|
|
18
24
|
components: [],
|
|
19
25
|
access: [
|
|
@@ -60,7 +66,7 @@ describe("formAccess.utils", () => {
|
|
|
60
66
|
});
|
|
61
67
|
describe("submissionsToDataAccess()", () => {
|
|
62
68
|
it("should map form submissions to data access", () => {
|
|
63
|
-
const submissions:
|
|
69
|
+
const submissions: SubmissionAccessType = {
|
|
64
70
|
access: {
|
|
65
71
|
data: {
|
|
66
72
|
delete_all: [],
|
|
@@ -85,7 +91,7 @@ describe("formAccess.utils", () => {
|
|
|
85
91
|
}
|
|
86
92
|
};
|
|
87
93
|
|
|
88
|
-
const originalForm:
|
|
94
|
+
const originalForm: FormType = {
|
|
89
95
|
_id: "id",
|
|
90
96
|
components: [],
|
|
91
97
|
access: [
|
|
@@ -173,7 +179,7 @@ describe("formAccess.utils", () => {
|
|
|
173
179
|
|
|
174
180
|
describe("updateSubmissions()", () => {
|
|
175
181
|
it("should update submissions", () => {
|
|
176
|
-
const submissions:
|
|
182
|
+
const submissions: SubmissionAccessType = {
|
|
177
183
|
access: {
|
|
178
184
|
data: {
|
|
179
185
|
delete_all: [],
|
|
@@ -239,7 +245,7 @@ describe("formAccess.utils", () => {
|
|
|
239
245
|
});
|
|
240
246
|
});
|
|
241
247
|
it("should do nothing", () => {
|
|
242
|
-
const submissions:
|
|
248
|
+
const submissions: SubmissionAccessType = {
|
|
243
249
|
access: {
|
|
244
250
|
data: {
|
|
245
251
|
delete_all: [],
|
package/src/{components/form-access/formAccess.utils.ts → organisms/form/access/FormAccess.utils.ts}
RENAMED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import { ExtendedComponentSchema } from "formiojs";
|
|
2
1
|
import cloneDeep from "lodash/cloneDeep";
|
|
3
2
|
import isEqual from "lodash/isEqual";
|
|
4
3
|
import noop from "lodash/noop";
|
|
5
4
|
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { getAccessPermissionForm, getSubmissionPermissionForm } from "./formAccess.schema";
|
|
5
|
+
import type { ComponentType, FormType, RoleType, SubmissionType } from "../../../interfaces";
|
|
6
|
+
import { getAccessPermissionForm, getSubmissionPermissionForm } from "./FormAccess.schema";
|
|
9
7
|
|
|
10
8
|
export interface Choice {
|
|
11
9
|
label: string;
|
|
@@ -17,19 +15,19 @@ export interface Access {
|
|
|
17
15
|
type: string;
|
|
18
16
|
}
|
|
19
17
|
|
|
20
|
-
export type
|
|
18
|
+
export type AccessRolesType = Record<string, string[]>;
|
|
21
19
|
|
|
22
|
-
export type
|
|
23
|
-
access:
|
|
24
|
-
submissionAccess:
|
|
20
|
+
export type FormAccessType = {
|
|
21
|
+
access: FormType;
|
|
22
|
+
submissionAccess: FormType;
|
|
25
23
|
};
|
|
26
24
|
|
|
27
|
-
export type
|
|
28
|
-
access:
|
|
29
|
-
submissionAccess:
|
|
25
|
+
export type SubmissionAccessType = {
|
|
26
|
+
access: SubmissionType<AccessRolesType>;
|
|
27
|
+
submissionAccess: SubmissionType<AccessRolesType>;
|
|
30
28
|
};
|
|
31
29
|
|
|
32
|
-
function rolesToChoices(roles:
|
|
30
|
+
function rolesToChoices(roles: RoleType[]): Choice[] {
|
|
33
31
|
return Object.values(roles).map((role) => {
|
|
34
32
|
return {
|
|
35
33
|
label: role.title || "",
|
|
@@ -38,7 +36,7 @@ function rolesToChoices(roles: RoleSchema[]): Choice[] {
|
|
|
38
36
|
});
|
|
39
37
|
}
|
|
40
38
|
|
|
41
|
-
function accessToHash(keys: (string | undefined)[] | undefined, access: Access[] = []):
|
|
39
|
+
function accessToHash(keys: (string | undefined)[] | undefined, access: Access[] = []): AccessRolesType {
|
|
42
40
|
const hash = Object.values(access).reduce((o: any, role: any) => {
|
|
43
41
|
o[role.type] = role.roles;
|
|
44
42
|
return o;
|
|
@@ -52,7 +50,7 @@ function accessToHash(keys: (string | undefined)[] | undefined, access: Access[]
|
|
|
52
50
|
}, {});
|
|
53
51
|
}
|
|
54
52
|
|
|
55
|
-
function hashToAccess(data:
|
|
53
|
+
function hashToAccess(data: AccessRolesType) {
|
|
56
54
|
const accessRoles: any[] = [];
|
|
57
55
|
|
|
58
56
|
Object.entries(data).forEach(([accessType, roles]) => {
|
|
@@ -68,7 +66,7 @@ function hashToAccess(data: AccessRoles) {
|
|
|
68
66
|
return accessRoles;
|
|
69
67
|
}
|
|
70
68
|
|
|
71
|
-
export function getFormAccess(roles:
|
|
69
|
+
export function getFormAccess(roles: RoleType[]): FormAccessType {
|
|
72
70
|
const choices = rolesToChoices(roles);
|
|
73
71
|
const access = getAccessPermissionForm({ choices });
|
|
74
72
|
const submissionAccess = getSubmissionPermissionForm({ choices });
|
|
@@ -79,8 +77,8 @@ export function getFormAccess(roles: RoleSchema[]): FormAccessSchema {
|
|
|
79
77
|
};
|
|
80
78
|
}
|
|
81
79
|
|
|
82
|
-
export function dataAccessToSubmissions(form: Partial<
|
|
83
|
-
const getKeys = (components:
|
|
80
|
+
export function dataAccessToSubmissions(form: Partial<FormType>, formAccess: FormAccessType): SubmissionAccessType {
|
|
81
|
+
const getKeys = (components: ComponentType[]) => components.map(({ key }) => key);
|
|
84
82
|
|
|
85
83
|
return {
|
|
86
84
|
access: {
|
|
@@ -92,7 +90,7 @@ export function dataAccessToSubmissions(form: Partial<FormSchema>, formAccess: F
|
|
|
92
90
|
};
|
|
93
91
|
}
|
|
94
92
|
|
|
95
|
-
export function submissionsToDataAccess(form: Partial<
|
|
93
|
+
export function submissionsToDataAccess(form: Partial<FormType>, submissions: SubmissionAccessType): Partial<FormType> {
|
|
96
94
|
return {
|
|
97
95
|
...cloneDeep(form),
|
|
98
96
|
access: hashToAccess(submissions.access.data),
|
|
@@ -100,11 +98,16 @@ export function submissionsToDataAccess(form: Partial<FormSchema>, submissions:
|
|
|
100
98
|
};
|
|
101
99
|
}
|
|
102
100
|
|
|
103
|
-
export function shouldUpdate(type: string, submission:
|
|
101
|
+
export function shouldUpdate(type: string, submission: SubmissionType<AccessRolesType>, submissions: SubmissionAccessType) {
|
|
104
102
|
return !isEqual(submission.data, (submissions as any)[type].data);
|
|
105
103
|
}
|
|
106
104
|
|
|
107
|
-
export function updateSubmissions(
|
|
105
|
+
export function updateSubmissions(
|
|
106
|
+
type: string,
|
|
107
|
+
submission: SubmissionType<AccessRolesType>,
|
|
108
|
+
submissions: SubmissionAccessType,
|
|
109
|
+
cb: Function = noop
|
|
110
|
+
) {
|
|
108
111
|
if (shouldUpdate(type, submission, submissions)) {
|
|
109
112
|
submissions = {
|
|
110
113
|
...submissions,
|
|
@@ -1,27 +1,25 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import { FormAction } from "./formAction.component";
|
|
1
|
+
import { FormAction } from "./FormAction";
|
|
4
2
|
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* ```tsx
|
|
6
|
+
* import {FormAction} from "@tsed/react-formio/organisms/form/action/FormAction";
|
|
7
|
+
* ```
|
|
8
|
+
*/
|
|
5
9
|
export default {
|
|
6
|
-
title: "
|
|
10
|
+
title: "form/action/FormAction",
|
|
7
11
|
component: FormAction,
|
|
8
12
|
argTypes: {
|
|
9
13
|
onSubmit: { action: "onSubmit" },
|
|
10
14
|
|
|
11
15
|
type: {
|
|
12
|
-
control:
|
|
13
|
-
type: "object"
|
|
14
|
-
}
|
|
16
|
+
control: "object"
|
|
15
17
|
},
|
|
16
18
|
form: {
|
|
17
|
-
control:
|
|
18
|
-
type: "object"
|
|
19
|
-
}
|
|
19
|
+
control: "object"
|
|
20
20
|
},
|
|
21
21
|
options: {
|
|
22
|
-
control:
|
|
23
|
-
type: "object"
|
|
24
|
-
}
|
|
22
|
+
control: "object"
|
|
25
23
|
}
|
|
26
24
|
},
|
|
27
25
|
parameters: {
|
package/src/{components/form-action/formAction.component.tsx → organisms/form/action/FormAction.tsx}
RENAMED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import FormioUtils from "formiojs/utils";
|
|
2
|
-
import
|
|
2
|
+
import { PropsWithChildren, ReactElement } from "react";
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
import { Form } from "
|
|
4
|
+
import { ActionDefaultsType, ActionType, FormOptions, SubmissionType } from "../../../interfaces";
|
|
5
|
+
import { Form } from "../../form/Form";
|
|
6
6
|
|
|
7
|
-
function mapData(options: any, defaults:
|
|
7
|
+
function mapData(options: any, defaults: ActionDefaultsType): any {
|
|
8
8
|
return {
|
|
9
9
|
...defaults,
|
|
10
10
|
...options
|
|
@@ -33,9 +33,9 @@ function mapSettingsForm({ action, ...settingsForm }: any): any {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
export interface FormActionProps {
|
|
36
|
-
actionInfo: Partial<
|
|
37
|
-
submission?: Partial<
|
|
38
|
-
onSubmit?: (submission:
|
|
36
|
+
actionInfo: Partial<ActionType>;
|
|
37
|
+
submission?: Partial<SubmissionType>;
|
|
38
|
+
onSubmit?: (submission: SubmissionType<ActionType>) => void;
|
|
39
39
|
options: FormOptions;
|
|
40
40
|
}
|
|
41
41
|
|
|
@@ -51,7 +51,7 @@ export function FormAction({ actionInfo, children, onSubmit, options, ...props }
|
|
|
51
51
|
<div>
|
|
52
52
|
{children}
|
|
53
53
|
|
|
54
|
-
<Form form={form} submission={submission} onSubmit={onSubmit} options={options} />
|
|
54
|
+
<Form<ActionType> form={form} submission={submission} onSubmit={onSubmit} options={options} />
|
|
55
55
|
|
|
56
56
|
{children}
|
|
57
57
|
</div>
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
|
|
3
|
+
import form from "../../__fixtures__/form.fixture.json";
|
|
4
|
+
import formWizard from "../../__fixtures__/form-wizard.fixture.json";
|
|
5
|
+
import { FormBuilder } from "./FormBuilder";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The [FormBuilder](/story/reactformio-formbuilder--sandbox) class can be used to embed a form builder directly in your React application.
|
|
9
|
+
*
|
|
10
|
+
* Please note that you'll need to include the CSS for the form builder from formio.js as well.
|
|
11
|
+
*
|
|
12
|
+
* Please note that the [FormBuilder](/story/reactformio-formbuilder--sandbox) component does not load and save from/to an url.
|
|
13
|
+
* You must handle the form definition loading and saving yourself or use the [FormEdit](/docs/documentation-formedit--docs) component.
|
|
14
|
+
*
|
|
15
|
+
* ```tsx
|
|
16
|
+
* import {FormBuilder} from "@tsed/react-formio/organisms/form/builder/FormBuilder";
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
export default {
|
|
21
|
+
title: "form/builder/FormBuilder",
|
|
22
|
+
component: FormBuilder,
|
|
23
|
+
argTypes: {
|
|
24
|
+
display: {
|
|
25
|
+
control: "select",
|
|
26
|
+
options: ["form", "wizard", "pdf"]
|
|
27
|
+
},
|
|
28
|
+
components: {
|
|
29
|
+
control: "object"
|
|
30
|
+
},
|
|
31
|
+
options: {
|
|
32
|
+
description:
|
|
33
|
+
"The form builder options. See [here](https://help.form.io/developers/form-development/form-builder#form-builder-options) for more details.",
|
|
34
|
+
control: "object"
|
|
35
|
+
},
|
|
36
|
+
onBuilderReady: {
|
|
37
|
+
description:
|
|
38
|
+
"A callback function that gets called when the form builder has rendered. It is useful for accessing the underlying @formio/js FormBuilder instance.",
|
|
39
|
+
action: "onBuilderReady"
|
|
40
|
+
},
|
|
41
|
+
onChange: {
|
|
42
|
+
description: "A callback function that gets called when the form being built has changed.",
|
|
43
|
+
action: "onChange"
|
|
44
|
+
},
|
|
45
|
+
onSaveComponent: {
|
|
46
|
+
description: "A callback function that gets called when a component is saved in the builder.",
|
|
47
|
+
action: "onSaveComponent"
|
|
48
|
+
},
|
|
49
|
+
onEditComponent: {
|
|
50
|
+
description: "A callback function that gets called when a component is edited in the builder.",
|
|
51
|
+
action: "onEditComponent"
|
|
52
|
+
},
|
|
53
|
+
onUpdateComponent: {
|
|
54
|
+
description: "A callback function that gets called when a component is updated in the builder.",
|
|
55
|
+
action: "onUpdateComponent"
|
|
56
|
+
},
|
|
57
|
+
onDeleteComponent: {
|
|
58
|
+
description: "A callback function that gets called when a component is deleted in the builder.",
|
|
59
|
+
action: "onDeleteComponent"
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
tags: ["autodocs"]
|
|
63
|
+
} satisfies Meta<typeof FormBuilder>;
|
|
64
|
+
|
|
65
|
+
type Story = StoryObj<typeof FormBuilder>;
|
|
66
|
+
/**
|
|
67
|
+
* A traditional web form that is typically filled out by end-users from top to bottom
|
|
68
|
+
*/
|
|
69
|
+
export const WebForm: Story = {
|
|
70
|
+
args: {
|
|
71
|
+
display: form.display as any,
|
|
72
|
+
options: { template: "tailwind", iconset: "bx" },
|
|
73
|
+
components: form.components as any
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* This form configuration allows users to progress through the form in bite-size sections instead of presenting the entire form to the user.
|
|
78
|
+
* If you are creating a form containing many fields, this is a great option to improve the user experience.
|
|
79
|
+
*/
|
|
80
|
+
export const Wizard: Story = {
|
|
81
|
+
args: {
|
|
82
|
+
display: formWizard.display as any,
|
|
83
|
+
components: formWizard.components as any,
|
|
84
|
+
options: { template: "tailwind", iconset: "bx" }
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* PDF-First forms allow users to upload a PDF form and add overlay fields to the form, modernizing the traditional old and clunky PDF form.
|
|
89
|
+
* For a more in-depth guide on the PDF forms please navigate to the [following documentation](https://help.form.io/userguide/forms/pdf#introduction).
|
|
90
|
+
*/
|
|
91
|
+
export const Pdf: Story = {
|
|
92
|
+
args: {
|
|
93
|
+
display: "pdf",
|
|
94
|
+
components: [],
|
|
95
|
+
options: { template: "tailwind", iconset: "bx" }
|
|
96
|
+
}
|
|
97
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { CSSProperties } from "react";
|
|
2
|
+
|
|
3
|
+
import { registerComponent } from "../../../registries/components";
|
|
4
|
+
import { useFormBuilder, UseFormBuilderProps } from "./useFormBuilder";
|
|
5
|
+
|
|
6
|
+
export function FormBuilder({
|
|
7
|
+
className = "",
|
|
8
|
+
style = {},
|
|
9
|
+
["data-testid"]: dataTestId = "formio-builder-container",
|
|
10
|
+
...props
|
|
11
|
+
}: UseFormBuilderProps & {
|
|
12
|
+
className?: string;
|
|
13
|
+
style?: CSSProperties;
|
|
14
|
+
["data-testid"]?: string;
|
|
15
|
+
}) {
|
|
16
|
+
const renderElement = useFormBuilder(props);
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<div style={style} className={className} data-testid={dataTestId}>
|
|
20
|
+
{/* eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions */}
|
|
21
|
+
<div ref={renderElement} onClick={(e) => e.stopPropagation()}>
|
|
22
|
+
<div />
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
registerComponent("FormBuilder", FormBuilder);
|
package/src/{components/form-edit/formEdit.reducer.ts → organisms/form/builder/FormEdit.reducer.ts}
RENAMED
|
@@ -2,15 +2,15 @@ import camelCase from "lodash/camelCase";
|
|
|
2
2
|
import cloneDeep from "lodash/cloneDeep";
|
|
3
3
|
import isEqual from "lodash/isEqual";
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import type { FormType } from "../../../interfaces";
|
|
6
6
|
|
|
7
|
-
export const hasChanged = (form: Partial<
|
|
7
|
+
export const hasChanged = (form: Partial<FormType>, value: Partial<FormType>): boolean => !isEqual(form, value);
|
|
8
8
|
|
|
9
9
|
export interface FormEditState {
|
|
10
|
-
past: Partial<
|
|
11
|
-
future: Partial<
|
|
12
|
-
current: Partial<
|
|
13
|
-
original: Partial<
|
|
10
|
+
past: Partial<FormType>[];
|
|
11
|
+
future: Partial<FormType>[];
|
|
12
|
+
current: Partial<FormType>;
|
|
13
|
+
original: Partial<FormType>;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
export function createInitialState(props: any): FormEditState {
|