@tsed/react-formio 3.0.0-alpha.1 → 3.0.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/atoms/icon/Icon.d.ts +6 -0
- package/dist/atoms/icon/Icon.js +12 -0
- package/dist/atoms/icon/Icon.js.map +1 -0
- package/dist/chunks/_commonjsHelpers.js +7 -0
- package/dist/chunks/_commonjsHelpers.js.map +1 -0
- package/dist/chunks/index.js +16 -18
- package/dist/chunks/index.js.map +1 -1
- package/dist/chunks/index.module.js +56 -0
- package/dist/chunks/index.module.js.map +1 -0
- package/dist/chunks/react-select-animated.esm.js +3513 -0
- package/dist/chunks/react-select-animated.esm.js.map +1 -0
- package/dist/index.d.ts +0 -6
- package/dist/index.js +12 -105
- package/dist/index.js.map +1 -1
- package/dist/interfaces/ActionType.d.ts +23 -0
- package/dist/interfaces/ActionType.js +2 -0
- package/dist/interfaces/ActionType.js.map +1 -0
- package/dist/interfaces/ComponentType.d.ts +2 -0
- package/dist/interfaces/ComponentType.js +2 -0
- package/dist/interfaces/ComponentType.js.map +1 -0
- package/dist/interfaces/FormOptions.d.ts +3 -0
- package/dist/interfaces/{FormSchema.d.ts → FormType.d.ts} +3 -3
- package/dist/interfaces/FormType.js +2 -0
- package/dist/interfaces/FormType.js.map +1 -0
- package/dist/interfaces/Operation.d.ts +1 -2
- package/dist/interfaces/{RoleSchema.d.ts → RoleType.d.ts} +1 -1
- package/dist/interfaces/RoleType.js +2 -0
- package/dist/interfaces/RoleType.js.map +1 -0
- package/dist/interfaces/SubmissionType.d.ts +29 -0
- package/dist/interfaces/SubmissionType.js +2 -0
- package/dist/interfaces/SubmissionType.js.map +1 -0
- package/dist/interfaces/index.d.ts +5 -4
- package/dist/molecules/alert/Alert.d.ts +6 -0
- package/dist/{components/alert/alert.component.js → molecules/alert/Alert.js} +10 -7
- package/dist/molecules/alert/Alert.js.map +1 -0
- package/dist/molecules/button/Button.d.ts +8 -0
- package/dist/molecules/button/Button.js +52 -0
- package/dist/molecules/button/Button.js.map +1 -0
- package/dist/molecules/card/Card.js +12 -0
- package/dist/molecules/card/Card.js.map +1 -0
- package/dist/molecules/forms/form-control/FormControl.d.ts +17 -0
- package/dist/molecules/forms/form-control/FormControl.js +51 -0
- package/dist/molecules/forms/form-control/FormControl.js.map +1 -0
- package/dist/molecules/forms/input-tags/InputTags.d.ts +2 -0
- package/dist/molecules/forms/input-tags/InputTags.interface.d.ts +7 -0
- package/dist/molecules/forms/input-tags/InputTags.interface.js +2 -0
- package/dist/molecules/forms/input-tags/InputTags.interface.js.map +1 -0
- package/dist/molecules/forms/input-tags/InputTags.js +25 -0
- package/dist/molecules/forms/input-tags/InputTags.js.map +1 -0
- package/dist/molecules/forms/input-tags/all.d.ts +2 -0
- package/dist/molecules/forms/input-tags/all.js +9 -0
- package/dist/molecules/forms/input-tags/all.js.map +1 -0
- package/dist/molecules/forms/input-tags/components/ChoicesTags.d.ts +307 -0
- package/dist/molecules/forms/input-tags/components/ChoicesTags.js +51 -0
- package/dist/molecules/forms/input-tags/components/ChoicesTags.js.map +1 -0
- package/dist/molecules/forms/input-tags/components/ReactTags.d.ts +2 -0
- package/dist/molecules/forms/input-tags/components/ReactTags.js +1937 -0
- package/dist/molecules/forms/input-tags/components/ReactTags.js.map +1 -0
- package/dist/molecules/forms/input-text/InputText.d.ts +2 -0
- package/dist/molecules/forms/input-text/InputText.interface.d.ts +4 -0
- package/dist/molecules/forms/input-text/InputText.interface.js +2 -0
- package/dist/molecules/forms/input-text/InputText.interface.js.map +1 -0
- package/dist/molecules/forms/input-text/InputText.js +54 -0
- package/dist/molecules/forms/input-text/InputText.js.map +1 -0
- package/dist/molecules/forms/select/Select.d.ts +2 -0
- package/dist/molecules/forms/select/Select.interface.d.ts +38 -0
- package/dist/molecules/forms/select/Select.interface.js +2 -0
- package/dist/molecules/forms/select/Select.interface.js.map +1 -0
- package/dist/molecules/forms/select/Select.js +16 -0
- package/dist/molecules/forms/select/Select.js.map +1 -0
- package/dist/molecules/forms/select/all.d.ts +2 -0
- package/dist/molecules/forms/select/all.js +9 -0
- package/dist/molecules/forms/select/all.js.map +1 -0
- package/dist/molecules/forms/select/components/ChoicesSelect.d.ts +7 -0
- package/dist/molecules/forms/select/components/ChoicesSelect.js +115 -0
- package/dist/molecules/forms/select/components/ChoicesSelect.js.map +1 -0
- package/dist/molecules/forms/select/components/HtmlSelect.d.ts +2 -0
- package/dist/molecules/forms/select/components/HtmlSelect.js +35 -0
- package/dist/molecules/forms/select/components/HtmlSelect.js.map +1 -0
- package/dist/molecules/forms/select/components/ReactSelect.d.ts +2 -0
- package/dist/molecules/forms/select/components/ReactSelect.js +46 -0
- package/dist/molecules/forms/select/components/ReactSelect.js.map +1 -0
- package/dist/molecules/forms/select/components/choices.template.d.ts +7 -0
- package/dist/molecules/forms/select/components/choices.template.js +9654 -0
- package/dist/molecules/forms/select/components/choices.template.js.map +1 -0
- package/dist/molecules/forms/select/hooks/useOptions.d.ts +9 -0
- package/dist/molecules/forms/select/hooks/useOptions.js +35 -0
- package/dist/molecules/forms/select/hooks/useOptions.js.map +1 -0
- package/dist/{components/loader/loader.component.d.ts → molecules/loader/Loader.d.ts} +0 -9
- package/dist/molecules/loader/Loader.js +19 -0
- package/dist/molecules/loader/Loader.js.map +1 -0
- package/dist/{components/modal/modal.component.js → molecules/modal/Modal.js} +1 -1
- package/dist/molecules/modal/Modal.js.map +1 -0
- package/dist/{components/pagination/pagination.component.d.ts → molecules/pagination/Pagination.d.ts} +6 -5
- package/dist/molecules/pagination/Pagination.js +77 -0
- package/dist/molecules/pagination/Pagination.js.map +1 -0
- package/dist/molecules/pagination/PaginationButton.d.ts +7 -0
- package/dist/molecules/pagination/PaginationButton.js +21 -0
- package/dist/molecules/pagination/PaginationButton.js.map +1 -0
- package/dist/molecules/pagination/all.d.ts +2 -0
- package/dist/molecules/pagination/all.js +12 -0
- package/dist/molecules/pagination/all.js.map +1 -0
- package/dist/molecules/pagination/utils/getPageNumbers.js.map +1 -0
- package/dist/molecules/table/Table.d.ts +9 -0
- package/dist/molecules/table/Table.js +58 -0
- package/dist/molecules/table/Table.js.map +1 -0
- package/dist/molecules/table/all.d.ts +0 -0
- package/dist/molecules/table/all.js +19 -0
- package/dist/molecules/table/all.js.map +1 -0
- package/dist/molecules/table/components/DefaultArrowSort.d.ts +5 -0
- package/dist/molecules/table/components/DefaultArrowSort.js +22 -0
- package/dist/molecules/table/components/DefaultArrowSort.js.map +1 -0
- package/dist/molecules/table/components/DefaultCell.d.ts +5 -0
- package/dist/molecules/table/components/DefaultCell.js +13 -0
- package/dist/molecules/table/components/DefaultCell.js.map +1 -0
- package/dist/molecules/table/components/DefaultCellFooter.d.ts +6 -0
- package/dist/molecules/table/components/DefaultCellFooter.js +12 -0
- package/dist/molecules/table/components/DefaultCellFooter.js.map +1 -0
- package/dist/molecules/table/components/DefaultCellHeader.d.ts +6 -0
- package/dist/molecules/table/components/DefaultCellHeader.js +30 -0
- package/dist/molecules/table/components/DefaultCellHeader.js.map +1 -0
- package/dist/molecules/table/components/DefaultCellOperations.d.ts +10 -0
- package/dist/molecules/table/components/DefaultCellOperations.js +24 -0
- package/dist/molecules/table/components/DefaultCellOperations.js.map +1 -0
- package/dist/molecules/table/components/DefaultFilter.d.ts +11 -0
- package/dist/molecules/table/components/DefaultFilter.js +15 -0
- package/dist/molecules/table/components/DefaultFilter.js.map +1 -0
- package/dist/molecules/table/components/DefaultOperationButton.d.ts +11 -0
- package/dist/molecules/table/components/DefaultOperationButton.js +30 -0
- package/dist/molecules/table/components/DefaultOperationButton.js.map +1 -0
- package/dist/molecules/table/filters/Filters.d.js +2 -0
- package/dist/molecules/table/filters/Filters.d.js.map +1 -0
- package/dist/molecules/table/filters/RangeFilter.d.ts +3 -0
- package/dist/molecules/table/filters/RangeFilter.js +42 -0
- package/dist/molecules/table/filters/RangeFilter.js.map +1 -0
- package/dist/molecules/table/filters/SelectFilter.d.ts +3 -0
- package/dist/molecules/table/filters/SelectFilter.js +35 -0
- package/dist/molecules/table/filters/SelectFilter.js.map +1 -0
- package/dist/molecules/table/filters/TextFieldFilter.d.ts +3 -0
- package/dist/molecules/table/filters/TextFieldFilter.js +27 -0
- package/dist/molecules/table/filters/TextFieldFilter.js.map +1 -0
- package/dist/molecules/table/hooks/useTable.d.ts +15 -0
- package/dist/molecules/table/hooks/useTable.js +34 -0
- package/dist/molecules/table/hooks/useTable.js.map +1 -0
- package/dist/molecules/table/hooks/useUniqValues.d.ts +5 -0
- package/dist/molecules/table/hooks/useUniqValues.js +11 -0
- package/dist/molecules/table/hooks/useUniqValues.js.map +1 -0
- package/dist/molecules/table/interfaces/extends.d.ts +14 -0
- package/dist/molecules/table/interfaces/extends.js +2 -0
- package/dist/molecules/table/interfaces/extends.js.map +1 -0
- package/dist/molecules/table/utils/mapFormToColumns.d.ts +3 -0
- package/dist/molecules/table/utils/mapFormToColumns.js +39 -0
- package/dist/molecules/table/utils/mapFormToColumns.js.map +1 -0
- package/dist/{components/tabs/tabs.component.js → molecules/tabs/Tabs.js} +12 -12
- package/dist/molecules/tabs/Tabs.js.map +1 -0
- package/dist/organisms/form/Form.d.ts +22 -0
- package/dist/organisms/form/Form.js +15 -0
- package/dist/organisms/form/Form.js.map +1 -0
- package/dist/{components/form-access/formAccess.component.d.ts → organisms/form/access/FormAccess.d.ts} +2 -2
- package/dist/{components/form-access/formAccess.component.js → organisms/form/access/FormAccess.js} +4 -5
- package/dist/organisms/form/access/FormAccess.js.map +1 -0
- package/dist/organisms/form/access/FormAccess.schema.d.ts +4 -0
- package/dist/{components/form-access/formAccess.schema.js → organisms/form/access/FormAccess.schema.js} +1 -1
- package/dist/organisms/form/access/FormAccess.schema.js.map +1 -0
- package/dist/organisms/form/access/FormAccess.utils.d.ts +23 -0
- package/dist/{components/form-access/formAccess.utils.js → organisms/form/access/FormAccess.utils.js} +2 -2
- package/dist/organisms/form/access/FormAccess.utils.js.map +1 -0
- package/dist/{components/form-action/formAction.component.d.ts → organisms/form/action/FormAction.d.ts} +4 -4
- package/dist/{components/form-action/formAction.component.js → organisms/form/action/FormAction.js} +2 -2
- package/dist/organisms/form/action/FormAction.js.map +1 -0
- package/dist/organisms/form/builder/FormBuilder.d.ts +7 -0
- package/dist/organisms/form/builder/FormBuilder.js +17 -0
- package/dist/organisms/form/builder/FormBuilder.js.map +1 -0
- package/dist/organisms/form/builder/FormEdit.d.ts +8 -0
- package/dist/organisms/form/builder/FormEdit.js +70 -0
- package/dist/organisms/form/builder/FormEdit.js.map +1 -0
- package/dist/organisms/form/builder/FormEdit.reducer.d.ts +10 -0
- package/dist/{components/form-edit/formEdit.reducer.js → organisms/form/builder/FormEdit.reducer.js} +1 -1
- package/dist/organisms/form/builder/FormEdit.reducer.js.map +1 -0
- package/dist/organisms/form/builder/FormEditCtas.d.ts +15 -0
- package/dist/organisms/form/builder/FormEditCtas.js +52 -0
- package/dist/organisms/form/builder/FormEditCtas.js.map +1 -0
- package/dist/organisms/form/builder/FormParameters.d.ts +24 -0
- package/dist/organisms/form/builder/FormParameters.js +84 -0
- package/dist/organisms/form/builder/FormParameters.js.map +1 -0
- package/dist/organisms/form/builder/all.d.ts +6 -0
- package/dist/organisms/form/builder/all.js +26 -0
- package/dist/organisms/form/builder/all.js.map +1 -0
- package/dist/organisms/form/builder/useFormBuilder.d.ts +28 -0
- package/dist/organisms/form/builder/useFormBuilder.js +71 -0
- package/dist/organisms/form/builder/useFormBuilder.js.map +1 -0
- package/dist/{components/form-edit/useFormEdit.hook.d.ts → organisms/form/builder/useFormEdit.d.ts} +7 -7
- package/dist/{components/form-edit/useFormEdit.hook.js → organisms/form/builder/useFormEdit.js} +2 -2
- package/dist/organisms/form/builder/useFormEdit.js.map +1 -0
- package/dist/{components/form-settings/formSettings.component.d.ts → organisms/form/settings/FormSettings.d.ts} +2 -2
- package/dist/{components/form-settings/formSettings.component.js → organisms/form/settings/FormSettings.js} +4 -4
- package/dist/organisms/form/settings/FormSettings.js.map +1 -0
- package/dist/organisms/form/settings/FormSettings.schema.d.ts +2 -0
- package/dist/{components/form-settings/formSettings.schema.js → organisms/form/settings/FormSettings.schema.js} +1 -1
- package/dist/organisms/form/settings/FormSettings.schema.js.map +1 -0
- package/dist/organisms/form/settings/FormSettings.utils.d.ts +8 -0
- package/dist/{components/form-settings/formSettings.utils.js → organisms/form/settings/FormSettings.utils.js} +1 -1
- package/dist/organisms/form/settings/FormSettings.utils.js.map +1 -0
- package/dist/organisms/form/types.d.ts +15 -0
- package/dist/organisms/form/types.js +2 -0
- package/dist/organisms/form/types.js.map +1 -0
- package/dist/organisms/form/useForm.d.ts +65 -0
- package/dist/organisms/form/useForm.js +776 -0
- package/dist/organisms/form/useForm.js.map +1 -0
- package/dist/{components/modal/removeModal.component.d.ts → organisms/modal/RemoveModal.d.ts} +1 -1
- package/dist/{components/modal/removeModal.component.js → organisms/modal/RemoveModal.js} +10 -10
- package/dist/organisms/modal/RemoveModal.js.map +1 -0
- package/dist/organisms/table/actions/ActionsTable.d.ts +10 -0
- package/dist/organisms/table/actions/ActionsTable.js +46 -0
- package/dist/organisms/table/actions/ActionsTable.js.map +1 -0
- package/dist/organisms/table/forms/FormsTable.d.ts +9 -0
- package/dist/organisms/table/forms/FormsTable.js +57 -0
- package/dist/organisms/table/forms/FormsTable.js.map +1 -0
- package/dist/organisms/table/forms/components/FormsCell.d.ts +5 -0
- package/dist/organisms/table/forms/components/FormsCell.js +50 -0
- package/dist/organisms/table/forms/components/FormsCell.js.map +1 -0
- package/dist/organisms/table/submissions/SubmissionsTable.d.ts +6 -0
- package/dist/organisms/table/submissions/SubmissionsTable.js +11 -0
- package/dist/organisms/table/submissions/SubmissionsTable.js.map +1 -0
- package/dist/registries/components.d.ts +3 -0
- package/dist/registries/components.js +19 -0
- package/dist/registries/components.js.map +1 -0
- package/package.json +10 -8
- package/readme.md +27 -14
- package/src/atoms/icon/Icon.stories.tsx +124 -0
- package/src/atoms/icon/Icon.tsx +16 -0
- package/src/index.ts +1 -6
- package/src/interfaces/ActionType.ts +26 -0
- package/src/interfaces/ComponentType.ts +3 -0
- package/src/interfaces/FormOptions.ts +4 -1
- package/src/interfaces/{FormSchema.ts → FormType.ts} +3 -3
- package/src/interfaces/Operation.ts +2 -2
- package/src/interfaces/{RoleSchema.ts → RoleType.ts} +1 -1
- package/src/interfaces/SubmissionType.ts +20 -0
- package/src/interfaces/index.ts +5 -4
- package/src/molecules/__fixtures__/build.js +28 -0
- package/src/molecules/__fixtures__/form-firstname.fixture.json +256 -0
- package/src/molecules/__fixtures__/form-schema.json +350 -0
- package/src/molecules/__fixtures__/form-submissions.json +11942 -0
- package/src/molecules/__fixtures__/form-wizard.fixture.json +2042 -0
- package/src/molecules/__fixtures__/products.json +81539 -0
- package/src/molecules/__fixtures__/useValue.hook.ts +14 -0
- package/src/{components/alert/alert.component.spec.tsx → molecules/alert/Alert.spec.tsx} +12 -14
- package/src/molecules/alert/Alert.stories.tsx +39 -0
- package/src/{components/alert/alert.component.tsx → molecules/alert/Alert.tsx} +10 -7
- package/src/molecules/button/Button.stories.tsx +106 -0
- package/src/molecules/button/Button.tsx +54 -0
- package/src/{components/card/card.component.spec.tsx → molecules/card/Card.spec.tsx} +3 -2
- package/src/{components/card/card.stories.tsx → molecules/card/Card.stories.tsx} +9 -2
- package/src/{components/form-control/formControl.component.spec.tsx → molecules/forms/form-control/FormControl.spec.tsx} +9 -8
- package/src/molecules/forms/form-control/FormControl.stories.tsx +58 -0
- package/src/molecules/forms/form-control/FormControl.tsx +86 -0
- package/src/molecules/forms/input-tags/InputTags.interface.ts +9 -0
- package/src/molecules/forms/input-tags/InputTags.tsx +30 -0
- package/src/molecules/forms/input-tags/all.ts +6 -0
- package/src/molecules/forms/input-tags/components/ChoicesTags.stories.tsx +110 -0
- package/src/molecules/forms/input-tags/components/ChoicesTags.tsx +72 -0
- package/src/molecules/forms/input-tags/components/ReactTags.stories.tsx +140 -0
- package/src/molecules/forms/input-tags/components/ReactTags.tsx +38 -0
- package/src/molecules/forms/input-text/InputText.interface.ts +5 -0
- package/src/{components/input-text/inputText.component.spec.tsx → molecules/forms/input-text/InputText.spec.tsx} +8 -7
- package/src/molecules/forms/input-text/InputText.stories.tsx +179 -0
- package/src/molecules/forms/input-text/InputText.tsx +63 -0
- package/src/molecules/forms/select/Select.interface.ts +45 -0
- package/src/molecules/forms/select/Select.tsx +28 -0
- package/src/molecules/forms/select/all.ts +7 -0
- package/src/molecules/forms/select/components/ChoicesSelect.stories.tsx +332 -0
- package/src/molecules/forms/select/components/ChoicesSelect.tsx +159 -0
- package/src/molecules/forms/select/components/HtmlSelect.stories.tsx +305 -0
- package/src/molecules/forms/select/components/HtmlSelect.tsx +54 -0
- package/src/molecules/forms/select/components/ReactSelect.stories.tsx +287 -0
- package/src/molecules/forms/select/components/ReactSelect.tsx +60 -0
- package/src/molecules/forms/select/components/choices.template.tsx +38 -0
- package/src/molecules/forms/select/hooks/useOptions.spec.ts +154 -0
- package/src/molecules/forms/select/hooks/useOptions.ts +53 -0
- package/src/{components/loader/loader.component.spec.tsx → molecules/loader/Loader.spec.tsx} +3 -3
- package/src/molecules/loader/Loader.stories.tsx +43 -0
- package/src/{components/loader/loader.component.tsx → molecules/loader/Loader.tsx} +2 -10
- package/src/{components/modal/modal.component.spec.tsx → molecules/modal/Modal.spec.tsx} +131 -4
- package/src/molecules/modal/Modal.stories.tsx +178 -0
- package/src/{components/pagination/pagination.component.spec.tsx → molecules/pagination/Pagination.spec.tsx} +20 -14
- package/src/molecules/pagination/Pagination.stories.tsx +99 -0
- package/src/{components/pagination/pagination.component.tsx → molecules/pagination/Pagination.tsx} +34 -47
- package/src/molecules/pagination/PaginationButton.tsx +30 -0
- package/src/molecules/pagination/all.ts +3 -0
- package/src/molecules/table/Table.stories.tsx +272 -0
- package/src/molecules/table/Table.tsx +100 -0
- package/src/molecules/table/all.ts +16 -0
- package/src/molecules/table/components/DefaultArrowSort.tsx +26 -0
- package/src/molecules/table/components/DefaultCell.tsx +22 -0
- package/src/molecules/table/components/DefaultCellFooter.tsx +16 -0
- package/src/molecules/table/components/DefaultCellHeader.tsx +42 -0
- package/src/molecules/table/components/DefaultCellOperations.tsx +42 -0
- package/src/molecules/table/components/DefaultFilter.tsx +42 -0
- package/src/molecules/table/components/DefaultOperationButton.tsx +40 -0
- package/src/molecules/table/filters/Filters.d.ts +31 -0
- package/src/molecules/table/filters/RangeFilter.tsx +43 -0
- package/src/molecules/table/filters/SelectFilter.tsx +47 -0
- package/src/molecules/table/filters/TextFieldFilter.tsx +36 -0
- package/src/molecules/table/hooks/useTable.tsx +75 -0
- package/src/molecules/table/hooks/useUniqValues.tsx +10 -0
- package/src/molecules/table/interfaces/extends.ts +18 -0
- package/src/molecules/table/utils/mapFormToColumns.tsx +74 -0
- package/src/{components/tabs/tabs.component.spec.tsx → molecules/tabs/Tabs.spec.tsx} +4 -4
- package/src/molecules/tabs/Tabs.stories.tsx +141 -0
- package/src/organisms/__fixtures__/WrapComponent.tsx +11 -0
- package/src/organisms/__fixtures__/form-actions.json +240 -0
- package/src/organisms/__fixtures__/form-firstname.fixture.json +256 -0
- package/src/organisms/__fixtures__/form-wizard.fixture.json +2042 -0
- package/src/organisms/__fixtures__/form.fixture.json +2067 -0
- package/src/organisms/__fixtures__/useEditForm.tsx +84 -0
- package/src/organisms/__fixtures__/utils.ts +74 -0
- package/src/{components/form/form.component.spec.tsx → organisms/form/Form.spec.tsx} +5 -6
- package/src/organisms/form/Form.stories.tsx +698 -0
- package/src/organisms/form/Form.tsx +29 -0
- package/src/{components/form-access/formAccess.schema.ts → organisms/form/access/FormAccess.schema.ts} +4 -6
- package/src/{components/form-access/formAccess.stories.tsx → organisms/form/access/FormAccess.stories.tsx} +8 -2
- package/src/{components/form-access/formAccess.component.tsx → organisms/form/access/FormAccess.tsx} +15 -17
- package/src/{components/form-access/formAccess.utils.spec.ts → organisms/form/access/FormAccess.utils.spec.ts} +13 -7
- package/src/{components/form-access/formAccess.utils.ts → organisms/form/access/FormAccess.utils.ts} +23 -20
- package/src/{components/form-action/formAction.stories.tsx → organisms/form/action/FormAction.stories.tsx} +11 -11
- package/src/{components/form-action/formAction.component.tsx → organisms/form/action/FormAction.tsx} +7 -7
- package/src/organisms/form/builder/FormBuilder.stories.tsx +97 -0
- package/src/organisms/form/builder/FormBuilder.tsx +28 -0
- package/src/{components/form-edit/formEdit.reducer.ts → organisms/form/builder/FormEdit.reducer.ts} +6 -6
- package/src/{components/form-edit/formEdit.stories.tsx → organisms/form/builder/FormEdit.stories.tsx} +89 -43
- package/src/organisms/form/builder/FormEdit.tsx +75 -0
- package/src/organisms/form/builder/FormEditCtas.tsx +97 -0
- package/src/{components/form-edit/formParameters.component.tsx → organisms/form/builder/FormParameters.tsx} +28 -28
- package/src/organisms/form/builder/all.ts +17 -0
- package/src/organisms/form/builder/useFormBuilder.ts +143 -0
- package/src/{components/form-edit/useFormEdit.hook.ts → organisms/form/builder/useFormEdit.ts} +8 -8
- package/src/{components/form-settings/formSettings.component.spec.tsx → organisms/form/settings/FormSettings.component.spec.tsx} +2 -2
- package/src/{components/form-settings/formSettings.schema.ts → organisms/form/settings/FormSettings.schema.ts} +2 -2
- package/src/{components/form-settings/formSettings.stories.tsx → organisms/form/settings/FormSettings.stories.tsx} +10 -8
- package/src/{components/form-settings/formSettings.component.tsx → organisms/form/settings/FormSettings.tsx} +7 -8
- package/src/{components/form-settings/formSettings.utils.spec.ts → organisms/form/settings/FormSettings.utils.spec.ts} +1 -1
- package/src/{components/form-settings/formSettings.utils.ts → organisms/form/settings/FormSettings.utils.ts} +4 -4
- package/src/organisms/form/types.ts +8 -0
- package/src/organisms/form/useForm.ts +223 -0
- package/src/organisms/modal/RemoveModal.stories.tsx +59 -0
- package/src/{components/modal/removeModal.component.tsx → organisms/modal/RemoveModal.tsx} +2 -2
- package/src/{components/actions-table/actionsTable.component.spec.tsx → organisms/table/actions/ActionsTable.spec.tsx} +11 -7
- package/src/{components/actions-table/actionsTable.stories.tsx → organisms/table/actions/ActionsTable.stories.tsx} +22 -24
- package/src/{components/actions-table/actionsTable.component.tsx → organisms/table/actions/ActionsTable.tsx} +13 -20
- package/src/{components/forms-table/formsTable.stories.tsx → organisms/table/forms/FormsTable.stories.tsx} +24 -27
- package/src/organisms/table/forms/FormsTable.tsx +66 -0
- package/src/organisms/table/forms/components/FormsCell.tsx +53 -0
- package/src/{components/submissions-table/submissionsTable.stories.tsx → organisms/table/submissions/SubmissionsTable.stories.tsx} +24 -27
- package/src/organisms/table/submissions/SubmissionsTable.tsx +13 -0
- package/src/registries/components.ts +23 -0
- package/tsconfig.app.json +1 -1
- package/tsconfig.json +3 -0
- package/tsconfig.node.json +13 -0
- package/dist/components/actions-table/actionsTable.component.d.ts +0 -10
- package/dist/components/actions-table/actionsTable.component.js +0 -53
- package/dist/components/actions-table/actionsTable.component.js.map +0 -1
- package/dist/components/alert/alert.component.d.ts +0 -5
- package/dist/components/alert/alert.component.js.map +0 -1
- package/dist/components/card/card.component.js +0 -12
- package/dist/components/card/card.component.js.map +0 -1
- package/dist/components/form/form.component.d.ts +0 -62
- package/dist/components/form/form.component.js +0 -64
- package/dist/components/form/form.component.js.map +0 -1
- package/dist/components/form/useForm.hook.d.ts +0 -59
- package/dist/components/form/useForm.hook.js +0 -64
- package/dist/components/form/useForm.hook.js.map +0 -1
- package/dist/components/form-access/formAccess.component.js.map +0 -1
- package/dist/components/form-access/formAccess.schema.d.ts +0 -5
- package/dist/components/form-access/formAccess.schema.js.map +0 -1
- package/dist/components/form-access/formAccess.utils.d.ts +0 -24
- package/dist/components/form-access/formAccess.utils.js.map +0 -1
- package/dist/components/form-action/formAction.component.js.map +0 -1
- package/dist/components/form-builder/formBuilder.component.d.ts +0 -53
- package/dist/components/form-builder/formBuilder.component.js +0 -142
- package/dist/components/form-builder/formBuilder.component.js.map +0 -1
- package/dist/components/form-control/formControl.component.d.ts +0 -14
- package/dist/components/form-control/formControl.component.js +0 -26
- package/dist/components/form-control/formControl.component.js.map +0 -1
- package/dist/components/form-edit/formCtas.component.d.ts +0 -28
- package/dist/components/form-edit/formCtas.component.js +0 -70
- package/dist/components/form-edit/formCtas.component.js.map +0 -1
- package/dist/components/form-edit/formEdit.component.d.ts +0 -18
- package/dist/components/form-edit/formEdit.component.js +0 -57
- package/dist/components/form-edit/formEdit.component.js.map +0 -1
- package/dist/components/form-edit/formEdit.reducer.d.ts +0 -10
- package/dist/components/form-edit/formEdit.reducer.js.map +0 -1
- package/dist/components/form-edit/formParameters.component.d.ts +0 -34
- package/dist/components/form-edit/formParameters.component.js +0 -92
- package/dist/components/form-edit/formParameters.component.js.map +0 -1
- package/dist/components/form-edit/useFormEdit.hook.js.map +0 -1
- package/dist/components/form-settings/formSettings.component.js.map +0 -1
- package/dist/components/form-settings/formSettings.schema.d.ts +0 -2
- package/dist/components/form-settings/formSettings.schema.js.map +0 -1
- package/dist/components/form-settings/formSettings.utils.d.ts +0 -8
- package/dist/components/form-settings/formSettings.utils.js.map +0 -1
- package/dist/components/forms-table/components/formCell.component.d.ts +0 -6
- package/dist/components/forms-table/components/formCell.component.js +0 -50
- package/dist/components/forms-table/components/formCell.component.js.map +0 -1
- package/dist/components/forms-table/formsTable.component.d.ts +0 -10
- package/dist/components/forms-table/formsTable.component.js +0 -29
- package/dist/components/forms-table/formsTable.component.js.map +0 -1
- package/dist/components/index.d.ts +0 -25
- package/dist/components/index.js +0 -86
- package/dist/components/index.js.map +0 -1
- package/dist/components/input-tags/inputTags.component.d.ts +0 -18
- package/dist/components/input-tags/inputTags.component.js +0 -37
- package/dist/components/input-tags/inputTags.component.js.map +0 -1
- package/dist/components/input-text/inputText.component.d.ts +0 -27
- package/dist/components/input-text/inputText.component.js +0 -70
- package/dist/components/input-text/inputText.component.js.map +0 -1
- package/dist/components/loader/loader.component.js +0 -26
- package/dist/components/loader/loader.component.js.map +0 -1
- package/dist/components/modal/modal.component.js.map +0 -1
- package/dist/components/modal/removeModal.component.js.map +0 -1
- package/dist/components/pagination/pagination.component.js +0 -87
- package/dist/components/pagination/pagination.component.js.map +0 -1
- package/dist/components/select/select.component.d.ts +0 -14
- package/dist/components/select/select.component.js +0 -60
- package/dist/components/select/select.component.js.map +0 -1
- package/dist/components/submissions-table/submissionsTable.component.d.ts +0 -6
- package/dist/components/submissions-table/submissionsTable.component.js +0 -11
- package/dist/components/submissions-table/submissionsTable.component.js.map +0 -1
- package/dist/components/table/components/defaultArrowSort.component.d.ts +0 -1
- package/dist/components/table/components/defaultArrowSort.component.js +0 -10
- package/dist/components/table/components/defaultArrowSort.component.js.map +0 -1
- package/dist/components/table/components/defaultCell.component.d.ts +0 -1
- package/dist/components/table/components/defaultCell.component.js +0 -11
- package/dist/components/table/components/defaultCell.component.js.map +0 -1
- package/dist/components/table/components/defaultCellHeader.component.d.ts +0 -5
- package/dist/components/table/components/defaultCellHeader.component.js +0 -14
- package/dist/components/table/components/defaultCellHeader.component.js.map +0 -1
- package/dist/components/table/components/defaultCellOperations.component.d.ts +0 -12
- package/dist/components/table/components/defaultCellOperations.component.js +0 -21
- package/dist/components/table/components/defaultCellOperations.component.js.map +0 -1
- package/dist/components/table/components/defaultCells.component.d.ts +0 -4
- package/dist/components/table/components/defaultCells.component.js +0 -23
- package/dist/components/table/components/defaultCells.component.js.map +0 -1
- package/dist/components/table/components/defaultOperationButton.component.d.ts +0 -15
- package/dist/components/table/components/defaultOperationButton.component.js +0 -45
- package/dist/components/table/components/defaultOperationButton.component.js.map +0 -1
- package/dist/components/table/components/defaultRow.component.d.ts +0 -12
- package/dist/components/table/components/defaultRow.component.js +0 -25
- package/dist/components/table/components/defaultRow.component.js.map +0 -1
- package/dist/components/table/components/dragNDropContainer.d.ts +0 -4
- package/dist/components/table/components/dragNDropContainer.js +0 -10
- package/dist/components/table/components/dragNDropContainer.js.map +0 -1
- package/dist/components/table/filters/defaultColumnFilter.component.d.ts +0 -5
- package/dist/components/table/filters/defaultColumnFilter.component.js +0 -32
- package/dist/components/table/filters/defaultColumnFilter.component.js.map +0 -1
- package/dist/components/table/filters/selectColumnFilter.component.d.ts +0 -10
- package/dist/components/table/filters/selectColumnFilter.component.js +0 -34
- package/dist/components/table/filters/selectColumnFilter.component.js.map +0 -1
- package/dist/components/table/filters/sliderColumnFilter.component.d.ts +0 -2
- package/dist/components/table/filters/sliderColumnFilter.component.js +0 -27
- package/dist/components/table/filters/sliderColumnFilter.component.js.map +0 -1
- package/dist/components/table/hooks/useCustomTable.hook.d.ts +0 -128
- package/dist/components/table/hooks/useCustomTable.hook.js +0 -130
- package/dist/components/table/hooks/useCustomTable.hook.js.map +0 -1
- package/dist/components/table/hooks/useDragnDropRow.hook.d.ts +0 -272
- package/dist/components/table/hooks/useDragnDropRow.hook.js +0 -40
- package/dist/components/table/hooks/useDragnDropRow.hook.js.map +0 -1
- package/dist/components/table/hooks/useOperations.hook.d.ts +0 -11
- package/dist/components/table/hooks/useOperations.hook.js +0 -25
- package/dist/components/table/hooks/useOperations.hook.js.map +0 -1
- package/dist/components/table/index.d.ts +0 -15
- package/dist/components/table/index.js +0 -35
- package/dist/components/table/index.js.map +0 -1
- package/dist/components/table/table.component.d.ts +0 -3
- package/dist/components/table/table.component.js +0 -81
- package/dist/components/table/table.component.js.map +0 -1
- package/dist/components/table/utils/getPageNumbers.js.map +0 -1
- package/dist/components/table/utils/mapFormToColumns.d.ts +0 -3
- package/dist/components/table/utils/mapFormToColumns.js +0 -23
- package/dist/components/table/utils/mapFormToColumns.js.map +0 -1
- package/dist/components/table/utils/swapElements.d.ts +0 -1
- package/dist/components/table/utils/swapElements.js +0 -5
- package/dist/components/table/utils/swapElements.js.map +0 -1
- package/dist/components/tabs/tabs.component.js.map +0 -1
- package/dist/interfaces/ActionSchema.d.ts +0 -23
- package/dist/interfaces/ActionSchema.js +0 -2
- package/dist/interfaces/ActionSchema.js.map +0 -1
- package/dist/interfaces/FormSchema.js +0 -2
- package/dist/interfaces/FormSchema.js.map +0 -1
- package/dist/interfaces/RoleSchema.js +0 -2
- package/dist/interfaces/RoleSchema.js.map +0 -1
- package/dist/interfaces/Submission.d.ts +0 -5
- package/dist/interfaces/Submission.js +0 -2
- package/dist/interfaces/Submission.js.map +0 -1
- package/dist/utils/callLast.d.ts +0 -1
- package/dist/utils/callLast.js +0 -10
- package/dist/utils/callLast.js.map +0 -1
- package/src/components/alert/alert.stories.tsx +0 -16
- package/src/components/form/form.component.tsx +0 -72
- package/src/components/form/form.stories.tsx +0 -253
- package/src/components/form/useForm.hook.ts +0 -216
- package/src/components/form-builder/formBuilder.component.tsx +0 -195
- package/src/components/form-builder/formBuilder.stories.tsx +0 -3665
- package/src/components/form-control/formControl.component.tsx +0 -58
- package/src/components/form-control/formControl.stories.tsx +0 -63
- package/src/components/form-edit/formCtas.component.tsx +0 -106
- package/src/components/form-edit/formEdit.component.tsx +0 -59
- package/src/components/forms-table/components/formCell.component.tsx +0 -47
- package/src/components/forms-table/formsTable.component.tsx +0 -40
- package/src/components/index.ts +0 -25
- package/src/components/input-tags/inputTags.component.tsx +0 -58
- package/src/components/input-tags/inputTags.stories.tsx +0 -97
- package/src/components/input-text/inputText.component.tsx +0 -85
- package/src/components/input-text/inputText.stories.tsx +0 -126
- package/src/components/loader/loader.stories.tsx +0 -16
- package/src/components/modal/modal.stories.tsx +0 -190
- package/src/components/pagination/pagination.stories.tsx +0 -40
- package/src/components/select/select.component.spec.tsx +0 -84
- package/src/components/select/select.component.tsx +0 -88
- package/src/components/select/select.stories.tsx +0 -173
- package/src/components/submissions-table/submissionsTable.component.tsx +0 -14
- package/src/components/table/components/defaultArrowSort.component.tsx +0 -10
- package/src/components/table/components/defaultCell.component.tsx +0 -13
- package/src/components/table/components/defaultCellHeader.component.tsx +0 -18
- package/src/components/table/components/defaultCellOperations.component.tsx +0 -37
- package/src/components/table/components/defaultCells.component.tsx +0 -30
- package/src/components/table/components/defaultOperationButton.component.tsx +0 -56
- package/src/components/table/components/defaultRow.component.tsx +0 -51
- package/src/components/table/components/dragNDropContainer.tsx +0 -7
- package/src/components/table/filters/defaultColumnFilter.component.spec.tsx +0 -31
- package/src/components/table/filters/defaultColumnFilter.component.tsx +0 -39
- package/src/components/table/filters/selectColumnFilter.component.spec.tsx +0 -66
- package/src/components/table/filters/selectColumnFilter.component.tsx +0 -51
- package/src/components/table/filters/sliderColumnFilter.component.tsx +0 -28
- package/src/components/table/hooks/useCustomTable.hook.tsx +0 -268
- package/src/components/table/hooks/useDragnDropRow.hook.ts +0 -80
- package/src/components/table/hooks/useOperations.hook.tsx +0 -39
- package/src/components/table/index.ts +0 -15
- package/src/components/table/table.component.tsx +0 -100
- package/src/components/table/table.stories.tsx +0 -120
- package/src/components/table/utils/mapFormToColumns.tsx +0 -33
- package/src/components/table/utils/swapElements.spec.ts +0 -7
- package/src/components/table/utils/swapElements.ts +0 -7
- package/src/components/tabs/tabs.component.stories.tsx +0 -127
- package/src/interfaces/ActionSchema.ts +0 -26
- package/src/interfaces/Submission.ts +0 -5
- package/src/utils/callLast.ts +0 -12
- /package/dist/{components/card/card.component.d.ts → molecules/card/Card.d.ts} +0 -0
- /package/dist/{components/modal/modal.component.d.ts → molecules/modal/Modal.d.ts} +0 -0
- /package/dist/{components/table → molecules/pagination}/utils/getPageNumbers.d.ts +0 -0
- /package/dist/{components/table → molecules/pagination}/utils/getPageNumbers.js +0 -0
- /package/dist/{components/tabs/tabs.component.d.ts → molecules/tabs/Tabs.d.ts} +0 -0
- /package/src/{components → molecules}/__fixtures__/form-actions.json +0 -0
- /package/src/{components → molecules}/__fixtures__/form.fixture.json +0 -0
- /package/src/{components/card/card.component.tsx → molecules/card/Card.tsx} +0 -0
- /package/src/{components/modal/modal.component.tsx → molecules/modal/Modal.tsx} +0 -0
- /package/src/{components/table → molecules/pagination}/utils/getPageNumbers.ts +0 -0
- /package/src/{components/tabs/tabs.component.tsx → molecules/tabs/Tabs.tsx} +0 -0
- /package/src/{components → organisms}/__fixtures__/form-schema.json +0 -0
- /package/src/{components → organisms}/__fixtures__/form-submissions.json +0 -0
- /package/src/{components/actions-table → organisms/table/actions}/__fixtures__/data.json +0 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import "./components/FormsCell.js";
|
|
2
|
+
|
|
3
|
+
import { ColumnDef } from "@tanstack/react-table";
|
|
4
|
+
|
|
5
|
+
import type { FormType } from "../../../interfaces";
|
|
6
|
+
import { Table, TableProps } from "../../../molecules/table/Table";
|
|
7
|
+
import { getComponent } from "../../../registries/components.js";
|
|
8
|
+
import { FormsCell } from "./components/FormsCell.js";
|
|
9
|
+
|
|
10
|
+
export type FormsTableProps = Omit<TableProps<FormType>, "columns"> & {
|
|
11
|
+
tags?: { label: string; value: string }[];
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export function FormsTable({ ...props }: FormsTableProps) {
|
|
15
|
+
const { i18n = (f: string) => f, tags } = props;
|
|
16
|
+
const Cell = getComponent<typeof FormsCell>("FormsCell");
|
|
17
|
+
|
|
18
|
+
const columns: ColumnDef<any>[] = [
|
|
19
|
+
{
|
|
20
|
+
header: i18n("Title"),
|
|
21
|
+
accessorKey: "title",
|
|
22
|
+
cell: (context) => <Cell {...context} i18n={i18n} />,
|
|
23
|
+
meta: {
|
|
24
|
+
cellProps: {
|
|
25
|
+
colSpan: 2
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
header: i18n("Tags"),
|
|
31
|
+
accessorKey: "tags",
|
|
32
|
+
meta: {
|
|
33
|
+
cellProps: {
|
|
34
|
+
hidden: true
|
|
35
|
+
},
|
|
36
|
+
filter: {
|
|
37
|
+
variant: "select",
|
|
38
|
+
layout: "react",
|
|
39
|
+
options: tags
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
// {
|
|
44
|
+
// Header: i18n("Title"),
|
|
45
|
+
// accessor: "title",
|
|
46
|
+
// id: "title",
|
|
47
|
+
// Cell: (props: any) => <FormCell {...props} icon={props.icon} i18n={i18n} />,
|
|
48
|
+
// Filter: DefaultColumnFilter,
|
|
49
|
+
// colspan: 2
|
|
50
|
+
// },
|
|
51
|
+
// {
|
|
52
|
+
// Header: i18n("Tags"),
|
|
53
|
+
// accessor: "tags",
|
|
54
|
+
// id: "tags",
|
|
55
|
+
// hidden: true,
|
|
56
|
+
// Filter: (props: any) =>
|
|
57
|
+
// tags && tags.length ? (
|
|
58
|
+
// <SelectColumnFilter {...props} column={{ ...props.columns, choices: tags }} />
|
|
59
|
+
// ) : (
|
|
60
|
+
// <DefaultColumnFilter {...props} />
|
|
61
|
+
// )
|
|
62
|
+
// }
|
|
63
|
+
];
|
|
64
|
+
|
|
65
|
+
return <Table {...(props as any)} columns={columns} />;
|
|
66
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { CellContext } from "@tanstack/react-table";
|
|
2
|
+
import cx from "classnames";
|
|
3
|
+
import moment from "moment";
|
|
4
|
+
|
|
5
|
+
import type { FormType } from "../../../../interfaces/index.js";
|
|
6
|
+
import { registerComponent } from "../../../../registries/components.js";
|
|
7
|
+
import { iconClass } from "../../../../utils/iconClass";
|
|
8
|
+
import { stopPropagationWrapper } from "../../../../utils/stopPropagationWrapper";
|
|
9
|
+
|
|
10
|
+
export function FormsCell(
|
|
11
|
+
props: CellContext<FormType, any> & {
|
|
12
|
+
i18n: (i18n: string) => string;
|
|
13
|
+
}
|
|
14
|
+
) {
|
|
15
|
+
const {
|
|
16
|
+
row: { original: form }
|
|
17
|
+
} = props;
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<div className={"p-1"}>
|
|
21
|
+
<h4 className={"text-primary text-lg flex space-x-2 items-center"}>
|
|
22
|
+
<i className={cx(iconClass(undefined, "server"), "text-secondary")} />
|
|
23
|
+
<span>{form.title}</span>
|
|
24
|
+
</h4>
|
|
25
|
+
|
|
26
|
+
<ul className='reset-list text-gray-500'>
|
|
27
|
+
<li className={"text-sm"}>Name: {form.name || form.machineName}</li>
|
|
28
|
+
<li className='mt-5 flex space-x-1'>
|
|
29
|
+
<span className='badge bg-light flex space-x-1'>
|
|
30
|
+
<i className={iconClass(undefined, "history")} />
|
|
31
|
+
<span>Updated {moment(form.modified).fromNow()}</span>
|
|
32
|
+
</span>
|
|
33
|
+
|
|
34
|
+
{(form.tags || []).map((tag, index) => (
|
|
35
|
+
<button
|
|
36
|
+
key={index}
|
|
37
|
+
className='badge badge-hover bg-secondary flex space-x-1'
|
|
38
|
+
onClick={stopPropagationWrapper(() => {
|
|
39
|
+
// props.setFilter("tags", tag);
|
|
40
|
+
// props.gotoPage(0);
|
|
41
|
+
})}
|
|
42
|
+
>
|
|
43
|
+
<i className={iconClass(undefined, "tags")} />
|
|
44
|
+
<span>{tag}</span>
|
|
45
|
+
</button>
|
|
46
|
+
))}
|
|
47
|
+
</li>
|
|
48
|
+
</ul>
|
|
49
|
+
</div>
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
registerComponent("FormsCell", FormsCell);
|
|
@@ -1,48 +1,45 @@
|
|
|
1
|
+
import "../../../molecules/button/Button";
|
|
2
|
+
import "../../../molecules/forms/input-text/InputText";
|
|
3
|
+
import "../../../molecules/forms/select/all";
|
|
4
|
+
import "../../../molecules/pagination/all";
|
|
5
|
+
import "../../../molecules/table/all";
|
|
6
|
+
|
|
1
7
|
import { useState } from "react";
|
|
2
8
|
|
|
3
|
-
import { mapPagination } from "
|
|
4
|
-
import
|
|
5
|
-
import formSubmissions from "
|
|
6
|
-
import { SubmissionsTable } from "./
|
|
9
|
+
import { mapPagination } from "../../../utils/mapPagination";
|
|
10
|
+
import FormType from "../../__fixtures__/form-schema.json";
|
|
11
|
+
import formSubmissions from "../../__fixtures__/form-submissions.json";
|
|
12
|
+
import { SubmissionsTable } from "./SubmissionsTable";
|
|
7
13
|
|
|
14
|
+
/**
|
|
15
|
+
* ```tsx
|
|
16
|
+
* import {SubmissionsTable} from "@tsed/react-formio/organisms/table/submissions/SubmissionsTable";
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
8
19
|
export default {
|
|
9
|
-
title: "
|
|
20
|
+
title: "table/submissions/SubmissionsTable",
|
|
10
21
|
component: SubmissionsTable,
|
|
11
22
|
argTypes: {
|
|
12
23
|
form: {
|
|
13
|
-
control:
|
|
14
|
-
type: "object"
|
|
15
|
-
}
|
|
24
|
+
control: "object"
|
|
16
25
|
},
|
|
17
26
|
data: {
|
|
18
|
-
control:
|
|
19
|
-
type: "object"
|
|
20
|
-
}
|
|
27
|
+
control: "object"
|
|
21
28
|
},
|
|
22
29
|
operations: {
|
|
23
|
-
control:
|
|
24
|
-
type: "object"
|
|
25
|
-
}
|
|
30
|
+
control: "object"
|
|
26
31
|
},
|
|
27
32
|
isLoading: {
|
|
28
|
-
control:
|
|
29
|
-
type: "boolean"
|
|
30
|
-
}
|
|
33
|
+
control: "boolean"
|
|
31
34
|
},
|
|
32
35
|
isEmpty: {
|
|
33
|
-
control:
|
|
34
|
-
type: "boolean"
|
|
35
|
-
}
|
|
36
|
+
control: "boolean"
|
|
36
37
|
},
|
|
37
38
|
disableFilters: {
|
|
38
|
-
control:
|
|
39
|
-
type: "boolean"
|
|
40
|
-
}
|
|
39
|
+
control: "boolean"
|
|
41
40
|
},
|
|
42
41
|
disablePagination: {
|
|
43
|
-
control:
|
|
44
|
-
type: "boolean"
|
|
45
|
-
}
|
|
42
|
+
control: "boolean"
|
|
46
43
|
}
|
|
47
44
|
},
|
|
48
45
|
parameters: {}
|
|
@@ -73,7 +70,7 @@ export const Sandbox = (args: any) => {
|
|
|
73
70
|
};
|
|
74
71
|
|
|
75
72
|
Sandbox.args = {
|
|
76
|
-
form:
|
|
73
|
+
form: FormType,
|
|
77
74
|
data: formSubmissions,
|
|
78
75
|
operations: [
|
|
79
76
|
{
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { FormType, SubmissionType } from "../../../interfaces";
|
|
2
|
+
import { Table, type TableProps } from "../../../molecules/table/Table";
|
|
3
|
+
import { mapFormToColumns } from "../../../molecules/table/utils/mapFormToColumns.js";
|
|
4
|
+
|
|
5
|
+
export type SubmissionsTableProps = Omit<TableProps<SubmissionType>, "columns"> & {
|
|
6
|
+
form?: FormType;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export function SubmissionsTable({ form, ...props }: SubmissionsTableProps) {
|
|
10
|
+
const columns: any[] | undefined = form && mapFormToColumns(form);
|
|
11
|
+
|
|
12
|
+
return <Table {...props} columns={columns!} />;
|
|
13
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export const components = new Map<string, unknown>();
|
|
2
|
+
|
|
3
|
+
export function registerComponent(type: string, component: unknown) {
|
|
4
|
+
components.set(type, component);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export function getComponent<Cmp>(type: string | string[]): Cmp {
|
|
8
|
+
if (Array.isArray(type)) {
|
|
9
|
+
for (const t of type) {
|
|
10
|
+
if (components.has(t)) {
|
|
11
|
+
return components.get(t) as unknown as Cmp;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const result = components.get(type as string) as unknown as Cmp;
|
|
17
|
+
|
|
18
|
+
if (!result) {
|
|
19
|
+
console.warn(`Missing component for ${type}`);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return result;
|
|
23
|
+
}
|
package/tsconfig.app.json
CHANGED
package/tsconfig.json
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "@tsed/typescript/tsconfig.web.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"module": "NodeNext",
|
|
5
|
+
"moduleResolution": "NodeNext",
|
|
6
|
+
"baseUrl": ".",
|
|
7
|
+
"noEmit": true,
|
|
8
|
+
"declaration": false,
|
|
9
|
+
"composite": false
|
|
10
|
+
},
|
|
11
|
+
"include": ["vite.config.mts"],
|
|
12
|
+
"exclude": ["node_modules", "dist", "src/**/*.spec.ts", "src/**/*.spec.tsx"]
|
|
13
|
+
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { ActionSchema } from '../../interfaces';
|
|
2
|
-
import { TableProps } from '../table/hooks/useCustomTable.hook';
|
|
3
|
-
export type ActionsTableProps = Omit<TableProps<ActionSchema>, "columns"> & {
|
|
4
|
-
onAddAction?: (actionName: string) => void;
|
|
5
|
-
availableActions?: {
|
|
6
|
-
label: string;
|
|
7
|
-
value: string;
|
|
8
|
-
}[];
|
|
9
|
-
};
|
|
10
|
-
export declare function ActionsTable({ disableFilters, disablePagination, availableActions, onAddAction, ...props }: ActionsTableProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { jsx as e, jsxs as i } from "react/jsx-runtime";
|
|
2
|
-
import { c as p } from "../../chunks/index.js";
|
|
3
|
-
import b from "lodash/noop";
|
|
4
|
-
import { useState as f } from "react";
|
|
5
|
-
import { iconClass as h } from "../../utils/iconClass.js";
|
|
6
|
-
import { Select as v } from "../select/select.component.js";
|
|
7
|
-
import { Table as A } from "../table/table.component.js";
|
|
8
|
-
function k({
|
|
9
|
-
disableFilters: n = !0,
|
|
10
|
-
disablePagination: s = !0,
|
|
11
|
-
availableActions: l = [],
|
|
12
|
-
onAddAction: r = b,
|
|
13
|
-
...o
|
|
14
|
-
}) {
|
|
15
|
-
const { i18n: a = (c) => c } = o, [t, m] = f(""), d = [
|
|
16
|
-
{
|
|
17
|
-
Header: a("Actions"),
|
|
18
|
-
accessor: "title",
|
|
19
|
-
id: "title"
|
|
20
|
-
}
|
|
21
|
-
];
|
|
22
|
-
return /* @__PURE__ */ e(A, { ...o, disableFilters: n, disablePagination: s, columns: d, children: /* @__PURE__ */ i("div", { className: "pagination-group", children: [
|
|
23
|
-
/* @__PURE__ */ e(
|
|
24
|
-
v,
|
|
25
|
-
{
|
|
26
|
-
"data-testid": "action-table-select",
|
|
27
|
-
name: "actions",
|
|
28
|
-
value: t,
|
|
29
|
-
choices: [{ label: a("Select an action"), value: "" }].concat(l),
|
|
30
|
-
onChange: (c, u) => m(u)
|
|
31
|
-
}
|
|
32
|
-
),
|
|
33
|
-
/* @__PURE__ */ e("div", { className: "pl-3", children: /* @__PURE__ */ i(
|
|
34
|
-
"button",
|
|
35
|
-
{
|
|
36
|
-
"data-testid": "action-table-add",
|
|
37
|
-
disabled: t === "",
|
|
38
|
-
className: "btn btn-success",
|
|
39
|
-
onClick: () => t && r(t),
|
|
40
|
-
type: "submit",
|
|
41
|
-
children: [
|
|
42
|
-
/* @__PURE__ */ e("i", { className: p(h(void 0, "plus"), "mr-1") }),
|
|
43
|
-
" ",
|
|
44
|
-
a("Add action")
|
|
45
|
-
]
|
|
46
|
-
}
|
|
47
|
-
) })
|
|
48
|
-
] }) });
|
|
49
|
-
}
|
|
50
|
-
export {
|
|
51
|
-
k as ActionsTable
|
|
52
|
-
};
|
|
53
|
-
//# sourceMappingURL=actionsTable.component.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"actionsTable.component.js","sources":["../../../src/components/actions-table/actionsTable.component.tsx"],"sourcesContent":["import classnames from \"classnames\";\nimport noop from \"lodash/noop\";\nimport { useState } from \"react\";\n\nimport { ActionSchema } from \"../../interfaces\";\nimport { iconClass } from \"../../utils/iconClass\";\nimport { Select } from \"../select/select.component\";\nimport { TableProps } from \"../table/hooks/useCustomTable.hook\";\nimport { Table } from \"../table/table.component\";\n\nexport type ActionsTableProps = Omit<TableProps<ActionSchema>, \"columns\"> & {\n onAddAction?: (actionName: string) => void;\n availableActions?: { label: string; value: string }[];\n};\n\nexport function ActionsTable({\n disableFilters = true,\n disablePagination = true,\n availableActions = [],\n onAddAction = noop,\n ...props\n}: ActionsTableProps) {\n const { i18n = (f: string) => f } = props;\n const [currentAction, setAction] = useState(\"\");\n\n const columns = [\n {\n Header: i18n(\"Actions\"),\n accessor: \"title\",\n id: \"title\"\n }\n ];\n\n return (\n <Table {...props} disableFilters={disableFilters} disablePagination={disablePagination} columns={columns}>\n <div className={\"pagination-group\"}>\n <Select\n data-testid={\"action-table-select\"}\n name={\"actions\"}\n value={currentAction}\n choices={[{ label: i18n(\"Select an action\"), value: \"\" }].concat(availableActions)}\n onChange={(name: string, action: string) => setAction(action)}\n />\n <div className={\"pl-3\"}>\n <button\n data-testid={\"action-table-add\"}\n disabled={currentAction === \"\"}\n className={\"btn btn-success\"}\n onClick={() => currentAction && onAddAction(currentAction)}\n type={\"submit\"}\n >\n <i className={classnames(iconClass(undefined, \"plus\"), \"mr-1\")} /> {i18n(\"Add action\")}\n </button>\n </div>\n </div>\n </Table>\n );\n}\n"],"names":["ActionsTable","disableFilters","disablePagination","availableActions","onAddAction","noop","props","i18n","f","currentAction","setAction","useState","columns","jsx","Table","jsxs","Select","name","action","classnames","iconClass"],"mappings":";;;;;;;AAeO,SAASA,EAAa;AAAA,EAC3B,gBAAAC,IAAiB;AAAA,EACjB,mBAAAC,IAAoB;AAAA,EACpB,kBAAAC,IAAmB,CAAC;AAAA,EACpB,aAAAC,IAAcC;AAAA,EACd,GAAGC;AACL,GAAsB;AACpB,QAAM,EAAE,MAAAC,IAAO,CAACC,MAAcA,EAAM,IAAAF,GAC9B,CAACG,GAAeC,CAAS,IAAIC,EAAS,EAAE,GAExCC,IAAU;AAAA,IACd;AAAA,MACE,QAAQL,EAAK,SAAS;AAAA,MACtB,UAAU;AAAA,MACV,IAAI;AAAA,IAAA;AAAA,EAER;AAGE,SAAA,gBAAAM,EAACC,GAAO,EAAA,GAAGR,GAAO,gBAAAL,GAAgC,mBAAAC,GAAsC,SAAAU,GACtF,UAAA,gBAAAG,EAAC,OAAI,EAAA,WAAW,oBACd,UAAA;AAAA,IAAA,gBAAAF;AAAA,MAACG;AAAA,MAAA;AAAA,QACC,eAAa;AAAA,QACb,MAAM;AAAA,QACN,OAAOP;AAAA,QACP,SAAS,CAAC,EAAE,OAAOF,EAAK,kBAAkB,GAAG,OAAO,GAAI,CAAA,EAAE,OAAOJ,CAAgB;AAAA,QACjF,UAAU,CAACc,GAAcC,MAAmBR,EAAUQ,CAAM;AAAA,MAAA;AAAA,IAC9D;AAAA,IACA,gBAAAL,EAAC,OAAI,EAAA,WAAW,QACd,UAAA,gBAAAE;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,eAAa;AAAA,QACb,UAAUN,MAAkB;AAAA,QAC5B,WAAW;AAAA,QACX,SAAS,MAAMA,KAAiBL,EAAYK,CAAa;AAAA,QACzD,MAAM;AAAA,QAEN,UAAA;AAAA,UAAC,gBAAAI,EAAA,KAAA,EAAE,WAAWM,EAAWC,EAAU,QAAW,MAAM,GAAG,MAAM,GAAG;AAAA,UAAE;AAAA,UAAEb,EAAK,YAAY;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA,EAEzF,CAAA;AAAA,EAAA,EAAA,CACF,EACF,CAAA;AAEJ;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"alert.component.js","sources":["../../../src/components/alert/alert.component.tsx"],"sourcesContent":["function formatError(error: any): any {\n if (typeof error === \"string\") {\n return error;\n }\n\n if (Array.isArray(error)) {\n return error.map(formatError);\n }\n\n if (Object.prototype.hasOwnProperty.call(error, \"errors\")) {\n return Object.keys(error.errors).map((key, index) => {\n const item = error.errors[key];\n return (\n <div key={index}>\n <strong>\n {item.name} ({item.path})\n </strong>{\" \"}\n - {item.message}\n </div>\n );\n });\n }\n\n // If this is a standard error.\n if (Object.prototype.hasOwnProperty.call(error, \"message\")) {\n return error.message;\n }\n\n // If this is a joy validation error.\n if (Object.prototype.hasOwnProperty.call(error, \"name\") && error.name === \"ValidationError\") {\n return error.details.map((item: any, index: number) => {\n return <div key={index}>{item.message}</div>;\n });\n }\n\n // If a conflict error occurs on a form, the form is returned.\n if (Object.prototype.hasOwnProperty.call(error, \"_id\") && Object.prototype.hasOwnProperty.call(error, \"display\")) {\n return \"Another user has saved this form already. Please reload and re-apply your changes.\";\n }\n\n return \"An error occurred. See console logs for details.\";\n}\n\nexport interface AlertProps {\n error?: any | any[];\n type?: string;\n}\n\nexport function Alert({ error, type = \"danger\" }: AlertProps) {\n if (!error || (Array.isArray(error) && !error.length)) {\n return null;\n }\n\n return (\n <div className={`alert alert-${type}`} role='alert'>\n {formatError(error)}\n </div>\n );\n}\n"],"names":["formatError","error","key","index","item","jsxs","jsx","Alert","type"],"mappings":";AAAA,SAASA,EAAYC,GAAiB;AAChC,SAAA,OAAOA,KAAU,WACZA,IAGL,MAAM,QAAQA,CAAK,IACdA,EAAM,IAAID,CAAW,IAG1B,OAAO,UAAU,eAAe,KAAKC,GAAO,QAAQ,IAC/C,OAAO,KAAKA,EAAM,MAAM,EAAE,IAAI,CAACC,GAAKC,MAAU;AAC7C,UAAAC,IAAOH,EAAM,OAAOC,CAAG;AAC7B,6BACG,OACC,EAAA,UAAA;AAAA,MAAA,gBAAAG,EAAC,UACE,EAAA,UAAA;AAAA,QAAKD,EAAA;AAAA,QAAK;AAAA,QAAGA,EAAK;AAAA,QAAK;AAAA,MAAA,GAC1B;AAAA,MAAU;AAAA,MAAI;AAAA,MACXA,EAAK;AAAA,IAAA,EAAA,GAJAD,CAKV;AAAA,EAAA,CAEH,IAIC,OAAO,UAAU,eAAe,KAAKF,GAAO,SAAS,IAChDA,EAAM,UAIX,OAAO,UAAU,eAAe,KAAKA,GAAO,MAAM,KAAKA,EAAM,SAAS,oBACjEA,EAAM,QAAQ,IAAI,CAACG,GAAWD,MAC3B,gBAAAG,EAAA,OAAA,EAAiB,UAAKF,EAAA,QAAA,GAAbD,CAAqB,CACvC,IAIC,OAAO,UAAU,eAAe,KAAKF,GAAO,KAAK,KAAK,OAAO,UAAU,eAAe,KAAKA,GAAO,SAAS,IACtG,uFAGF;AACT;AAOO,SAASM,EAAM,EAAE,OAAAN,GAAO,MAAAO,IAAO,YAAwB;AACxD,SAAA,CAACP,KAAU,MAAM,QAAQA,CAAK,KAAK,CAACA,EAAM,SACrC,OAIP,gBAAAK,EAAC,OAAI,EAAA,WAAW,eAAeE,CAAI,IAAI,MAAK,SACzC,UAAYR,EAAAC,CAAK,EACpB,CAAA;AAEJ;"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { jsxs as s, jsx as a } from "react/jsx-runtime";
|
|
2
|
-
import { c as d } from "../../chunks/index.js";
|
|
3
|
-
function m({ children: r, label: c, className: e }) {
|
|
4
|
-
return /* @__PURE__ */ s("div", { className: d("card", e), children: [
|
|
5
|
-
/* @__PURE__ */ a("div", { className: "card-header ", children: /* @__PURE__ */ a("h4", { className: "card-title", children: c }) }),
|
|
6
|
-
/* @__PURE__ */ a("div", { className: "card-body", role: "article", children: r })
|
|
7
|
-
] });
|
|
8
|
-
}
|
|
9
|
-
export {
|
|
10
|
-
m as Card
|
|
11
|
-
};
|
|
12
|
-
//# sourceMappingURL=card.component.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"card.component.js","sources":["../../../src/components/card/card.component.tsx"],"sourcesContent":["import classnames from \"classnames\";\nimport { PropsWithChildren } from \"react\";\n\nexport interface CardProps {\n label: string;\n className?: string;\n}\n\nexport function Card({ children, label, className }: PropsWithChildren<CardProps>) {\n return (\n <div className={classnames(\"card\", className)}>\n <div className={\"card-header \"}>\n <h4 className={\"card-title\"}>{label}</h4>\n </div>\n <div className={\"card-body\"} role={\"article\"}>\n {children}\n </div>\n </div>\n );\n}\n"],"names":["Card","children","label","className","classnames","jsx"],"mappings":";;AAQO,SAASA,EAAK,EAAE,UAAAC,GAAU,OAAAC,GAAO,WAAAC,KAA2C;AACjF,2BACG,OAAI,EAAA,WAAWC,EAAW,QAAQD,CAAS,GAC1C,UAAA;AAAA,IAAC,gBAAAE,EAAA,OAAA,EAAI,WAAW,gBACd,UAAA,gBAAAA,EAAC,QAAG,WAAW,cAAe,aAAM,EACtC,CAAA;AAAA,sBACC,OAAI,EAAA,WAAW,aAAa,MAAM,WAChC,UAAAJ,EACH,CAAA;AAAA,EAAA,GACF;AAEJ;"}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { default as PropTypes } from 'prop-types';
|
|
2
|
-
import { UseFormHookProps } from './useForm.hook';
|
|
3
|
-
export interface FormProps<Data = any> extends UseFormHookProps<Data> {
|
|
4
|
-
name?: string;
|
|
5
|
-
/**
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
className?: string;
|
|
9
|
-
}
|
|
10
|
-
export declare function Form<Data = any>(props: Partial<FormProps<Data>>): import("react/jsx-runtime").JSX.Element;
|
|
11
|
-
export declare namespace Form {
|
|
12
|
-
var propTypes: {
|
|
13
|
-
name: PropTypes.Requireable<string>;
|
|
14
|
-
className: PropTypes.Requireable<string>;
|
|
15
|
-
/**
|
|
16
|
-
*
|
|
17
|
-
*/
|
|
18
|
-
src: PropTypes.Requireable<string>;
|
|
19
|
-
/**
|
|
20
|
-
* url to fetch form
|
|
21
|
-
*/
|
|
22
|
-
url: PropTypes.Requireable<string>;
|
|
23
|
-
/**
|
|
24
|
-
* Raw form object
|
|
25
|
-
*/
|
|
26
|
-
form: PropTypes.Requireable<object>;
|
|
27
|
-
/**
|
|
28
|
-
* Data submission
|
|
29
|
-
*/
|
|
30
|
-
submission: PropTypes.Requireable<object>;
|
|
31
|
-
/**
|
|
32
|
-
* Configuration option
|
|
33
|
-
*/
|
|
34
|
-
options: PropTypes.Requireable<PropTypes.InferProps<{
|
|
35
|
-
readOnly: PropTypes.Requireable<boolean>;
|
|
36
|
-
noAlerts: PropTypes.Requireable<boolean>;
|
|
37
|
-
i18n: PropTypes.Requireable<any>;
|
|
38
|
-
template: PropTypes.Requireable<string>;
|
|
39
|
-
saveDraft: PropTypes.Requireable<boolean>;
|
|
40
|
-
hooks: PropTypes.Requireable<any>;
|
|
41
|
-
}>>;
|
|
42
|
-
onPrevPage: PropTypes.Requireable<(...args: any[]) => any>;
|
|
43
|
-
onNextPage: PropTypes.Requireable<(...args: any[]) => any>;
|
|
44
|
-
onCancel: PropTypes.Requireable<(...args: any[]) => any>;
|
|
45
|
-
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
46
|
-
onCustomEvent: PropTypes.Requireable<(...args: any[]) => any>;
|
|
47
|
-
onComponentChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
48
|
-
onSubmit: PropTypes.Requireable<(...args: any[]) => any>;
|
|
49
|
-
onAsyncSubmit: PropTypes.Requireable<(...args: any[]) => any>;
|
|
50
|
-
onSubmitDone: PropTypes.Requireable<(...args: any[]) => any>;
|
|
51
|
-
onFormLoad: PropTypes.Requireable<(...args: any[]) => any>;
|
|
52
|
-
onError: PropTypes.Requireable<(...args: any[]) => any>;
|
|
53
|
-
onRender: PropTypes.Requireable<(...args: any[]) => any>;
|
|
54
|
-
onAttach: PropTypes.Requireable<(...args: any[]) => any>;
|
|
55
|
-
onBuild: PropTypes.Requireable<(...args: any[]) => any>;
|
|
56
|
-
onFocus: PropTypes.Requireable<(...args: any[]) => any>;
|
|
57
|
-
onBlur: PropTypes.Requireable<(...args: any[]) => any>;
|
|
58
|
-
onInitialized: PropTypes.Requireable<(...args: any[]) => any>;
|
|
59
|
-
onFormReady: PropTypes.Requireable<(...args: any[]) => any>;
|
|
60
|
-
formioform: PropTypes.Requireable<any>;
|
|
61
|
-
};
|
|
62
|
-
}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
-
import { Components as r } from "formiojs";
|
|
3
|
-
import m from "formiojs/components";
|
|
4
|
-
import n from "prop-types";
|
|
5
|
-
import { useForm as s } from "./useForm.hook.js";
|
|
6
|
-
r.setComponents(m);
|
|
7
|
-
function c(o) {
|
|
8
|
-
const { element: e } = s(o);
|
|
9
|
-
return /* @__PURE__ */ t("div", { "data-testid": `formioContainer${o.name || ""}`, ref: e, className: o.className });
|
|
10
|
-
}
|
|
11
|
-
c.propTypes = {
|
|
12
|
-
name: n.string,
|
|
13
|
-
className: n.string,
|
|
14
|
-
/**
|
|
15
|
-
*
|
|
16
|
-
*/
|
|
17
|
-
src: n.string,
|
|
18
|
-
/**
|
|
19
|
-
* url to fetch form
|
|
20
|
-
*/
|
|
21
|
-
url: n.string,
|
|
22
|
-
/**
|
|
23
|
-
* Raw form object
|
|
24
|
-
*/
|
|
25
|
-
form: n.object,
|
|
26
|
-
/**
|
|
27
|
-
* Data submission
|
|
28
|
-
*/
|
|
29
|
-
submission: n.object,
|
|
30
|
-
/**
|
|
31
|
-
* Configuration option
|
|
32
|
-
*/
|
|
33
|
-
options: n.shape({
|
|
34
|
-
readOnly: n.bool,
|
|
35
|
-
noAlerts: n.bool,
|
|
36
|
-
i18n: n.any,
|
|
37
|
-
template: n.string,
|
|
38
|
-
saveDraft: n.bool,
|
|
39
|
-
hooks: n.any
|
|
40
|
-
}),
|
|
41
|
-
onPrevPage: n.func,
|
|
42
|
-
onNextPage: n.func,
|
|
43
|
-
onCancel: n.func,
|
|
44
|
-
onChange: n.func,
|
|
45
|
-
onCustomEvent: n.func,
|
|
46
|
-
onComponentChange: n.func,
|
|
47
|
-
onSubmit: n.func,
|
|
48
|
-
onAsyncSubmit: n.func,
|
|
49
|
-
onSubmitDone: n.func,
|
|
50
|
-
onFormLoad: n.func,
|
|
51
|
-
onError: n.func,
|
|
52
|
-
onRender: n.func,
|
|
53
|
-
onAttach: n.func,
|
|
54
|
-
onBuild: n.func,
|
|
55
|
-
onFocus: n.func,
|
|
56
|
-
onBlur: n.func,
|
|
57
|
-
onInitialized: n.func,
|
|
58
|
-
onFormReady: n.func,
|
|
59
|
-
formioform: n.any
|
|
60
|
-
};
|
|
61
|
-
export {
|
|
62
|
-
c as Form
|
|
63
|
-
};
|
|
64
|
-
//# sourceMappingURL=form.component.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"form.component.js","sources":["../../../src/components/form/form.component.tsx"],"sourcesContent":["import { Components } from \"formiojs\";\nimport AllComponents from \"formiojs/components\";\nimport PropTypes from \"prop-types\";\n\nimport { useForm, UseFormHookProps } from \"./useForm.hook\";\n\nComponents.setComponents(AllComponents);\n\nexport interface FormProps<Data = any> extends UseFormHookProps<Data> {\n name?: string;\n /**\n *\n */\n className?: string;\n}\n\nexport function Form<Data = any>(props: Partial<FormProps<Data>>) {\n const { element } = useForm(props);\n\n return <div data-testid={`formioContainer${props.name || \"\"}`} ref={element} className={props.className} />;\n}\n\nForm.propTypes = {\n name: PropTypes.string,\n className: PropTypes.string,\n /**\n *\n */\n src: PropTypes.string,\n /**\n * url to fetch form\n */\n url: PropTypes.string,\n /**\n * Raw form object\n */\n form: PropTypes.object,\n /**\n * Data submission\n */\n submission: PropTypes.object,\n /**\n * Configuration option\n */\n options: PropTypes.shape({\n readOnly: PropTypes.bool,\n noAlerts: PropTypes.bool,\n i18n: PropTypes.any,\n template: PropTypes.string,\n saveDraft: PropTypes.bool,\n hooks: PropTypes.any\n }),\n onPrevPage: PropTypes.func,\n onNextPage: PropTypes.func,\n onCancel: PropTypes.func,\n onChange: PropTypes.func,\n onCustomEvent: PropTypes.func,\n onComponentChange: PropTypes.func,\n onSubmit: PropTypes.func,\n onAsyncSubmit: PropTypes.func,\n onSubmitDone: PropTypes.func,\n onFormLoad: PropTypes.func,\n onError: PropTypes.func,\n onRender: PropTypes.func,\n onAttach: PropTypes.func,\n onBuild: PropTypes.func,\n onFocus: PropTypes.func,\n onBlur: PropTypes.func,\n onInitialized: PropTypes.func,\n onFormReady: PropTypes.func,\n formioform: PropTypes.any\n};\n"],"names":["Components","AllComponents","Form","props","element","useForm","jsx","PropTypes"],"mappings":";;;;;AAMAA,EAAW,cAAcC,CAAa;AAU/B,SAASC,EAAiBC,GAAiC;AAChE,QAAM,EAAE,SAAAC,EAAA,IAAYC,EAAQF,CAAK;AAEjC,SAAQ,gBAAAG,EAAA,OAAA,EAAI,eAAa,kBAAkBH,EAAM,QAAQ,EAAE,IAAI,KAAKC,GAAS,WAAWD,EAAM,WAAW;AAC3G;AAEAD,EAAK,YAAY;AAAA,EACf,MAAMK,EAAU;AAAA,EAChB,WAAWA,EAAU;AAAA;AAAA;AAAA;AAAA,EAIrB,KAAKA,EAAU;AAAA;AAAA;AAAA;AAAA,EAIf,KAAKA,EAAU;AAAA;AAAA;AAAA;AAAA,EAIf,MAAMA,EAAU;AAAA;AAAA;AAAA;AAAA,EAIhB,YAAYA,EAAU;AAAA;AAAA;AAAA;AAAA,EAItB,SAASA,EAAU,MAAM;AAAA,IACvB,UAAUA,EAAU;AAAA,IACpB,UAAUA,EAAU;AAAA,IACpB,MAAMA,EAAU;AAAA,IAChB,UAAUA,EAAU;AAAA,IACpB,WAAWA,EAAU;AAAA,IACrB,OAAOA,EAAU;AAAA,EAAA,CAClB;AAAA,EACD,YAAYA,EAAU;AAAA,EACtB,YAAYA,EAAU;AAAA,EACtB,UAAUA,EAAU;AAAA,EACpB,UAAUA,EAAU;AAAA,EACpB,eAAeA,EAAU;AAAA,EACzB,mBAAmBA,EAAU;AAAA,EAC7B,UAAUA,EAAU;AAAA,EACpB,eAAeA,EAAU;AAAA,EACzB,cAAcA,EAAU;AAAA,EACxB,YAAYA,EAAU;AAAA,EACtB,SAASA,EAAU;AAAA,EACnB,UAAUA,EAAU;AAAA,EACpB,UAAUA,EAAU;AAAA,EACpB,SAASA,EAAU;AAAA,EACnB,SAASA,EAAU;AAAA,EACnB,QAAQA,EAAU;AAAA,EAClB,eAAeA,EAAU;AAAA,EACzB,aAAaA,EAAU;AAAA,EACvB,YAAYA,EAAU;AACxB;"}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { ExtendedComponentSchema } from 'formiojs';
|
|
2
|
-
import { FormOptions, FormSchema, Submission } from '../../interfaces';
|
|
3
|
-
export interface ChangedSubmission<T = any> extends Submission<T> {
|
|
4
|
-
changed: {
|
|
5
|
-
component: ExtendedComponentSchema;
|
|
6
|
-
instance: any;
|
|
7
|
-
value: any;
|
|
8
|
-
} & Record<string, any>;
|
|
9
|
-
isValid: boolean;
|
|
10
|
-
}
|
|
11
|
-
export interface FormPageChangeProps<Data = any> {
|
|
12
|
-
page: number;
|
|
13
|
-
submission: Submission<Data>;
|
|
14
|
-
}
|
|
15
|
-
export interface UseFormHookProps<Data = any> extends Record<string, any> {
|
|
16
|
-
src?: string;
|
|
17
|
-
/**
|
|
18
|
-
* url to fetch form
|
|
19
|
-
*/
|
|
20
|
-
url?: string;
|
|
21
|
-
/**
|
|
22
|
-
* Raw form object
|
|
23
|
-
*/
|
|
24
|
-
form?: Partial<FormSchema>;
|
|
25
|
-
/**
|
|
26
|
-
* Configuration option
|
|
27
|
-
*/
|
|
28
|
-
options?: FormOptions;
|
|
29
|
-
/**
|
|
30
|
-
* Data submission
|
|
31
|
-
*/
|
|
32
|
-
submission?: Submission<Data>;
|
|
33
|
-
onPrevPage?: (obj: FormPageChangeProps<Data>) => void;
|
|
34
|
-
onNextPage?: (obj: FormPageChangeProps<Data>) => void;
|
|
35
|
-
onCancel?: Function;
|
|
36
|
-
onChange?: (submission: ChangedSubmission) => void;
|
|
37
|
-
onCustomEvent?: (obj: {
|
|
38
|
-
type: string;
|
|
39
|
-
event: string;
|
|
40
|
-
component: ExtendedComponentSchema;
|
|
41
|
-
data: any;
|
|
42
|
-
}) => void;
|
|
43
|
-
onComponentChange?: (component: ExtendedComponentSchema) => void;
|
|
44
|
-
onSubmit?: (submission: Submission<Data>) => void;
|
|
45
|
-
onAsyncSubmit?: (submission: Submission<Data>) => Promise<any>;
|
|
46
|
-
onSubmitDone?: (submission: Submission<Data>) => void;
|
|
47
|
-
onFormLoad?: Function;
|
|
48
|
-
onError?: (errors: any) => void;
|
|
49
|
-
onRender?: () => void;
|
|
50
|
-
onAttach?: Function;
|
|
51
|
-
onBuild?: Function;
|
|
52
|
-
onFocus?: Function;
|
|
53
|
-
onBlur?: Function;
|
|
54
|
-
onInitialized?: Function;
|
|
55
|
-
onFormReady?: (formio: any) => void;
|
|
56
|
-
}
|
|
57
|
-
export declare function useForm<Data = any>(props: UseFormHookProps<Data>): {
|
|
58
|
-
element: import('react').MutableRefObject<any>;
|
|
59
|
-
};
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { Form as F } from "formiojs";
|
|
2
|
-
import f from "lodash/cloneDeep";
|
|
3
|
-
import R from "lodash/isEqual";
|
|
4
|
-
import { useRef as y, useEffect as d } from "react";
|
|
5
|
-
function e(n, r, c) {
|
|
6
|
-
d(() => {
|
|
7
|
-
r && c.set(n, r);
|
|
8
|
-
}, [r, n, c]);
|
|
9
|
-
}
|
|
10
|
-
function w(n) {
|
|
11
|
-
const r = y(/* @__PURE__ */ new Map()), c = (t) => n.hasOwnProperty(t) && typeof n[t] == "function", h = (t, ...s) => {
|
|
12
|
-
if (c(t))
|
|
13
|
-
return (r.current.has(t) ? r.current.get(t) : n[t])(...s);
|
|
14
|
-
};
|
|
15
|
-
return e("onBlur", n.onBlur, r.current), e("onPrevPage", n.onPrevPage, r.current), e("onNextPage", n.onNextPage, r.current), e("onCancel", n.onCancel, r.current), e("onChange", n.onChange, r.current), e("onCustomEvent", n.onCustomEvent, r.current), e("onComponentChange", n.onComponentChange, r.current), e("onSubmit", n.onSubmit, r.current), e("onAsyncSubmit", n.onAsyncSubmit, r.current), e("onSubmitDone", n.onSubmitDone, r.current), e("onFormLoad", n.onFormLoad, r.current), e("onError", n.onError, r.current), e("onRender", n.onRender, r.current), e("onAttach", n.onAttach, r.current), e("onBuild", n.onBuild, r.current), e("onFocus", n.onFocus, r.current), e("onBlur", n.onBlur, r.current), e("onInitialized", n.onInitialized, r.current), { events: r, emit: h, hasEvent: c };
|
|
16
|
-
}
|
|
17
|
-
function V(n) {
|
|
18
|
-
const { src: r, form: c, options: h = {}, submission: t, url: s, ...g } = n, C = y(), l = y(), o = y(), { emit: E, hasEvent: P } = w(g);
|
|
19
|
-
async function B(u, i) {
|
|
20
|
-
if (P("onAsyncSubmit"))
|
|
21
|
-
try {
|
|
22
|
-
await E("onAsyncSubmit", u, o.current);
|
|
23
|
-
} catch (a) {
|
|
24
|
-
i((a == null ? void 0 : a.errors) || a);
|
|
25
|
-
}
|
|
26
|
-
else
|
|
27
|
-
i(null);
|
|
28
|
-
}
|
|
29
|
-
const b = (u, i) => {
|
|
30
|
-
var a;
|
|
31
|
-
return i = Object.assign({}, i), u = typeof u == "string" ? u : f(u), o.current || (l.current = !1, i.hooks = {
|
|
32
|
-
...i.hooks || {},
|
|
33
|
-
customValidation: ((a = i == null ? void 0 : i.hooks) == null ? void 0 : a.customValidation) || B
|
|
34
|
-
}, o.current = new F(C.current, u, i), o.current.onAny((m, ...A) => {
|
|
35
|
-
if (o.current && m.startsWith("formio.")) {
|
|
36
|
-
const S = `on${m.charAt(7).toUpperCase()}${m.slice(8)}`;
|
|
37
|
-
if (S === "onChange" && !A[0].changed)
|
|
38
|
-
return;
|
|
39
|
-
E(S, ...A, o.current);
|
|
40
|
-
}
|
|
41
|
-
}), o.current.ready.then((m) => {
|
|
42
|
-
t && (m.submission = f(t)), n.onFormReady && n.onFormReady(m), l.current = !0;
|
|
43
|
-
})), o.current;
|
|
44
|
-
};
|
|
45
|
-
return d(() => {
|
|
46
|
-
o.current && o.current.ready.then((u) => {
|
|
47
|
-
R(u.submission.data, t == null ? void 0 : t.data) || t && (u.submission = f(t));
|
|
48
|
-
});
|
|
49
|
-
}, [t]), d(() => {
|
|
50
|
-
c && o.current && o.current.ready.then((u) => {
|
|
51
|
-
u.form = c, s && (u.url = s);
|
|
52
|
-
});
|
|
53
|
-
}, [c, s]), d(() => {
|
|
54
|
-
r && (o.current && (l.current = !1, o.current.destroy(!0)), b(r, h));
|
|
55
|
-
}, [r]), d(() => (c && b(c, h), () => {
|
|
56
|
-
l.current = !1, o.current && o.current.destroy(!0);
|
|
57
|
-
}), []), {
|
|
58
|
-
element: C
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
export {
|
|
62
|
-
V as useForm
|
|
63
|
-
};
|
|
64
|
-
//# sourceMappingURL=useForm.hook.js.map
|