@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,36 @@
|
|
|
1
|
+
import s from "lodash/cloneDeep";
|
|
2
|
+
import { useReducer as y, useEffect as g } from "react";
|
|
3
|
+
import { reducer as C, createInitialState as S, hasChanged as b } from "./FormEdit.reducer.js";
|
|
4
|
+
function R(e) {
|
|
5
|
+
const [{ current: t, future: m, past: i }, o] = y(C, S(e)), u = () => {
|
|
6
|
+
e.onSubmit && typeof e.onSubmit == "function" && e.onSubmit(t);
|
|
7
|
+
}, a = () => {
|
|
8
|
+
e.onSubmit && typeof e.onCopy == "function" && e.onCopy(t);
|
|
9
|
+
};
|
|
10
|
+
g(() => {
|
|
11
|
+
e.form && (t._id !== e.form._id || t.modified !== e.form.modified) && o({ type: "replaceForm", value: e.form });
|
|
12
|
+
}, [e.form]);
|
|
13
|
+
const f = (n) => {
|
|
14
|
+
b(t, { ...t, ...n }) && o({ type: "formChange", value: n });
|
|
15
|
+
}, c = () => o({ type: "redo" }), r = () => o({ type: "undo" }), d = () => o({ type: "reset" }), h = (n, l) => {
|
|
16
|
+
f({ ...t, [n]: l });
|
|
17
|
+
};
|
|
18
|
+
return {
|
|
19
|
+
form: s(t),
|
|
20
|
+
redo: c,
|
|
21
|
+
undo: r,
|
|
22
|
+
reset: d,
|
|
23
|
+
hasChanged: !!i.length,
|
|
24
|
+
isValid: t.title && t.name && t.path,
|
|
25
|
+
hasUndo: !!i.length,
|
|
26
|
+
hasRedo: !!m.length,
|
|
27
|
+
onSubmit: u,
|
|
28
|
+
onCopy: a,
|
|
29
|
+
formChange: f,
|
|
30
|
+
setChange: h
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
export {
|
|
34
|
+
R as useFormEdit
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=useFormEdit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFormEdit.js","sources":["../../../../src/organisms/form/builder/useFormEdit.ts"],"sourcesContent":["import cloneDeep from \"lodash/cloneDeep\";\nimport { useEffect, useReducer } from \"react\";\n\nimport type { FormType } from \"../../../interfaces\";\nimport { createInitialState, hasChanged, reducer } from \"./FormEdit.reducer\";\n\nexport interface UseFormEditHookProps extends Record<string, unknown> {\n form?: Partial<FormType>;\n typeChoices?: { label: string; value: any }[];\n displayChoices?: { label: string; value: any }[];\n enableTags?: boolean;\n onSubmit?: (form: Partial<FormType>) => void;\n onCopy?: (form: Partial<FormType>) => void;\n}\n\nexport function useFormEdit(props: UseFormEditHookProps) {\n const [{ current, future, past }, dispatchFormAction] = useReducer(reducer, createInitialState(props));\n\n const onSubmit = () => {\n if (props.onSubmit && typeof props.onSubmit === \"function\") {\n props.onSubmit(current);\n }\n };\n const onCopy = () => {\n if (props.onSubmit && typeof props.onCopy === \"function\") {\n props.onCopy(current);\n }\n };\n\n useEffect(() => {\n if (props.form && (current._id !== props.form._id || current.modified !== props.form.modified)) {\n dispatchFormAction({ type: \"replaceForm\", value: props.form });\n }\n }, [props.form]);\n\n const formChange = (newForm: Partial<FormType>) => {\n if (hasChanged(current, { ...current, ...newForm })) {\n dispatchFormAction({ type: \"formChange\", value: newForm });\n }\n };\n\n const redo = () => dispatchFormAction({ type: \"redo\" });\n const undo = () => dispatchFormAction({ type: \"undo\" });\n const reset = () => dispatchFormAction({ type: \"reset\" });\n\n const setChange = (path: string | undefined, value: any) => {\n formChange({ ...current, [path!]: value });\n };\n\n return {\n form: cloneDeep(current),\n redo,\n undo,\n reset,\n hasChanged: !!past.length,\n isValid: current.title && current.name && current.path,\n hasUndo: !!past.length,\n hasRedo: !!future.length,\n onSubmit,\n onCopy,\n formChange,\n setChange\n };\n}\n"],"names":["useFormEdit","props","current","future","past","dispatchFormAction","useReducer","reducer","createInitialState","onSubmit","onCopy","useEffect","formChange","newForm","hasChanged","redo","undo","reset","setChange","path","value","cloneDeep"],"mappings":";;;AAeO,SAASA,EAAYC,GAA6B;AACvD,QAAM,CAAC,EAAE,SAAAC,GAAS,QAAAC,GAAQ,MAAAC,EAAK,GAAGC,CAAkB,IAAIC,EAAWC,GAASC,EAAmBP,CAAK,CAAC,GAE/FQ,IAAW,MAAM;AACrB,IAAIR,EAAM,YAAY,OAAOA,EAAM,YAAa,cAC9CA,EAAM,SAASC,CAAO;AAAA,EAE1B,GACMQ,IAAS,MAAM;AACnB,IAAIT,EAAM,YAAY,OAAOA,EAAM,UAAW,cAC5CA,EAAM,OAAOC,CAAO;AAAA,EAExB;AAEA,EAAAS,EAAU,MAAM;AACV,IAAAV,EAAM,SAASC,EAAQ,QAAQD,EAAM,KAAK,OAAOC,EAAQ,aAAaD,EAAM,KAAK,aACnFI,EAAmB,EAAE,MAAM,eAAe,OAAOJ,EAAM,MAAM;AAAA,EAC/D,GACC,CAACA,EAAM,IAAI,CAAC;AAET,QAAAW,IAAa,CAACC,MAA+B;AAC7C,IAAAC,EAAWZ,GAAS,EAAE,GAAGA,GAAS,GAAGW,EAAA,CAAS,KAChDR,EAAmB,EAAE,MAAM,cAAc,OAAOQ,GAAS;AAAA,EAE7D,GAEME,IAAO,MAAMV,EAAmB,EAAE,MAAM,QAAQ,GAChDW,IAAO,MAAMX,EAAmB,EAAE,MAAM,QAAQ,GAChDY,IAAQ,MAAMZ,EAAmB,EAAE,MAAM,SAAS,GAElDa,IAAY,CAACC,GAA0BC,MAAe;AAC1D,IAAAR,EAAW,EAAE,GAAGV,GAAS,CAACiB,CAAK,GAAGC,GAAO;AAAA,EAC3C;AAEO,SAAA;AAAA,IACL,MAAMC,EAAUnB,CAAO;AAAA,IACvB,MAAAa;AAAA,IACA,MAAAC;AAAA,IACA,OAAAC;AAAA,IACA,YAAY,CAAC,CAACb,EAAK;AAAA,IACnB,SAASF,EAAQ,SAASA,EAAQ,QAAQA,EAAQ;AAAA,IAClD,SAAS,CAAC,CAACE,EAAK;AAAA,IAChB,SAAS,CAAC,CAACD,EAAO;AAAA,IAClB,UAAAM;AAAA,IACA,QAAAC;AAAA,IACA,YAAAE;AAAA,IACA,WAAAM;AAAA,EACF;AACF;"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export declare function FormSettings(props: FormSettingsProps): React.JSX.Element;
|
|
1
|
+
import { FormOptions, FormType } from '../../../interfaces';
|
|
2
|
+
export interface FormSettingsProps {
|
|
3
|
+
form: Partial<FormType>;
|
|
4
|
+
onSubmit?: Function;
|
|
5
|
+
options?: FormOptions;
|
|
6
|
+
}
|
|
7
|
+
export declare function FormSettings(props: FormSettingsProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsxs as i, jsx as d } from "react/jsx-runtime";
|
|
2
|
+
import g from "lodash/isEqual";
|
|
3
|
+
import l from "lodash/noop";
|
|
4
|
+
import { useState as b, useEffect as h } from "react";
|
|
5
|
+
import { Form as F } from "../Form.js";
|
|
6
|
+
import { getFormSettingsSchema as y } from "./FormSettings.schema.js";
|
|
7
|
+
import { formSettingsToSubmission as S, submissionToFormSettings as x } from "./FormSettings.utils.js";
|
|
8
|
+
function C({ form: s, onSubmit: a = l, options: e }) {
|
|
9
|
+
const o = y(), [c, m] = b(!0), [t, r] = b(() => S(s)), n = ({ data: u, isValid: p }) => {
|
|
10
|
+
p && r({ data: u }), m(p);
|
|
11
|
+
};
|
|
12
|
+
return h(() => {
|
|
13
|
+
const u = S(s);
|
|
14
|
+
s != null && s._id && !g(t.data, u.data) && r(u);
|
|
15
|
+
}, [s == null ? void 0 : s._id]), {
|
|
16
|
+
options: e,
|
|
17
|
+
form: o,
|
|
18
|
+
type: s.type,
|
|
19
|
+
submission: t,
|
|
20
|
+
onChange: n,
|
|
21
|
+
isValid: c,
|
|
22
|
+
setIsValid: m,
|
|
23
|
+
onSubmit: () => {
|
|
24
|
+
a(x(s, t));
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
function q(s) {
|
|
29
|
+
const { form: a, submission: e, options: o = {}, onChange: c, onSubmit: m, isValid: t } = C(s), r = o.i18n || ((n) => n);
|
|
30
|
+
return /* @__PURE__ */ i("div", { children: [
|
|
31
|
+
/* @__PURE__ */ d(F, { form: a, submission: e, onChange: c, options: o }),
|
|
32
|
+
/* @__PURE__ */ d("button", { "data-testid": "submit", disabled: !t, className: "mt-5 btn btn-primary", onClick: m, type: "submit", children: r("Save settings") })
|
|
33
|
+
] });
|
|
34
|
+
}
|
|
35
|
+
export {
|
|
36
|
+
q as FormSettings
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=FormSettings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormSettings.js","sources":["../../../../src/organisms/form/settings/FormSettings.tsx"],"sourcesContent":["import isEqual from \"lodash/isEqual\";\nimport noop from \"lodash/noop\";\nimport { useEffect, useState } from \"react\";\n\nimport type { ChangedSubmission, FormOptions, FormType } from \"../../../interfaces\";\nimport { Form } from \"../../form/Form\";\nimport { getFormSettingsSchema } from \"./FormSettings.schema\";\nimport { formSettingsToSubmission, FormSettingsType, submissionToFormSettings } from \"./FormSettings.utils\";\n\nexport interface FormSettingsProps {\n form: Partial<FormType>;\n onSubmit?: Function;\n options?: FormOptions;\n}\n\nfunction useFormSettings({ form: formDefinition, onSubmit = noop, options }: FormSettingsProps) {\n const form = getFormSettingsSchema();\n const [isValid, setIsValid] = useState(true);\n const [submission, setSubmission] = useState(() => formSettingsToSubmission(formDefinition));\n\n const onChange = ({ data, isValid }: ChangedSubmission<FormSettingsType>) => {\n if (isValid) {\n setSubmission({ data });\n }\n setIsValid(isValid);\n };\n\n useEffect(() => {\n const input = formSettingsToSubmission(formDefinition);\n if (formDefinition?._id && !isEqual(submission.data, input.data)) {\n setSubmission(input);\n }\n }, [formDefinition?._id]);\n\n return {\n options,\n form,\n type: formDefinition.type,\n submission,\n onChange,\n isValid,\n setIsValid,\n onSubmit: () => {\n onSubmit(submissionToFormSettings(formDefinition, submission));\n }\n };\n}\n\nexport function FormSettings(props: FormSettingsProps) {\n const { form, submission, options = {}, onChange, onSubmit, isValid } = useFormSettings(props);\n\n const i18n = options.i18n || ((f: string) => f);\n\n return (\n <div>\n <Form<FormSettingsType> form={form} submission={submission} onChange={onChange} options={options} />\n\n <button data-testid='submit' disabled={!isValid} className={\"mt-5 btn btn-primary\"} onClick={onSubmit} type={\"submit\"}>\n {i18n(\"Save settings\")}\n </button>\n </div>\n );\n}\n"],"names":["useFormSettings","formDefinition","onSubmit","noop","options","form","getFormSettingsSchema","isValid","setIsValid","useState","submission","setSubmission","formSettingsToSubmission","onChange","data","useEffect","input","isEqual","submissionToFormSettings","FormSettings","props","i18n","f","jsx","Form"],"mappings":";;;;;;;AAeA,SAASA,EAAgB,EAAE,MAAMC,GAAgB,UAAAC,IAAWC,GAAM,SAAAC,KAA8B;AAC9F,QAAMC,IAAOC,EAAsB,GAC7B,CAACC,GAASC,CAAU,IAAIC,EAAS,EAAI,GACrC,CAACC,GAAYC,CAAa,IAAIF,EAAS,MAAMG,EAAyBX,CAAc,CAAC,GAErFY,IAAW,CAAC,EAAE,MAAAC,GAAM,SAAAP,QAAmD;AAC3E,IAAIA,KACYI,EAAA,EAAE,MAAAG,GAAM,GAExBN,EAAWD,CAAO;AAAA,EACpB;AAEA,SAAAQ,EAAU,MAAM;AACR,UAAAC,IAAQJ,EAAyBX,CAAc;AACjD,IAAAA,KAAA,QAAAA,EAAgB,OAAO,CAACgB,EAAQP,EAAW,MAAMM,EAAM,IAAI,KAC7DL,EAAcK,CAAK;AAAA,EACrB,GACC,CAACf,KAAA,gBAAAA,EAAgB,GAAG,CAAC,GAEjB;AAAA,IACL,SAAAG;AAAA,IACA,MAAAC;AAAA,IACA,MAAMJ,EAAe;AAAA,IACrB,YAAAS;AAAA,IACA,UAAAG;AAAA,IACA,SAAAN;AAAA,IACA,YAAAC;AAAA,IACA,UAAU,MAAM;AACL,MAAAN,EAAAgB,EAAyBjB,GAAgBS,CAAU,CAAC;AAAA,IAAA;AAAA,EAEjE;AACF;AAEO,SAASS,EAAaC,GAA0B;AAC/C,QAAA,EAAE,MAAAf,GAAM,YAAAK,GAAY,SAAAN,IAAU,CAAI,GAAA,UAAAS,GAAU,UAAAX,GAAU,SAAAK,EAAA,IAAYP,EAAgBoB,CAAK,GAEvFC,IAAOjB,EAAQ,SAAS,CAACkB,MAAcA;AAE7C,2BACG,OACC,EAAA,UAAA;AAAA,IAAA,gBAAAC,EAACC,GAAuB,EAAA,MAAAnB,GAAY,YAAAK,GAAwB,UAAAG,GAAoB,SAAAT,GAAkB;AAAA,IAEjG,gBAAAmB,EAAA,UAAA,EAAO,eAAY,UAAS,UAAU,CAAChB,GAAS,WAAW,wBAAwB,SAASL,GAAU,MAAM,UAC1G,UAAAmB,EAAK,eAAe,EACvB,CAAA;AAAA,EAAA,GACF;AAEJ;"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
function e() {
|
|
2
|
+
return {
|
|
3
|
+
type: "form",
|
|
4
|
+
tags: [],
|
|
5
|
+
components: [
|
|
6
|
+
{
|
|
7
|
+
input: !0,
|
|
8
|
+
key: "action",
|
|
9
|
+
placeholder: "Enter the custom submission URL",
|
|
10
|
+
label: "Custom Action Url",
|
|
11
|
+
labelPosition: "top",
|
|
12
|
+
widget: { type: "input" },
|
|
13
|
+
type: "url",
|
|
14
|
+
mask: !1,
|
|
15
|
+
inputType: "url",
|
|
16
|
+
inputFormat: "plain",
|
|
17
|
+
spellcheck: !0,
|
|
18
|
+
id: "efyrzea",
|
|
19
|
+
attributes: {
|
|
20
|
+
"data-testid": "action"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
input: !0,
|
|
25
|
+
key: "tags",
|
|
26
|
+
placeholder: "Add tags",
|
|
27
|
+
label: "Form tags",
|
|
28
|
+
widget: { type: "input" },
|
|
29
|
+
type: "tags",
|
|
30
|
+
delimeter: ",",
|
|
31
|
+
storeas: "array",
|
|
32
|
+
maxTags: 0,
|
|
33
|
+
id: "erxcyw"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
input: !0,
|
|
37
|
+
key: "properties",
|
|
38
|
+
label: "Custom Properties",
|
|
39
|
+
labelPosition: "top",
|
|
40
|
+
type: "datamap",
|
|
41
|
+
addAnother: "Add Another",
|
|
42
|
+
disableAddingRemovingRows: !1,
|
|
43
|
+
keyBeforeValue: !0,
|
|
44
|
+
valueComponent: {
|
|
45
|
+
type: "textfield",
|
|
46
|
+
key: "value",
|
|
47
|
+
label: "Value",
|
|
48
|
+
input: !0,
|
|
49
|
+
hideLabel: !0
|
|
50
|
+
},
|
|
51
|
+
id: "ezne35"
|
|
52
|
+
}
|
|
53
|
+
],
|
|
54
|
+
display: "form"
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
export {
|
|
58
|
+
e as getFormSettingsSchema
|
|
59
|
+
};
|
|
60
|
+
//# sourceMappingURL=FormSettings.schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormSettings.schema.js","sources":["../../../../src/organisms/form/settings/FormSettings.schema.ts"],"sourcesContent":["import type { FormType } from \"../../../interfaces\";\n\nexport function getFormSettingsSchema(): FormType {\n return {\n type: \"form\",\n tags: [],\n components: [\n {\n input: true,\n key: \"action\",\n placeholder: \"Enter the custom submission URL\",\n label: \"Custom Action Url\",\n labelPosition: \"top\",\n widget: { type: \"input\" },\n type: \"url\",\n mask: false,\n inputType: \"url\",\n inputFormat: \"plain\",\n spellcheck: true,\n id: \"efyrzea\",\n attributes: {\n \"data-testid\": \"action\"\n }\n },\n {\n input: true,\n key: \"tags\",\n placeholder: \"Add tags\",\n label: \"Form tags\",\n widget: { type: \"input\" },\n type: \"tags\",\n delimeter: \",\",\n storeas: \"array\",\n maxTags: 0,\n id: \"erxcyw\"\n },\n {\n input: true,\n key: \"properties\",\n label: \"Custom Properties\",\n labelPosition: \"top\",\n type: \"datamap\",\n addAnother: \"Add Another\",\n disableAddingRemovingRows: false,\n keyBeforeValue: true,\n valueComponent: {\n type: \"textfield\",\n key: \"value\",\n label: \"Value\",\n input: true,\n hideLabel: true\n },\n id: \"ezne35\"\n }\n ],\n display: \"form\"\n };\n}\n"],"names":["getFormSettingsSchema"],"mappings":"AAEO,SAASA,IAAkC;AACzC,SAAA;AAAA,IACL,MAAM;AAAA,IACN,MAAM,CAAC;AAAA,IACP,YAAY;AAAA,MACV;AAAA,QACE,OAAO;AAAA,QACP,KAAK;AAAA,QACL,aAAa;AAAA,QACb,OAAO;AAAA,QACP,eAAe;AAAA,QACf,QAAQ,EAAE,MAAM,QAAQ;AAAA,QACxB,MAAM;AAAA,QACN,MAAM;AAAA,QACN,WAAW;AAAA,QACX,aAAa;AAAA,QACb,YAAY;AAAA,QACZ,IAAI;AAAA,QACJ,YAAY;AAAA,UACV,eAAe;AAAA,QAAA;AAAA,MAEnB;AAAA,MACA;AAAA,QACE,OAAO;AAAA,QACP,KAAK;AAAA,QACL,aAAa;AAAA,QACb,OAAO;AAAA,QACP,QAAQ,EAAE,MAAM,QAAQ;AAAA,QACxB,MAAM;AAAA,QACN,WAAW;AAAA,QACX,SAAS;AAAA,QACT,SAAS;AAAA,QACT,IAAI;AAAA,MACN;AAAA,MACA;AAAA,QACE,OAAO;AAAA,QACP,KAAK;AAAA,QACL,OAAO;AAAA,QACP,eAAe;AAAA,QACf,MAAM;AAAA,QACN,YAAY;AAAA,QACZ,2BAA2B;AAAA,QAC3B,gBAAgB;AAAA,QAChB,gBAAgB;AAAA,UACd,MAAM;AAAA,UACN,KAAK;AAAA,UACL,OAAO;AAAA,UACP,OAAO;AAAA,UACP,WAAW;AAAA,QACb;AAAA,QACA,IAAI;AAAA,MAAA;AAAA,IAER;AAAA,IACA,SAAS;AAAA,EACX;AACF;"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FormType, SubmissionType } from '../../../interfaces';
|
|
2
|
+
export type FormSettingsType = {
|
|
3
|
+
action: string;
|
|
4
|
+
tags: string[];
|
|
5
|
+
properties: Record<string, any>;
|
|
6
|
+
};
|
|
7
|
+
export declare function formSettingsToSubmission(form: Partial<FormType>): SubmissionType<FormSettingsType>;
|
|
8
|
+
export declare function submissionToFormSettings(form: Partial<FormType>, submission: SubmissionType<FormSettingsType>): Partial<FormType>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import e from "lodash/cloneDeep";
|
|
2
|
+
function r(t) {
|
|
3
|
+
return {
|
|
4
|
+
data: {
|
|
5
|
+
action: t.action,
|
|
6
|
+
tags: t.tags,
|
|
7
|
+
properties: t.properties
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
function i(t, a) {
|
|
12
|
+
return {
|
|
13
|
+
...e(t),
|
|
14
|
+
tags: a.data.tags,
|
|
15
|
+
action: a.data.action,
|
|
16
|
+
properties: a.data.properties
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export {
|
|
20
|
+
r as formSettingsToSubmission,
|
|
21
|
+
i as submissionToFormSettings
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=FormSettings.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormSettings.utils.js","sources":["../../../../src/organisms/form/settings/FormSettings.utils.ts"],"sourcesContent":["import cloneDeep from \"lodash/cloneDeep\";\n\nimport { FormType, SubmissionType } from \"../../../interfaces\";\n\nexport type FormSettingsType = {\n action: string;\n tags: string[];\n properties: Record<string, any>;\n};\n\nexport function formSettingsToSubmission(form: Partial<FormType>): SubmissionType<FormSettingsType> {\n return {\n data: {\n action: form.action!,\n tags: form.tags!,\n properties: form.properties!\n }\n };\n}\n\nexport function submissionToFormSettings(form: Partial<FormType>, submission: SubmissionType<FormSettingsType>): Partial<FormType> {\n return {\n ...cloneDeep(form),\n tags: submission.data.tags,\n action: submission.data.action,\n properties: submission.data.properties\n };\n}\n"],"names":["formSettingsToSubmission","form","submissionToFormSettings","submission","cloneDeep"],"mappings":";AAUO,SAASA,EAAyBC,GAA2D;AAC3F,SAAA;AAAA,IACL,MAAM;AAAA,MACJ,QAAQA,EAAK;AAAA,MACb,MAAMA,EAAK;AAAA,MACX,YAAYA,EAAK;AAAA,IAAA;AAAA,EAErB;AACF;AAEgB,SAAAC,EAAyBD,GAAyBE,GAAiE;AAC1H,SAAA;AAAA,IACL,GAAGC,EAAUH,CAAI;AAAA,IACjB,MAAME,EAAW,KAAK;AAAA,IACtB,QAAQA,EAAW,KAAK;AAAA,IACxB,YAAYA,EAAW,KAAK;AAAA,EAC9B;AACF;"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ComponentType, JSON, SubmissionType } from '../../interfaces';
|
|
2
|
+
export interface FormPageChangeProps<Data extends {
|
|
3
|
+
[key: string]: JSON;
|
|
4
|
+
} = {
|
|
5
|
+
[key: string]: JSON;
|
|
6
|
+
}> {
|
|
7
|
+
page: number;
|
|
8
|
+
submission: SubmissionType<Data>;
|
|
9
|
+
}
|
|
10
|
+
export type FormCustomEvent = {
|
|
11
|
+
type: string;
|
|
12
|
+
event: string;
|
|
13
|
+
component: ComponentType;
|
|
14
|
+
data: any;
|
|
15
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { MutableRefObject } from 'react';
|
|
2
|
+
import { ChangedSubmission, ComponentType, FormOptions, FormType, JSON, SubmissionType } from '../../interfaces';
|
|
3
|
+
import { FormCustomEvent } from './types';
|
|
4
|
+
type Webform = any;
|
|
5
|
+
type EventError = string | Error | Error[] | {
|
|
6
|
+
message: string;
|
|
7
|
+
} | {
|
|
8
|
+
message: string;
|
|
9
|
+
}[];
|
|
10
|
+
export interface UseFormProps<Data extends {
|
|
11
|
+
[key: string]: JSON;
|
|
12
|
+
} = {
|
|
13
|
+
[key: string]: JSON;
|
|
14
|
+
}> {
|
|
15
|
+
src?: string;
|
|
16
|
+
url?: string;
|
|
17
|
+
form?: FormType;
|
|
18
|
+
submission?: SubmissionType<Data>;
|
|
19
|
+
options?: FormOptions;
|
|
20
|
+
FormClass?: any;
|
|
21
|
+
onFormReady?: (instance: Webform) => void;
|
|
22
|
+
onPrevPage?: (page: number, submission: SubmissionType<Data>) => void;
|
|
23
|
+
onNextPage?: (page: number, submission: SubmissionType<Data>) => void;
|
|
24
|
+
onCancelSubmit?: () => void;
|
|
25
|
+
onCancelComponent?: (component: ComponentType) => void;
|
|
26
|
+
onChange?: (value: ChangedSubmission<Data>, flags: any, modified: boolean) => void;
|
|
27
|
+
onCustomEvent?: (event: FormCustomEvent) => void;
|
|
28
|
+
onComponentChange?: (changed: {
|
|
29
|
+
instance: Webform;
|
|
30
|
+
component: Webform;
|
|
31
|
+
value: any;
|
|
32
|
+
flags: any;
|
|
33
|
+
}) => void;
|
|
34
|
+
onSubmit?: (submission: SubmissionType<Data>, saved?: boolean) => void;
|
|
35
|
+
onAsyncSubmit?: (submission: SubmissionType<Data>) => void;
|
|
36
|
+
onSubmitDone?: (submission: SubmissionType<Data>) => void;
|
|
37
|
+
onSubmitError?: (error: EventError) => void;
|
|
38
|
+
onFormLoad?: (form: JSON) => void;
|
|
39
|
+
onError?: (error: EventError | false) => void;
|
|
40
|
+
onRender?: (param: any) => void;
|
|
41
|
+
onAttach?: (param: any) => void;
|
|
42
|
+
onBuild?: (param: any) => void;
|
|
43
|
+
onFocus?: (instance: Webform) => void;
|
|
44
|
+
onBlur?: (instance: Webform) => void;
|
|
45
|
+
onInitialized?: () => void;
|
|
46
|
+
onLanguageChanged?: () => void;
|
|
47
|
+
onBeforeSetSubmission?: (submission: SubmissionType<Data>) => void;
|
|
48
|
+
onSaveDraftBegin?: () => void;
|
|
49
|
+
onSaveDraft?: (submission: SubmissionType<Data>) => void;
|
|
50
|
+
onRestoreDraft?: (submission: SubmissionType<Data> | null) => void;
|
|
51
|
+
onSubmissionDeleted?: (submission: SubmissionType<Data>) => void;
|
|
52
|
+
onRequestDone?: () => void;
|
|
53
|
+
otherEvents?: {
|
|
54
|
+
[event: string]: (...args: any[]) => void;
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
export declare function useForm<Data extends {
|
|
58
|
+
[key: string]: JSON;
|
|
59
|
+
} = {
|
|
60
|
+
[key: string]: JSON;
|
|
61
|
+
}>(props: UseFormProps<Data>): {
|
|
62
|
+
element: MutableRefObject<HTMLDivElement | null>;
|
|
63
|
+
instance: any;
|
|
64
|
+
};
|
|
65
|
+
export {};
|