@tsed/react-formio 3.0.0-alpha.8 → 3.0.0-rc.1
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/all.d.ts +0 -0
- package/dist/all.js +38 -0
- package/dist/all.js.map +1 -0
- package/dist/atoms/icon/Icon.d.ts +4 -3
- package/dist/atoms/icon/Icon.js +9 -8
- package/dist/atoms/icon/Icon.js.map +1 -1
- package/dist/chunks/_commonjsHelpers.js +30 -3
- package/dist/chunks/_commonjsHelpers.js.map +1 -1
- package/dist/chunks/index.js +33 -30
- package/dist/chunks/index.js.map +1 -1
- package/dist/chunks/index.module.js +16 -16
- package/dist/chunks/index.module.js.map +1 -1
- package/dist/chunks/index2.js +56953 -0
- package/dist/chunks/index2.js.map +1 -0
- package/dist/chunks/react-select-animated.esm.js +3616 -0
- package/dist/chunks/react-select-animated.esm.js.map +1 -0
- package/dist/contexts/FormioContext.d.ts +19 -0
- package/dist/contexts/FormioContext.js +35 -0
- package/dist/contexts/FormioContext.js.map +1 -0
- package/dist/hooks/keyboard.constants.d.ts +38 -0
- package/dist/hooks/keyboard.constants.js +7 -0
- package/dist/hooks/keyboard.constants.js.map +1 -0
- package/dist/hooks/useFormioContext.d.ts +10 -0
- package/dist/hooks/useFormioContext.js +12 -0
- package/dist/hooks/useFormioContext.js.map +1 -0
- package/dist/hooks/useI18n.d.ts +4 -0
- package/dist/hooks/useI18n.js +9 -0
- package/dist/hooks/useI18n.js.map +1 -0
- package/dist/hooks/useKeyboardControls.d.ts +12 -0
- package/dist/hooks/useKeyboardControls.js +35 -0
- package/dist/hooks/useKeyboardControls.js.map +1 -0
- package/dist/hooks/useTooltip.js.map +1 -1
- package/dist/index.d.ts +1 -6
- package/dist/index.js +18 -13
- package/dist/index.js.map +1 -1
- package/dist/interfaces/ComponentType.d.ts +6 -2
- package/dist/interfaces/FormBuilderOptions.d.ts +7 -0
- package/dist/interfaces/FormBuilderOptions.js +2 -0
- package/dist/interfaces/FormBuilderOptions.js.map +1 -0
- package/dist/interfaces/FormOptions.d.ts +6 -13
- package/dist/interfaces/FormType.d.ts +4 -11
- package/dist/interfaces/Operation.d.ts +13 -4
- package/dist/interfaces/SubmissionType.d.ts +5 -10
- package/dist/interfaces/index.d.ts +1 -0
- package/dist/molecules/alert/Alert.js.map +1 -1
- package/dist/molecules/button/Button.d.ts +18 -5
- package/dist/molecules/button/Button.js +24 -28
- package/dist/molecules/button/Button.js.map +1 -1
- package/dist/molecules/card/Card.js +9 -7
- package/dist/molecules/card/Card.js.map +1 -1
- package/dist/molecules/forms/form-control/FormControl.d.ts +14 -12
- package/dist/molecules/forms/form-control/FormControl.js +46 -22
- package/dist/molecules/forms/form-control/FormControl.js.map +1 -1
- package/dist/molecules/forms/input-tags/InputTags.d.ts +2 -8
- 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 +21 -27
- package/dist/molecules/forms/input-tags/InputTags.js.map +1 -1
- 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 +1926 -0
- package/dist/molecules/forms/input-tags/components/ReactTags.js.map +1 -0
- package/dist/molecules/forms/input-text/InputText.d.ts +2 -14
- 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 +46 -56
- package/dist/molecules/forms/input-text/InputText.js.map +1 -1
- package/dist/molecules/forms/select/Select.d.ts +1 -1
- package/dist/molecules/forms/select/{Select.interfaces.d.ts → Select.interface.d.ts} +8 -10
- 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 +9 -10
- package/dist/molecules/forms/select/Select.js.map +1 -1
- package/dist/molecules/forms/select/all.d.ts +1 -1
- package/dist/molecules/forms/select/all.js +1 -0
- package/dist/molecules/forms/select/all.js.map +1 -1
- package/dist/molecules/forms/select/components/ChoicesSelect.d.ts +1 -1
- package/dist/molecules/forms/select/components/ChoicesSelect.js +72 -83
- package/dist/molecules/forms/select/components/ChoicesSelect.js.map +1 -1
- package/dist/molecules/forms/select/components/HtmlSelect.d.ts +1 -1
- package/dist/molecules/forms/select/components/HtmlSelect.js +17 -16
- package/dist/molecules/forms/select/components/HtmlSelect.js.map +1 -1
- package/dist/molecules/forms/select/components/ReactSelect.d.ts +1 -1
- package/dist/molecules/forms/select/components/ReactSelect.js +28 -3034
- package/dist/molecules/forms/select/components/ReactSelect.js.map +1 -1
- package/dist/molecules/forms/select/components/choices.template.js +2340 -2257
- package/dist/molecules/forms/select/components/choices.template.js.map +1 -1
- package/dist/molecules/forms/select/hooks/useOptions.d.ts +3 -3
- package/dist/molecules/forms/select/hooks/useOptions.js +15 -15
- package/dist/molecules/forms/select/hooks/useOptions.js.map +1 -1
- package/dist/molecules/loader/Loader.d.ts +4 -4
- package/dist/molecules/loader/Loader.js +16 -8
- package/dist/molecules/loader/Loader.js.map +1 -1
- package/dist/molecules/modal/Modal.js +23 -24
- package/dist/molecules/modal/Modal.js.map +1 -1
- package/dist/molecules/pagination/Pagination.d.ts +7 -6
- package/dist/molecules/pagination/Pagination.js +48 -57
- package/dist/molecules/pagination/Pagination.js.map +1 -1
- package/dist/molecules/pagination/PaginationButton.js +10 -10
- package/dist/molecules/pagination/PaginationButton.js.map +1 -1
- package/dist/molecules/pagination/all.js +5 -4
- package/dist/molecules/pagination/all.js.map +1 -1
- package/dist/molecules/pagination/utils/getPageNumbers.js.map +1 -0
- package/dist/molecules/table/Table.d.ts +16 -2
- package/dist/molecules/table/Table.js +53 -77
- package/dist/molecules/table/Table.js.map +1 -1
- 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 -1
- package/dist/molecules/table/components/DefaultArrowSort.js +17 -5
- package/dist/molecules/table/components/DefaultArrowSort.js.map +1 -1
- package/dist/molecules/table/components/DefaultCell.d.ts +5 -1
- package/dist/molecules/table/components/DefaultCell.js +8 -6
- package/dist/molecules/table/components/DefaultCell.js.map +1 -1
- 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 +5 -8
- package/dist/molecules/table/components/DefaultCellHeader.js +25 -9
- package/dist/molecules/table/components/DefaultCellHeader.js.map +1 -1
- package/dist/molecules/table/components/DefaultCellOperations.d.ts +16 -10
- package/dist/molecules/table/components/DefaultCellOperations.js +23 -14
- package/dist/molecules/table/components/DefaultCellOperations.js.map +1 -1
- 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 +16 -12
- package/dist/molecules/table/components/DefaultOperationButton.js +16 -31
- package/dist/molecules/table/components/DefaultOperationButton.js.map +1 -1
- 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 +41 -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 +33 -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 +23 -0
- package/dist/molecules/table/hooks/useTable.js +35 -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 +2 -2
- package/dist/molecules/table/utils/mapFormToColumns.js +34 -18
- package/dist/molecules/table/utils/mapFormToColumns.js.map +1 -1
- package/dist/molecules/tabs/Tab.d.ts +13 -0
- package/dist/molecules/tabs/Tab.js +66 -0
- package/dist/molecules/tabs/Tab.js.map +1 -0
- package/dist/molecules/tabs/TabList.d.ts +2 -0
- package/dist/molecules/tabs/TabList.js +23 -0
- package/dist/molecules/tabs/TabList.js.map +1 -0
- package/dist/molecules/tabs/TabPanel.d.ts +9 -0
- package/dist/molecules/tabs/TabPanel.js +27 -0
- package/dist/molecules/tabs/TabPanel.js.map +1 -0
- package/dist/molecules/tabs/Tabs.d.ts +4 -16
- package/dist/molecules/tabs/Tabs.js +7 -67
- package/dist/molecules/tabs/Tabs.js.map +1 -1
- package/dist/molecules/tabs/TabsBody.d.ts +1 -0
- package/dist/molecules/tabs/TabsBody.js +10 -0
- package/dist/molecules/tabs/TabsBody.js.map +1 -0
- package/dist/molecules/tabs/TabsLegacy.d.ts +18 -0
- package/dist/molecules/tabs/TabsLegacy.js +49 -0
- package/dist/molecules/tabs/TabsLegacy.js.map +1 -0
- package/dist/molecules/tabs/all.d.ts +5 -0
- package/dist/molecules/tabs/all.js +13 -0
- package/dist/molecules/tabs/all.js.map +1 -0
- package/dist/molecules/tabs/context/TabControl.d.ts +52 -0
- package/dist/molecules/tabs/context/TabControl.js +85 -0
- package/dist/molecules/tabs/context/TabControl.js.map +1 -0
- package/dist/molecules/tabs/hooks/tabControl.d.ts +44 -0
- package/dist/molecules/tabs/hooks/tabControl.js +34 -0
- package/dist/molecules/tabs/hooks/tabControl.js.map +1 -0
- package/dist/organisms/form/Form.js.map +1 -1
- package/dist/organisms/form/access/FormAccess.js +41 -41
- package/dist/organisms/form/access/FormAccess.js.map +1 -1
- package/dist/organisms/form/access/FormAccess.schema.js +1 -0
- package/dist/organisms/form/access/FormAccess.schema.js.map +1 -1
- package/dist/organisms/form/access/FormAccess.utils.js +2 -2
- package/dist/organisms/form/access/FormAccess.utils.js.map +1 -1
- package/dist/organisms/form/actions/FormAction.js +34 -0
- package/dist/organisms/form/actions/FormAction.js.map +1 -0
- package/dist/organisms/form/builder/FormBuilder.js.map +1 -1
- package/dist/organisms/form/builder/FormEdit.d.ts +7 -3
- package/dist/organisms/form/builder/FormEdit.js +46 -42
- package/dist/organisms/form/builder/FormEdit.js.map +1 -1
- package/dist/organisms/form/builder/FormEdit.reducer.js.map +1 -1
- package/dist/organisms/form/builder/FormEditCtas.d.ts +2 -2
- package/dist/organisms/form/builder/FormEditCtas.js +36 -35
- package/dist/organisms/form/builder/FormEditCtas.js.map +1 -1
- package/dist/organisms/form/builder/FormParameters.d.ts +3 -2
- package/dist/organisms/form/builder/FormParameters.js +19 -18
- package/dist/organisms/form/builder/FormParameters.js.map +1 -1
- package/dist/organisms/form/builder/all.js +17 -13
- package/dist/organisms/form/builder/all.js.map +1 -1
- package/dist/organisms/form/builder/useFormBuilder.d.ts +4 -4
- package/dist/organisms/form/builder/useFormBuilder.js +36 -33
- package/dist/organisms/form/builder/useFormBuilder.js.map +1 -1
- package/dist/organisms/form/builder/useFormEdit.d.ts +2 -2
- package/dist/organisms/form/builder/useFormEdit.js +1 -1
- package/dist/organisms/form/builder/useFormEdit.js.map +1 -1
- package/dist/organisms/form/exports/FormExport.d.ts +6 -0
- package/dist/organisms/form/exports/FormExport.js +56 -0
- package/dist/organisms/form/exports/FormExport.js.map +1 -0
- package/dist/organisms/form/preview/FormPreview.d.ts +6 -0
- package/dist/organisms/form/preview/FormPreview.js +12 -0
- package/dist/organisms/form/preview/FormPreview.js.map +1 -0
- package/dist/organisms/form/settings/FormSettings.js +28 -28
- package/dist/organisms/form/settings/FormSettings.js.map +1 -1
- package/dist/organisms/form/settings/FormSettings.schema.js.map +1 -1
- package/dist/organisms/form/settings/FormSettings.utils.js.map +1 -1
- package/dist/organisms/form/useForm.d.ts +2 -1
- package/dist/organisms/form/useForm.js +664 -661
- package/dist/organisms/form/useForm.js.map +1 -1
- package/dist/organisms/modal/RemoveModal.js +16 -17
- package/dist/organisms/modal/RemoveModal.js.map +1 -1
- package/dist/organisms/table/actions/ActionsTable.d.ts +4 -3
- package/dist/organisms/table/actions/ActionsTable.js +21 -33
- package/dist/organisms/table/actions/ActionsTable.js.map +1 -1
- package/dist/organisms/table/forms/FormsTable.d.ts +2 -3
- package/dist/organisms/table/forms/FormsTable.js +48 -27
- package/dist/organisms/table/forms/FormsTable.js.map +1 -1
- 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 +12 -4
- package/dist/organisms/table/submissions/SubmissionsTable.js +10 -17
- package/dist/organisms/table/submissions/SubmissionsTable.js.map +1 -1
- package/dist/organisms/views/FormViews.d.ts +24 -0
- package/dist/organisms/views/FormViews.js +97 -0
- package/dist/organisms/views/FormViews.js.map +1 -0
- package/dist/registries/components.js +12 -11
- package/dist/registries/components.js.map +1 -1
- package/dist/utils/getEventValue.js.map +1 -1
- package/dist/utils/iconClass.js +4 -5
- package/dist/utils/iconClass.js.map +1 -1
- package/dist/utils/mapPagination.js.map +1 -1
- package/dist/utils/stopPropagationWrapper.js.map +1 -1
- package/package.json +10 -8
- package/readme.md +7 -8
- package/src/all.ts +34 -0
- package/src/atoms/icon/Icon.stories.tsx +71 -22
- package/src/atoms/icon/Icon.tsx +14 -4
- package/src/contexts/FormioContext.tsx +89 -0
- package/src/hooks/keyboard.constants.ts +40 -0
- package/src/hooks/useFormioContext.ts +13 -0
- package/src/hooks/useI18n.ts +9 -0
- package/src/hooks/useKeyboardControls.spec.tsx +208 -0
- package/src/hooks/useKeyboardControls.ts +84 -0
- package/src/index.ts +17 -13
- package/src/interfaces/ComponentType.ts +2 -2
- package/src/interfaces/FormBuilderOptions.ts +9 -0
- package/src/interfaces/FormOptions.ts +7 -13
- package/src/interfaces/FormType.ts +5 -11
- package/src/interfaces/Operation.ts +10 -4
- package/src/interfaces/SubmissionType.ts +9 -8
- package/src/interfaces/index.ts +1 -0
- package/src/molecules/__fixtures__/build.js +28 -0
- package/src/molecules/__fixtures__/form-schema.json +76 -195
- package/src/molecules/__fixtures__/form-submissions.json +11846 -46
- package/src/molecules/__fixtures__/products.json +81539 -0
- package/src/molecules/button/Button.stories.tsx +1 -1
- package/src/molecules/button/Button.tsx +43 -24
- package/src/molecules/card/Card.tsx +4 -0
- package/src/molecules/forms/form-control/FormControl.spec.tsx +7 -4
- package/src/molecules/forms/form-control/FormControl.stories.tsx +4 -4
- package/src/molecules/forms/form-control/FormControl.tsx +46 -20
- package/src/molecules/forms/input-tags/InputTags.interface.ts +9 -0
- package/src/molecules/forms/input-tags/InputTags.tsx +20 -42
- 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/molecules/forms/input-text/InputText.spec.tsx +1 -1
- package/src/molecules/forms/input-text/InputText.stories.tsx +4 -4
- package/src/molecules/forms/input-text/InputText.tsx +38 -53
- package/src/molecules/forms/select/{Select.interfaces.ts → Select.interface.ts} +8 -10
- package/src/molecules/forms/select/Select.tsx +5 -3
- package/src/molecules/forms/select/all.ts +2 -1
- package/src/molecules/forms/select/components/ChoicesSelect.stories.tsx +8 -7
- package/src/molecules/forms/select/components/ChoicesSelect.tsx +9 -18
- package/src/molecules/forms/select/components/HtmlSelect.stories.tsx +7 -7
- package/src/molecules/forms/select/components/HtmlSelect.tsx +3 -2
- package/src/molecules/forms/select/components/ReactSelect.stories.tsx +10 -8
- package/src/molecules/forms/select/components/ReactSelect.tsx +1 -1
- package/src/molecules/forms/select/hooks/useOptions.ts +6 -2
- package/src/molecules/loader/Loader.spec.tsx +2 -2
- package/src/molecules/loader/Loader.stories.tsx +7 -4
- package/src/molecules/loader/Loader.tsx +16 -6
- package/src/molecules/modal/Modal.stories.tsx +1 -1
- package/src/molecules/pagination/Pagination.spec.tsx +11 -11
- package/src/molecules/pagination/Pagination.stories.tsx +32 -10
- package/src/molecules/pagination/Pagination.tsx +29 -26
- package/src/molecules/table/Table.stories.tsx +284 -101
- package/src/molecules/table/Table.tsx +91 -86
- package/src/molecules/table/all.ts +16 -0
- package/src/molecules/table/components/DefaultArrowSort.tsx +20 -4
- package/src/molecules/table/components/DefaultCell.tsx +10 -1
- package/src/molecules/table/components/DefaultCellFooter.tsx +16 -0
- package/src/molecules/table/components/DefaultCellHeader.tsx +33 -13
- package/src/molecules/table/components/DefaultCellOperations.tsx +31 -20
- package/src/molecules/table/components/DefaultFilter.tsx +42 -0
- package/src/molecules/table/components/DefaultOperationButton.tsx +19 -34
- 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 +76 -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 +69 -26
- package/src/molecules/tabs/Tab.tsx +106 -0
- package/src/molecules/tabs/TabList.tsx +37 -0
- package/src/molecules/tabs/TabPanel.tsx +37 -0
- package/src/molecules/tabs/Tabs.spec.tsx +126 -73
- package/src/molecules/tabs/Tabs.stories.tsx +298 -65
- package/src/molecules/tabs/Tabs.tsx +10 -81
- package/src/molecules/tabs/TabsBody.tsx +11 -0
- package/src/molecules/tabs/TabsLegacy.stories.tsx +103 -0
- package/src/molecules/tabs/TabsLegacy.tsx +86 -0
- package/src/molecules/tabs/all.ts +5 -0
- package/src/molecules/tabs/context/TabControl.tsx +166 -0
- package/src/molecules/tabs/hooks/tabControl.spec.tsx +388 -0
- package/src/molecules/tabs/hooks/tabControl.ts +52 -0
- package/src/organisms/__fixtures__/form-firstname.fixture.json +1 -0
- package/src/organisms/__fixtures__/form.fixture.json +1 -0
- package/src/organisms/form/Form.stories.tsx +104 -124
- package/src/organisms/form/access/FormAccess.schema.ts +1 -0
- package/src/organisms/form/access/FormAccess.stories.tsx +6 -4
- package/src/organisms/form/actions/FormAction.stories.tsx +426 -0
- package/src/organisms/form/{action → actions}/FormAction.tsx +2 -2
- package/src/organisms/form/builder/FormBuilder.stories.tsx +7 -4
- package/src/organisms/form/builder/FormEdit.reducer.spec.ts +136 -0
- package/src/organisms/form/builder/FormEdit.stories.tsx +16 -13
- package/src/organisms/form/builder/FormEdit.tsx +15 -7
- package/src/organisms/form/builder/FormEditCtas.tsx +10 -10
- package/src/organisms/form/builder/FormParameters.tsx +8 -4
- package/src/organisms/form/builder/all.ts +4 -0
- package/src/organisms/form/builder/useFormBuilder.ts +12 -7
- package/src/organisms/form/builder/useFormEdit.ts +3 -3
- package/src/organisms/form/exports/FormExport.stories.tsx +68 -0
- package/src/organisms/form/exports/FormExport.tsx +61 -0
- package/src/organisms/form/preview/FormPreview.stories.tsx +58 -0
- package/src/organisms/form/preview/FormPreview.tsx +23 -0
- package/src/organisms/form/settings/FormSettings.component.spec.tsx +3 -1
- package/src/organisms/form/settings/FormSettings.stories.tsx +2 -2
- package/src/organisms/form/settings/FormSettings.tsx +6 -6
- package/src/organisms/form/useForm.ts +2 -3
- package/src/organisms/modal/RemoveModal.stories.tsx +1 -1
- package/src/organisms/table/actions/ActionsTable.spec.tsx +7 -5
- package/src/organisms/table/actions/ActionsTable.stories.tsx +48 -45
- package/src/organisms/table/actions/ActionsTable.tsx +14 -18
- package/src/organisms/table/forms/FormsTable.stories.tsx +2 -0
- package/src/organisms/table/forms/FormsTable.tsx +53 -23
- package/src/organisms/table/forms/components/FormsCell.tsx +53 -0
- package/src/organisms/table/submissions/SubmissionsTable.stories.tsx +101 -57
- package/src/organisms/table/submissions/SubmissionsTable.tsx +12 -5
- package/src/organisms/views/FormViews.stories.tsx +221 -0
- package/src/organisms/views/FormViews.tsx +148 -0
- package/src/registries/components.ts +7 -1
- package/src/utils/iconClass.ts +1 -3
- package/vite.config.mts +2 -2
- package/dist/molecules/forms/select/Select.interfaces.js +0 -2
- package/dist/molecules/forms/select/Select.interfaces.js.map +0 -1
- package/dist/molecules/table/components/DefaultCells.d.ts +0 -4
- package/dist/molecules/table/components/DefaultCells.js +0 -23
- package/dist/molecules/table/components/DefaultCells.js.map +0 -1
- package/dist/molecules/table/components/DefaultRow.d.ts +0 -12
- package/dist/molecules/table/components/DefaultRow.js +0 -26
- package/dist/molecules/table/components/DefaultRow.js.map +0 -1
- package/dist/molecules/table/components/DragNDropContainer.d.ts +0 -4
- package/dist/molecules/table/components/DragNDropContainer.js +0 -10
- package/dist/molecules/table/components/DragNDropContainer.js.map +0 -1
- package/dist/molecules/table/filters/DefaultColumnFilter.d.ts +0 -10
- package/dist/molecules/table/filters/DefaultColumnFilter.js +0 -29
- package/dist/molecules/table/filters/DefaultColumnFilter.js.map +0 -1
- package/dist/molecules/table/filters/SelectColumnFilter.d.ts +0 -10
- package/dist/molecules/table/filters/SelectColumnFilter.js +0 -34
- package/dist/molecules/table/filters/SelectColumnFilter.js.map +0 -1
- package/dist/molecules/table/filters/SliderColumnFilter.d.ts +0 -9
- package/dist/molecules/table/filters/SliderColumnFilter.js +0 -27
- package/dist/molecules/table/filters/SliderColumnFilter.js.map +0 -1
- package/dist/molecules/table/hooks/useCustomTable.d.ts +0 -128
- package/dist/molecules/table/hooks/useCustomTable.js +0 -130
- package/dist/molecules/table/hooks/useCustomTable.js.map +0 -1
- package/dist/molecules/table/hooks/useDragnDropRow.d.ts +0 -272
- package/dist/molecules/table/hooks/useDragnDropRow.js +0 -40
- package/dist/molecules/table/hooks/useDragnDropRow.js.map +0 -1
- package/dist/molecules/table/hooks/useOperations.d.ts +0 -11
- package/dist/molecules/table/hooks/useOperations.js +0 -25
- package/dist/molecules/table/hooks/useOperations.js.map +0 -1
- package/dist/molecules/table/index.d.ts +0 -15
- package/dist/molecules/table/index.js +0 -35
- package/dist/molecules/table/index.js.map +0 -1
- package/dist/molecules/table/utils/getPageNumbers.js.map +0 -1
- package/dist/molecules/table/utils/swapElements.d.ts +0 -1
- package/dist/molecules/table/utils/swapElements.js +0 -5
- package/dist/molecules/table/utils/swapElements.js.map +0 -1
- package/dist/organisms/form/action/FormAction.js +0 -32
- package/dist/organisms/form/action/FormAction.js.map +0 -1
- package/dist/organisms/table/forms/components/FormCell.d.ts +0 -6
- package/dist/organisms/table/forms/components/FormCell.js +0 -50
- package/dist/organisms/table/forms/components/FormCell.js.map +0 -1
- package/dist/typings.d.js +0 -2
- package/dist/typings.d.js.map +0 -1
- package/src/molecules/forms/input-tags/InputTags.stories.tsx +0 -81
- package/src/molecules/table/components/DefaultCells.tsx +0 -30
- package/src/molecules/table/components/DefaultRow.tsx +0 -52
- package/src/molecules/table/components/DragNDropContainer.tsx +0 -7
- package/src/molecules/table/filters/DefaultColumnFilter.spec.tsx +0 -33
- package/src/molecules/table/filters/DefaultColumnFilter.tsx +0 -38
- package/src/molecules/table/filters/SelectColumnFilter.spec.tsx +0 -68
- package/src/molecules/table/filters/SelectColumnFilter.tsx +0 -51
- package/src/molecules/table/filters/SliderColumnFilter.tsx +0 -28
- package/src/molecules/table/hooks/useCustomTable.tsx +0 -268
- package/src/molecules/table/hooks/useDragnDropRow.ts +0 -80
- package/src/molecules/table/hooks/useOperations.tsx +0 -39
- package/src/molecules/table/index.ts +0 -15
- package/src/molecules/table/utils/swapElements.spec.ts +0 -7
- package/src/molecules/table/utils/swapElements.ts +0 -7
- package/src/organisms/form/action/FormAction.stories.tsx +0 -364
- package/src/organisms/table/forms/components/FormCell.tsx +0 -47
- package/src/typings.d.ts +0 -3
- package/tsconfig.app.json +0 -11
- package/tsconfig.json +0 -21
- package/tsconfig.node.json +0 -13
- package/tsconfig.spec.json +0 -14
- /package/dist/molecules/{table → pagination}/utils/getPageNumbers.d.ts +0 -0
- /package/dist/molecules/{table → pagination}/utils/getPageNumbers.js +0 -0
- /package/dist/organisms/form/{action → actions}/FormAction.d.ts +0 -0
- /package/src/molecules/{table → pagination}/utils/getPageNumbers.ts +0 -0
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import "../../molecules/button/Button";
|
|
2
|
+
import "../../molecules/forms/input-text/InputText";
|
|
3
|
+
import "../../molecules/forms/select/all";
|
|
4
|
+
import "../../molecules/forms/form-control/FormControl";
|
|
5
|
+
import "../../molecules/pagination/all";
|
|
6
|
+
import "../../molecules/table/all";
|
|
7
|
+
import "../../molecules/tabs/all";
|
|
8
|
+
import "../../molecules/card/Card";
|
|
9
|
+
import "../form/builder/all";
|
|
10
|
+
import "../form/Form";
|
|
11
|
+
|
|
12
|
+
import { Meta, StoryObj } from "@storybook/react-vite";
|
|
13
|
+
|
|
14
|
+
import ActionsTableStory from "../table/actions/ActionsTable.stories.js";
|
|
15
|
+
import SubmissionsTableStory from "../table/submissions/SubmissionsTable.stories.js";
|
|
16
|
+
import { FormViews } from "./FormViews.js";
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* FormViews component displays a tabbed interface for managing forms with tabs for editing,
|
|
20
|
+
* viewing submissions, previewing, managing actions, controlling access, exporting, and configuring settings.
|
|
21
|
+
*
|
|
22
|
+
* ```tsx
|
|
23
|
+
* import { FormViews } from "@tsed/react-formio/organisms/views/FormViews";
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* ## Implementation
|
|
27
|
+
*
|
|
28
|
+
* ```tsx
|
|
29
|
+
* import type { FormType } from "../../interfaces/index.js";
|
|
30
|
+
* import type { Tab as DefaultTab } from "../../molecules/tabs/Tab.js";
|
|
31
|
+
* import type { TabList as DefaultTabList } from "../../molecules/tabs/TabList.js";
|
|
32
|
+
* import type { TabPanel as DefaultTabPanel } from "../../molecules/tabs/TabPanel.js";
|
|
33
|
+
* import type { Tabs as DefaultTabs } from "../../molecules/tabs/Tabs.js";
|
|
34
|
+
* import type { TabsBody as DefaultTabsBody } from "../../molecules/tabs/TabsBody.js";
|
|
35
|
+
* import { getComponent } from "../../registries/components.js";
|
|
36
|
+
* import { FormAccess, type FormAccessProps } from "../form/access/FormAccess.js";
|
|
37
|
+
* import { FormEdit, type FormEditProps } from "../form/builder/FormEdit.js";
|
|
38
|
+
* import { FormExport } from "../form/exports/FormExport.js";
|
|
39
|
+
* import { FormPreview } from "../form/preview/FormPreview.js";
|
|
40
|
+
* import { FormSettings } from "../form/settings/FormSettings.js";
|
|
41
|
+
* import { ActionsTable, type ActionsTableProps } from "../table/actions/ActionsTable.js";
|
|
42
|
+
* import { SubmissionsTable, type SubmissionsTableProps } from "../table/submissions/SubmissionsTable.js";
|
|
43
|
+
*
|
|
44
|
+
* export type FormViewsProps = {
|
|
45
|
+
* form: FormEditProps["form"];
|
|
46
|
+
* submissions: SubmissionsTableProps["data"];
|
|
47
|
+
* availableActions: ActionsTableProps["availableActions"];
|
|
48
|
+
* actions: ActionsTableProps["data"];
|
|
49
|
+
* roles?: FormAccessProps["roles"];
|
|
50
|
+
* i18n?: (key: string) => string;
|
|
51
|
+
* onAction: () => void;
|
|
52
|
+
* operations: SubmissionsTableProps["operations"];
|
|
53
|
+
* };
|
|
54
|
+
*
|
|
55
|
+
* export function FormViews({ form, roles, availableActions, actions, submissions, operations, i18n = (f) => f }: FormViewsProps) {
|
|
56
|
+
* const Tabs = getComponent<typeof DefaultTabs>("Tabs");
|
|
57
|
+
* const TabList = getComponent<typeof DefaultTabList>("TabList");
|
|
58
|
+
* const Tab = getComponent<typeof DefaultTab>("Tab");
|
|
59
|
+
* const TabsBody = getComponent<typeof DefaultTabsBody>("TabsBody");
|
|
60
|
+
* const TabPanel = getComponent<typeof DefaultTabPanel>("TabPanel");
|
|
61
|
+
*
|
|
62
|
+
* return (
|
|
63
|
+
* <Tabs>
|
|
64
|
+
* <TabList>
|
|
65
|
+
* <Tab value={0} icon='edit'>
|
|
66
|
+
* {i18n("Edit")}
|
|
67
|
+
* </Tab>
|
|
68
|
+
* <Tab value={1} icon='data'>
|
|
69
|
+
* {i18n("Data")}
|
|
70
|
+
* </Tab>
|
|
71
|
+
* <Tab value={2} icon='test-tube'>
|
|
72
|
+
* {i18n("Preview")}
|
|
73
|
+
* </Tab>
|
|
74
|
+
* <Tab value={3} icon='paper-plane'>
|
|
75
|
+
* {i18n("Actions")}
|
|
76
|
+
* </Tab>
|
|
77
|
+
* <Tab value={4} icon='lock'>
|
|
78
|
+
* {i18n("Access")}
|
|
79
|
+
* </Tab>
|
|
80
|
+
* <Tab value={5} icon='download'>
|
|
81
|
+
* {i18n("Export")}
|
|
82
|
+
* </Tab>
|
|
83
|
+
* <Tab value={6} icon='cog'>
|
|
84
|
+
* {i18n("Settings")}
|
|
85
|
+
* </Tab>
|
|
86
|
+
* </TabList>
|
|
87
|
+
* <TabsBody>
|
|
88
|
+
* <TabPanel value={0} className='p-3 border-l-1 border-b-1 border-r-1 border-gray-300'>
|
|
89
|
+
* <FormEdit form={form} options={{ i18n }} />
|
|
90
|
+
* </TabPanel>
|
|
91
|
+
* <TabPanel value={1}>
|
|
92
|
+
* <SubmissionsTable className={"border-top-0"} form={form as FormType} data={submissions} i18n={i18n} operations={operations} />
|
|
93
|
+
* </TabPanel>
|
|
94
|
+
* <TabPanel value={2}>
|
|
95
|
+
* <FormPreview form={form as FormType} i18n={i18n} />
|
|
96
|
+
* </TabPanel>
|
|
97
|
+
* <TabPanel value={3}>
|
|
98
|
+
* <ActionsTable className={"border-top-0"} availableActions={availableActions} data={actions} operations={[]} i18n={i18n} />
|
|
99
|
+
* </TabPanel>
|
|
100
|
+
* <TabPanel value={4} className='pt-3'>
|
|
101
|
+
* <FormAccess form={form as FormType} roles={roles} options={{ i18n }} />
|
|
102
|
+
* </TabPanel>
|
|
103
|
+
* <TabPanel value={5} className='pt-3'>
|
|
104
|
+
* <FormExport i18n={i18n} />
|
|
105
|
+
* </TabPanel>
|
|
106
|
+
* <TabPanel value={6} className='p-3 border-l-1 border-b-1 border-r-1 border-gray-300'>
|
|
107
|
+
* <FormSettings form={form as FormType} options={{}} />
|
|
108
|
+
* </TabPanel>
|
|
109
|
+
* </TabsBody>
|
|
110
|
+
* </Tabs>
|
|
111
|
+
* );
|
|
112
|
+
* }
|
|
113
|
+
* ```
|
|
114
|
+
*/
|
|
115
|
+
export default {
|
|
116
|
+
title: "views/FormViews",
|
|
117
|
+
component: FormViews,
|
|
118
|
+
argTypes: {
|
|
119
|
+
form: {
|
|
120
|
+
description: "The form object to manage",
|
|
121
|
+
control: "object"
|
|
122
|
+
},
|
|
123
|
+
submissions: {
|
|
124
|
+
description: "Submission data to display in the Data tab",
|
|
125
|
+
control: "object"
|
|
126
|
+
},
|
|
127
|
+
// operations: {
|
|
128
|
+
// description: "Operations available for submissions",
|
|
129
|
+
// control: "object"
|
|
130
|
+
// },
|
|
131
|
+
roles: {
|
|
132
|
+
description: "Roles for access control",
|
|
133
|
+
control: "object"
|
|
134
|
+
},
|
|
135
|
+
i18n: {
|
|
136
|
+
description: "Internationalization function"
|
|
137
|
+
},
|
|
138
|
+
onAction: {
|
|
139
|
+
action: "onAction",
|
|
140
|
+
description: "Callback when an action is triggered"
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
parameters: {
|
|
144
|
+
docs: {
|
|
145
|
+
description: {
|
|
146
|
+
component:
|
|
147
|
+
"Component that displays a tabbed interface for managing forms with tabs for editing, viewing submissions, previewing, managing actions, controlling access, exporting, and configuring settings."
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
} satisfies Meta<typeof FormViews>;
|
|
152
|
+
|
|
153
|
+
type Story = StoryObj<typeof FormViews>;
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Basic form view with a simple form
|
|
157
|
+
*/
|
|
158
|
+
export const Usage: Story = {
|
|
159
|
+
args: {
|
|
160
|
+
form: SubmissionsTableStory.args.form as any,
|
|
161
|
+
submissions: SubmissionsTableStory.args.data as any,
|
|
162
|
+
// operations: SubmissionsTableStory.args.operations,
|
|
163
|
+
actions: ActionsTableStory.args.data as any,
|
|
164
|
+
roles: [
|
|
165
|
+
{
|
|
166
|
+
_id: "1",
|
|
167
|
+
title: "Administrator"
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
_id: "2",
|
|
171
|
+
title: "Authenticated"
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
_id: "3",
|
|
175
|
+
title: "Anonymous"
|
|
176
|
+
}
|
|
177
|
+
],
|
|
178
|
+
i18n: {},
|
|
179
|
+
onAction: () => console.log("Action triggered")
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Form view with translated labels
|
|
185
|
+
*/
|
|
186
|
+
export const Translated: Story = {
|
|
187
|
+
args: {
|
|
188
|
+
form: SubmissionsTableStory.args.form as any,
|
|
189
|
+
submissions: SubmissionsTableStory.args.data as any,
|
|
190
|
+
// operations: SubmissionsTableStory.args.operations,
|
|
191
|
+
actions: ActionsTableStory.args.data as any,
|
|
192
|
+
roles: [
|
|
193
|
+
{
|
|
194
|
+
_id: "1",
|
|
195
|
+
title: "Administrator"
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
_id: "2",
|
|
199
|
+
title: "Authenticated"
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
_id: "3",
|
|
203
|
+
title: "Anonymous"
|
|
204
|
+
}
|
|
205
|
+
],
|
|
206
|
+
i18n: {
|
|
207
|
+
Edit: "Éditer",
|
|
208
|
+
Data: "Données",
|
|
209
|
+
Preview: "Aperçu",
|
|
210
|
+
Actions: "Actions",
|
|
211
|
+
Access: "Accès",
|
|
212
|
+
Export: "Exporter",
|
|
213
|
+
Settings: "Paramètres",
|
|
214
|
+
"Form with First Name": "Formulaire avec prénom",
|
|
215
|
+
"First name": "Prénom",
|
|
216
|
+
"Last name": "Nom de famille",
|
|
217
|
+
Submit: "Soumettre"
|
|
218
|
+
},
|
|
219
|
+
onAction: () => console.log("Action triggered")
|
|
220
|
+
}
|
|
221
|
+
};
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { useI18n } from "../../hooks/useI18n.js";
|
|
2
|
+
import type { FormOptions, FormType, JSON, PermissionsResolver } from "../../interfaces/index.js";
|
|
3
|
+
import type { Tab as DefaultTab } from "../../molecules/tabs/Tab.js";
|
|
4
|
+
import type { TabList as DefaultTabList } from "../../molecules/tabs/TabList.js";
|
|
5
|
+
import type { TabPanel as DefaultTabPanel } from "../../molecules/tabs/TabPanel.js";
|
|
6
|
+
import type { Tabs as DefaultTabs } from "../../molecules/tabs/Tabs.js";
|
|
7
|
+
import type { TabsBody as DefaultTabsBody } from "../../molecules/tabs/TabsBody.js";
|
|
8
|
+
import { getComponent } from "../../registries/components.js";
|
|
9
|
+
import { FormAccess, type FormAccessProps } from "../form/access/FormAccess.js";
|
|
10
|
+
import { FormEdit, type FormEditProps } from "../form/builder/FormEdit.js";
|
|
11
|
+
import { FormExport } from "../form/exports/FormExport.js";
|
|
12
|
+
import { FormPreview } from "../form/preview/FormPreview.js";
|
|
13
|
+
import { FormSettings } from "../form/settings/FormSettings.js";
|
|
14
|
+
import { ActionsTable, type ActionsTableProps } from "../table/actions/ActionsTable.js";
|
|
15
|
+
import { SubmissionsTable, type SubmissionsTableProps } from "../table/submissions/SubmissionsTable.js";
|
|
16
|
+
|
|
17
|
+
export type FormViewsProps<Data extends { [key: string]: JSON } = { [key: string]: JSON }> = {
|
|
18
|
+
form: FormEditProps["form"];
|
|
19
|
+
submissions: SubmissionsTableProps<Data>["data"];
|
|
20
|
+
availableActions: ActionsTableProps["availableActions"];
|
|
21
|
+
actions: ActionsTableProps["data"];
|
|
22
|
+
roles?: FormAccessProps["roles"];
|
|
23
|
+
i18n?: FormOptions["i18n"];
|
|
24
|
+
onAction: () => void;
|
|
25
|
+
permissionsResolver?: PermissionsResolver<Data>;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
function useSubmissionsOperations<Data extends { [key: string]: JSON } = { [key: string]: JSON }>(
|
|
29
|
+
permissionsResolver?: PermissionsResolver<Data>
|
|
30
|
+
) {
|
|
31
|
+
return [
|
|
32
|
+
{
|
|
33
|
+
title: "Edit",
|
|
34
|
+
action: "submission:edit",
|
|
35
|
+
alias: "row",
|
|
36
|
+
icon: "edit",
|
|
37
|
+
permissionsResolver
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
action: "submission:delete",
|
|
41
|
+
icon: "trash",
|
|
42
|
+
buttonType: "danger",
|
|
43
|
+
permissionsResolver
|
|
44
|
+
}
|
|
45
|
+
] as SubmissionsTableProps<Data>["operations"];
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function useActionsOperations<Data extends { [key: string]: JSON } = { [key: string]: JSON }>(
|
|
49
|
+
permissionsResolver?: PermissionsResolver<Data>
|
|
50
|
+
) {
|
|
51
|
+
return [
|
|
52
|
+
{
|
|
53
|
+
title: "Edit",
|
|
54
|
+
action: "action:edit",
|
|
55
|
+
alias: "row",
|
|
56
|
+
icon: "edit",
|
|
57
|
+
permissionsResolver
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
action: "action:delete",
|
|
61
|
+
icon: "trash",
|
|
62
|
+
buttonType: "danger",
|
|
63
|
+
permissionsResolver
|
|
64
|
+
}
|
|
65
|
+
] as SubmissionsTableProps<Data>["operations"];
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export function FormViews<Data extends { [key: string]: JSON } = { [key: string]: JSON }>({
|
|
69
|
+
form,
|
|
70
|
+
roles,
|
|
71
|
+
availableActions,
|
|
72
|
+
actions,
|
|
73
|
+
permissionsResolver,
|
|
74
|
+
submissions,
|
|
75
|
+
...props
|
|
76
|
+
}: FormViewsProps<Data>) {
|
|
77
|
+
const { t } = useI18n(props.i18n);
|
|
78
|
+
const Tabs = getComponent<typeof DefaultTabs>("Tabs");
|
|
79
|
+
const TabList = getComponent<typeof DefaultTabList>("TabList");
|
|
80
|
+
const Tab = getComponent<typeof DefaultTab>("Tab");
|
|
81
|
+
const TabsBody = getComponent<typeof DefaultTabsBody>("TabsBody");
|
|
82
|
+
const TabPanel = getComponent<typeof DefaultTabPanel>("TabPanel");
|
|
83
|
+
const submissionsOperations = useSubmissionsOperations<Data>(permissionsResolver);
|
|
84
|
+
const actionsOperations = useActionsOperations<any>(permissionsResolver);
|
|
85
|
+
|
|
86
|
+
return (
|
|
87
|
+
<Tabs>
|
|
88
|
+
<TabList>
|
|
89
|
+
<Tab value={0} icon='edit'>
|
|
90
|
+
{t("Edit")}
|
|
91
|
+
</Tab>
|
|
92
|
+
<Tab value={1} icon='data'>
|
|
93
|
+
{t("Data")}
|
|
94
|
+
</Tab>
|
|
95
|
+
<Tab value={2} icon='test-tube'>
|
|
96
|
+
{t("Preview")}
|
|
97
|
+
</Tab>
|
|
98
|
+
<Tab value={3} icon='paper-plane'>
|
|
99
|
+
{t("Actions")}
|
|
100
|
+
</Tab>
|
|
101
|
+
<Tab value={4} icon='lock'>
|
|
102
|
+
{t("Access")}
|
|
103
|
+
</Tab>
|
|
104
|
+
<Tab value={5} icon='download'>
|
|
105
|
+
{t("Export")}
|
|
106
|
+
</Tab>
|
|
107
|
+
<Tab value={6} icon='cog'>
|
|
108
|
+
{t("Settings")}
|
|
109
|
+
</Tab>
|
|
110
|
+
</TabList>
|
|
111
|
+
<TabsBody>
|
|
112
|
+
<TabPanel value={0} className='p-3 border-l-1 border-b-1 border-r-1 border-gray-300'>
|
|
113
|
+
<FormEdit form={form} />
|
|
114
|
+
</TabPanel>
|
|
115
|
+
<TabPanel value={1}>
|
|
116
|
+
<SubmissionsTable<Data>
|
|
117
|
+
className={"border-top-0"}
|
|
118
|
+
form={form as FormType}
|
|
119
|
+
data={submissions}
|
|
120
|
+
i18n={props.i18n}
|
|
121
|
+
operations={submissionsOperations}
|
|
122
|
+
/>
|
|
123
|
+
</TabPanel>
|
|
124
|
+
<TabPanel value={2}>
|
|
125
|
+
<FormPreview form={form as FormType} i18n={props.i18n} />
|
|
126
|
+
</TabPanel>
|
|
127
|
+
<TabPanel value={3}>
|
|
128
|
+
<ActionsTable
|
|
129
|
+
className={"border-top-0"}
|
|
130
|
+
availableActions={availableActions}
|
|
131
|
+
data={actions}
|
|
132
|
+
operations={actionsOperations as any}
|
|
133
|
+
i18n={props.i18n}
|
|
134
|
+
/>
|
|
135
|
+
</TabPanel>
|
|
136
|
+
<TabPanel value={4} className='pt-3'>
|
|
137
|
+
<FormAccess form={form as FormType} roles={roles} options={props} />
|
|
138
|
+
</TabPanel>
|
|
139
|
+
<TabPanel value={5} className='pt-3'>
|
|
140
|
+
<FormExport i18n={props.i18n} />
|
|
141
|
+
</TabPanel>
|
|
142
|
+
<TabPanel value={6} className='p-3 border-l-1 border-b-1 border-r-1 border-gray-300'>
|
|
143
|
+
<FormSettings form={form as FormType} options={{}} />
|
|
144
|
+
</TabPanel>
|
|
145
|
+
</TabsBody>
|
|
146
|
+
</Tabs>
|
|
147
|
+
);
|
|
148
|
+
}
|
|
@@ -13,5 +13,11 @@ export function getComponent<Cmp>(type: string | string[]): Cmp {
|
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
|
|
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;
|
|
17
23
|
}
|
package/src/utils/iconClass.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
const { Templates } = formio;
|
|
1
|
+
import { Templates } from "@formio/js";
|
|
4
2
|
|
|
5
3
|
export function iconClass(iconset: string | undefined, name: string, spinning?: boolean): string {
|
|
6
4
|
return Templates.current.iconClass(iconset || Templates.current.defaultIconset, name, spinning);
|
package/vite.config.mts
CHANGED
|
@@ -6,16 +6,16 @@ import {extname, relative} from "path";
|
|
|
6
6
|
import preserveDirectives from "rollup-preserve-directives";
|
|
7
7
|
import {defineConfig} from "vite";
|
|
8
8
|
import dts from "vite-plugin-dts";
|
|
9
|
-
import {resolve} from "node:path";
|
|
10
9
|
|
|
11
10
|
import pkg from "./package.json" with {type: "json"};
|
|
11
|
+
import {resolve} from "node:path";
|
|
12
12
|
|
|
13
13
|
// https://vitejs.dev/config/
|
|
14
14
|
export default defineConfig({
|
|
15
15
|
plugins: [
|
|
16
16
|
react(),
|
|
17
17
|
dts({
|
|
18
|
-
tsconfigPath: "
|
|
18
|
+
tsconfigPath: "../../tsconfig.app.json",
|
|
19
19
|
aliasesExclude: [],
|
|
20
20
|
include: ["src/**/*.{ts,tsx}"],
|
|
21
21
|
exclude: ["**/*.spec.{ts,tsx}", "**/*.stories.{ts,tsx}", "**/__*__/**"]
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Select.interfaces.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { jsx as a, Fragment as s } from "react/jsx-runtime";
|
|
2
|
-
import { createElement as o } from "react";
|
|
3
|
-
function c({ row: n }) {
|
|
4
|
-
return /* @__PURE__ */ a(s, { children: n.cells.map((e, t) => {
|
|
5
|
-
const { hidden: l, colspan: r } = e.column;
|
|
6
|
-
return l ? null : /* @__PURE__ */ o(
|
|
7
|
-
"td",
|
|
8
|
-
{
|
|
9
|
-
colSpan: r,
|
|
10
|
-
...e.getCellProps({
|
|
11
|
-
className: e.column.className,
|
|
12
|
-
style: e.column.style
|
|
13
|
-
}),
|
|
14
|
-
key: `tableInstance.page.cells.${e.value || "value"}.${t}`
|
|
15
|
-
},
|
|
16
|
-
e.render("Cell")
|
|
17
|
-
);
|
|
18
|
-
}) });
|
|
19
|
-
}
|
|
20
|
-
export {
|
|
21
|
-
c as DefaultCells
|
|
22
|
-
};
|
|
23
|
-
//# sourceMappingURL=DefaultCells.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultCells.js","sources":["../../../../src/molecules/table/components/DefaultCells.tsx"],"sourcesContent":["import { Row } from \"react-table\";\n\nimport type { ExtendedCell } from \"../hooks/useCustomTable\";\n\nexport function DefaultCells<Data extends object = {}>({ row }: { row: Row<Data> }) {\n return (\n <>\n {row.cells.map((cell: ExtendedCell<Data>, i) => {\n const { hidden, colspan } = cell.column;\n\n if (hidden) {\n return null;\n }\n\n return (\n <td\n colSpan={colspan}\n {...cell.getCellProps({\n className: cell.column.className,\n style: cell.column.style\n })}\n key={`tableInstance.page.cells.${cell.value || \"value\"}.${i}`}\n >\n {cell.render(\"Cell\") as any}\n </td>\n );\n })}\n </>\n );\n}\n"],"names":["DefaultCells","row","cell","i","hidden","colspan","createElement"],"mappings":";;AAIgB,SAAAA,EAAuC,EAAE,KAAAC,KAA2B;AAClF,gCAEK,UAAIA,EAAA,MAAM,IAAI,CAACC,GAA0BC,MAAM;AAC9C,UAAM,EAAE,QAAAC,GAAQ,SAAAC,EAAQ,IAAIH,EAAK;AAEjC,WAAIE,IACK,OAIP,gBAAAE;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,SAASD;AAAA,QACR,GAAGH,EAAK,aAAa;AAAA,UACpB,WAAWA,EAAK,OAAO;AAAA,UACvB,OAAOA,EAAK,OAAO;AAAA,QAAA,CACpB;AAAA,QACD,KAAK,4BAA4BA,EAAK,SAAS,OAAO,IAAIC,CAAC;AAAA,MAAA;AAAA,MAE1DD,EAAK,OAAO,MAAM;AAAA,IACrB;AAAA,EAEH,CAAA,GACH;AAEJ;"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { DetailedHTMLProps, HTMLAttributes } from 'react';
|
|
2
|
-
import { Row } from 'react-table';
|
|
3
|
-
export interface DefaultRowProps<Data extends object = {}> extends Omit<DetailedHTMLProps<HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>, "onClick" | "onDrag" | "onDrop"> {
|
|
4
|
-
onClick: (data: any, action: string) => void;
|
|
5
|
-
row: Row<Data>;
|
|
6
|
-
index: number;
|
|
7
|
-
onDrop: (item: Data) => void;
|
|
8
|
-
onDrag: (index: number, hoverIndex: number) => void;
|
|
9
|
-
enableDragNDrop?: boolean;
|
|
10
|
-
}
|
|
11
|
-
export declare function DefaultDndRow<Data extends object = {}>(props: DefaultRowProps<Data>): import("react/jsx-runtime").JSX.Element;
|
|
12
|
-
export declare function DefaultRow<Data extends object = {}>({ onClick, row, enableDragNDrop, onDrop, onDrag, ...props }: DefaultRowProps<Data>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { jsxs as c, jsx as r } from "react/jsx-runtime";
|
|
2
|
-
import { c as m } from "../../../chunks/index.js";
|
|
3
|
-
import f from "lodash/omit";
|
|
4
|
-
import { iconClass as d } from "../../../utils/iconClass.js";
|
|
5
|
-
import { useDndRow as u } from "../hooks/useDragnDropRow.js";
|
|
6
|
-
import { DefaultCells as n } from "./DefaultCells.js";
|
|
7
|
-
function g(t) {
|
|
8
|
-
const { isDragging: e, dragRef: o, dropRef: i, opacity: s } = u(t);
|
|
9
|
-
return /* @__PURE__ */ c("tr", { ref: i, style: { opacity: s }, children: [
|
|
10
|
-
/* @__PURE__ */ r("td", { ref: o, role: "cell", style: { cursor: e ? "grabbing" : "grab" }, className: "align-middle", children: /* @__PURE__ */ r("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ r("i", { className: m(d(void 0, "dots-vertical-rounded")) }) }) }),
|
|
11
|
-
/* @__PURE__ */ r(n, { ...t })
|
|
12
|
-
] });
|
|
13
|
-
}
|
|
14
|
-
function b({ onClick: t, row: e, enableDragNDrop: o, onDrop: i, onDrag: s, ...a }) {
|
|
15
|
-
const l = {
|
|
16
|
-
...a,
|
|
17
|
-
onClick: () => t(e.original, "row"),
|
|
18
|
-
...e.getRowProps()
|
|
19
|
-
};
|
|
20
|
-
return o ? /* @__PURE__ */ r(g, { ...l, row: e, onDrag: s, onDrop: i }) : /* @__PURE__ */ r("tr", { ...f(l, ["key"]), children: /* @__PURE__ */ r(n, { row: e }) });
|
|
21
|
-
}
|
|
22
|
-
export {
|
|
23
|
-
g as DefaultDndRow,
|
|
24
|
-
b as DefaultRow
|
|
25
|
-
};
|
|
26
|
-
//# sourceMappingURL=DefaultRow.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultRow.js","sources":["../../../../src/molecules/table/components/DefaultRow.tsx"],"sourcesContent":["import classnames from \"classnames\";\nimport omit from \"lodash/omit\";\nimport { DetailedHTMLProps, HTMLAttributes } from \"react\";\nimport { Row } from \"react-table\";\n\nimport { iconClass } from \"../../../utils/iconClass\";\nimport { useDndRow } from \"../hooks/useDragnDropRow\";\nimport { DefaultCells } from \"./DefaultCells\";\n\nexport interface DefaultRowProps<Data extends object = {}>\n extends Omit<DetailedHTMLProps<HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>, \"onClick\" | \"onDrag\" | \"onDrop\"> {\n onClick: (data: any, action: string) => void;\n row: Row<Data>;\n index: number;\n onDrop: (item: Data) => void;\n onDrag: (index: number, hoverIndex: number) => void;\n enableDragNDrop?: boolean;\n}\n\nexport function DefaultDndRow<Data extends object = {}>(props: DefaultRowProps<Data>) {\n const { isDragging, dragRef, dropRef, opacity } = useDndRow(props);\n\n return (\n <tr ref={dropRef} style={{ opacity }}>\n {/* eslint-disable-next-line jsx-a11y/no-interactive-element-to-noninteractive-role */}\n <td ref={dragRef} role='cell' style={{ cursor: isDragging ? \"grabbing\" : \"grab\" }} className='align-middle'>\n <div className='flex items-center justify-center'>\n <i className={classnames(iconClass(undefined, \"dots-vertical-rounded\"))} />\n </div>\n </td>\n <DefaultCells<Data> {...props} />\n </tr>\n );\n}\n\nexport function DefaultRow<Data extends object = {}>({ onClick, row, enableDragNDrop, onDrop, onDrag, ...props }: DefaultRowProps<Data>) {\n const opts = {\n ...props,\n onClick: () => onClick(row.original, \"row\"),\n ...row.getRowProps()\n };\n\n if (enableDragNDrop) {\n return <DefaultDndRow<Data> {...opts} row={row} onDrag={onDrag} onDrop={onDrop} />;\n }\n\n return (\n <tr {...omit(opts, [\"key\"])}>\n <DefaultCells<Data> row={row} />\n </tr>\n );\n}\n"],"names":["DefaultDndRow","props","isDragging","dragRef","dropRef","opacity","useDndRow","jsx","classnames","iconClass","DefaultCells","DefaultRow","onClick","row","enableDragNDrop","onDrop","onDrag","opts","omit"],"mappings":";;;;;;AAmBO,SAASA,EAAwCC,GAA8B;AACpF,QAAM,EAAE,YAAAC,GAAY,SAAAC,GAAS,SAAAC,GAAS,SAAAC,EAAQ,IAAIC,EAAUL,CAAK;AAEjE,2BACG,MAAG,EAAA,KAAKG,GAAS,OAAO,EAAE,SAAAC,EAEzB,GAAA,UAAA;AAAA,IAAA,gBAAAE,EAAC,MAAG,EAAA,KAAKJ,GAAS,MAAK,QAAO,OAAO,EAAE,QAAQD,IAAa,aAAa,OAAO,GAAG,WAAU,gBAC3F,UAAC,gBAAAK,EAAA,OAAA,EAAI,WAAU,oCACb,UAAC,gBAAAA,EAAA,KAAA,EAAE,WAAWC,EAAWC,EAAU,QAAW,uBAAuB,CAAC,EAAG,CAAA,EAC3E,CAAA,GACF;AAAA,IACA,gBAAAF,EAACG,GAAoB,EAAA,GAAGT,EAAO,CAAA;AAAA,EAAA,GACjC;AAEJ;AAEgB,SAAAU,EAAqC,EAAE,SAAAC,GAAS,KAAAC,GAAK,iBAAAC,GAAiB,QAAAC,GAAQ,QAAAC,GAAQ,GAAGf,KAAgC;AACvI,QAAMgB,IAAO;AAAA,IACX,GAAGhB;AAAA,IACH,SAAS,MAAMW,EAAQC,EAAI,UAAU,KAAK;AAAA,IAC1C,GAAGA,EAAI,YAAY;AAAA,EACrB;AAEA,SAAIC,sBACMd,GAAqB,EAAA,GAAGiB,GAAM,KAAAJ,GAAU,QAAAG,GAAgB,QAAAD,GAAgB,IAI/E,gBAAAR,EAAA,MAAA,EAAI,GAAGW,EAAKD,GAAM,CAAC,KAAK,CAAC,GACxB,UAAA,gBAAAV,EAACG,GAAmB,EAAA,KAAAG,EAAA,CAAU,EAChC,CAAA;AAEJ;"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { jsx as o, Fragment as t } from "react/jsx-runtime";
|
|
2
|
-
import { DndProvider as m } from "react-dnd";
|
|
3
|
-
import { HTML5Backend as e } from "react-dnd-html5-backend";
|
|
4
|
-
function f({ enableDragNDrop: n, children: r }) {
|
|
5
|
-
return n ? /* @__PURE__ */ o(m, { backend: e, children: r }) : /* @__PURE__ */ o(t, { children: r });
|
|
6
|
-
}
|
|
7
|
-
export {
|
|
8
|
-
f as DrapNDropContainer
|
|
9
|
-
};
|
|
10
|
-
//# sourceMappingURL=DragNDropContainer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DragNDropContainer.js","sources":["../../../../src/molecules/table/components/DragNDropContainer.tsx"],"sourcesContent":["import { PropsWithChildren } from \"react\";\nimport { DndProvider } from \"react-dnd\";\nimport { HTML5Backend } from \"react-dnd-html5-backend\";\n\nexport function DrapNDropContainer({ enableDragNDrop, children }: PropsWithChildren<{ enableDragNDrop?: boolean }>) {\n return enableDragNDrop ? <DndProvider backend={HTML5Backend}>{children}</DndProvider> : <>{children}</>;\n}\n"],"names":["DrapNDropContainer","enableDragNDrop","children","DndProvider","HTML5Backend"],"mappings":";;;AAIO,SAASA,EAAmB,EAAE,iBAAAC,GAAiB,UAAAC,KAA8D;AAC3G,SAAAD,sBAAmBE,GAAY,EAAA,SAASC,GAAe,UAAAF,EAAS,CAAA,2BAAoB,UAAAA,EAAS,CAAA;AACtG;"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { FilterProps } from 'react-table';
|
|
2
|
-
export declare function DefaultColumnFilter<D extends Record<string, unknown> = {}>(props: FilterProps<D> & {
|
|
3
|
-
filterId: string;
|
|
4
|
-
setFilterId: any;
|
|
5
|
-
column: {
|
|
6
|
-
id: string;
|
|
7
|
-
filterValue: any;
|
|
8
|
-
setFilter: any;
|
|
9
|
-
};
|
|
10
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
-
import { useState as u } from "react";
|
|
3
|
-
import { InputText as c } from "../../forms/input-text/InputText.js";
|
|
4
|
-
function h(o) {
|
|
5
|
-
const {
|
|
6
|
-
filterId: r,
|
|
7
|
-
setFilterId: l,
|
|
8
|
-
column: { id: e, filterValue: i, setFilter: n }
|
|
9
|
-
} = o, [a, m] = u(i || "");
|
|
10
|
-
return /* @__PURE__ */ s(
|
|
11
|
-
c,
|
|
12
|
-
{
|
|
13
|
-
size: "small",
|
|
14
|
-
id: e,
|
|
15
|
-
name: e,
|
|
16
|
-
autoFocus: e === r,
|
|
17
|
-
value: a,
|
|
18
|
-
onChange: (f, t) => {
|
|
19
|
-
m(t), l(e), n(t || void 0);
|
|
20
|
-
},
|
|
21
|
-
placeholder: "Search records..."
|
|
22
|
-
},
|
|
23
|
-
e
|
|
24
|
-
);
|
|
25
|
-
}
|
|
26
|
-
export {
|
|
27
|
-
h as DefaultColumnFilter
|
|
28
|
-
};
|
|
29
|
-
//# sourceMappingURL=DefaultColumnFilter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultColumnFilter.js","sources":["../../../../src/molecules/table/filters/DefaultColumnFilter.tsx"],"sourcesContent":["import { useState } from \"react\";\nimport { FilterProps } from \"react-table\";\n\nimport { InputText } from \"../../../molecules/forms/input-text/InputText\";\n\nexport function DefaultColumnFilter<D extends Record<string, unknown> = {}>(\n props: FilterProps<D> & {\n filterId: string;\n setFilterId: any;\n column: { id: string; filterValue: any; setFilter: any };\n }\n) {\n const {\n filterId,\n setFilterId,\n column: { id, filterValue, setFilter }\n } = props;\n\n const [value, setValue] = useState(filterValue || \"\");\n\n /* eslint-disable jsx-a11y/no-autofocus */\n return (\n <InputText\n size={\"small\"}\n id={id}\n name={id}\n key={id}\n autoFocus={id === filterId}\n value={value}\n onChange={(name: string, value: any) => {\n setValue(value);\n setFilterId(id);\n setFilter(value || undefined);\n }}\n placeholder={\"Search records...\"}\n />\n );\n}\n"],"names":["DefaultColumnFilter","props","filterId","setFilterId","id","filterValue","setFilter","value","setValue","useState","jsx","InputText","name"],"mappings":";;;AAKO,SAASA,EACdC,GAKA;AACM,QAAA;AAAA,IACJ,UAAAC;AAAA,IACA,aAAAC;AAAA,IACA,QAAQ,EAAE,IAAAC,GAAI,aAAAC,GAAa,WAAAC,EAAU;AAAA,EAAA,IACnCL,GAEE,CAACM,GAAOC,CAAQ,IAAIC,EAASJ,KAAe,EAAE;AAIlD,SAAA,gBAAAK;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,MAAM;AAAA,MACN,IAAAP;AAAA,MACA,MAAMA;AAAA,MAEN,WAAWA,MAAOF;AAAA,MAClB,OAAAK;AAAA,MACA,UAAU,CAACK,GAAcL,MAAe;AACtC,QAAAC,EAASD,CAAK,GACdJ,EAAYC,CAAE,GACdE,EAAUC,KAAS,MAAS;AAAA,MAC9B;AAAA,MACA,aAAa;AAAA,IAAA;AAAA,IARRH;AAAA,EASP;AAEJ;"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { FilterProps } from 'react-table';
|
|
2
|
-
export declare function useSelectColumnFilter<D extends Record<string, unknown> = {}>(props: FilterProps<D>): {
|
|
3
|
-
value: any;
|
|
4
|
-
onChange: (_: string, value: any) => void;
|
|
5
|
-
options: {
|
|
6
|
-
value: string;
|
|
7
|
-
label: string;
|
|
8
|
-
}[];
|
|
9
|
-
};
|
|
10
|
-
export declare function SelectColumnFilter<D extends Record<string, unknown> = {}>(props: FilterProps<D>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
-
import { Select as m } from "../../forms/select/Select.js";
|
|
3
|
-
function f(t) {
|
|
4
|
-
const { column: n } = t, { id: l, preFilteredRows: i } = n, { choices: o } = n, { filterValue: c, setFilter: r } = n, u = o ? typeof o == "function" ? o(t) : o : [...new Set(i.map((e) => e.values[l]))].filter((e) => e).map((e) => ({
|
|
5
|
-
label: e,
|
|
6
|
-
value: e
|
|
7
|
-
}));
|
|
8
|
-
return {
|
|
9
|
-
value: c,
|
|
10
|
-
onChange: (e, s) => {
|
|
11
|
-
r(s || void 0);
|
|
12
|
-
},
|
|
13
|
-
options: [{ value: "", label: "All" }].concat(u)
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
function v(t) {
|
|
17
|
-
const { value: n, options: l, onChange: i } = f(t);
|
|
18
|
-
return /* @__PURE__ */ a(
|
|
19
|
-
m,
|
|
20
|
-
{
|
|
21
|
-
name: `filter-${t.column.id}`,
|
|
22
|
-
size: "small",
|
|
23
|
-
value: n,
|
|
24
|
-
options: l,
|
|
25
|
-
onChange: i
|
|
26
|
-
},
|
|
27
|
-
`filter-${t.column.id}`
|
|
28
|
-
);
|
|
29
|
-
}
|
|
30
|
-
export {
|
|
31
|
-
v as SelectColumnFilter,
|
|
32
|
-
f as useSelectColumnFilter
|
|
33
|
-
};
|
|
34
|
-
//# sourceMappingURL=SelectColumnFilter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SelectColumnFilter.js","sources":["../../../../src/molecules/table/filters/SelectColumnFilter.tsx"],"sourcesContent":["import { FilterProps } from \"react-table\";\n\nimport { Select } from \"../../../molecules/forms/select/Select\";\n\nexport function useSelectColumnFilter<D extends Record<string, unknown> = {}>(props: FilterProps<D>) {\n const { column } = props;\n const { id, preFilteredRows } = column as any;\n const { choices: customChoices } = column as any;\n const { filterValue, setFilter } = column as any;\n\n const choices = (() => {\n if (customChoices) {\n if (typeof customChoices === \"function\") {\n return customChoices(props);\n }\n return customChoices;\n }\n\n return [...new Set(preFilteredRows.map((row: any) => row.values[id]))]\n .filter((value) => value)\n .map((value) => ({\n label: value,\n value\n }));\n })();\n\n const onChange = (_: string, value: any) => {\n setFilter(value || undefined);\n };\n\n return {\n value: filterValue,\n onChange,\n options: [{ value: \"\", label: \"All\" }].concat(choices)\n };\n}\n\nexport function SelectColumnFilter<D extends Record<string, unknown> = {}>(props: FilterProps<D>) {\n const { value, options, onChange } = useSelectColumnFilter(props);\n\n return (\n <Select\n key={`filter-${props.column.id}`}\n name={`filter-${props.column.id}`}\n size={\"small\"}\n value={value}\n options={options}\n onChange={onChange}\n />\n );\n}\n"],"names":["useSelectColumnFilter","props","column","id","preFilteredRows","customChoices","filterValue","setFilter","choices","row","value","_","SelectColumnFilter","options","onChange","jsx","Select"],"mappings":";;AAIO,SAASA,EAA8DC,GAAuB;AAC7F,QAAA,EAAE,QAAAC,MAAWD,GACb,EAAE,IAAAE,GAAI,iBAAAC,EAAA,IAAoBF,GAC1B,EAAE,SAASG,EAAA,IAAkBH,GAC7B,EAAE,aAAAI,GAAa,WAAAC,EAAA,IAAcL,GAE7BM,IACAH,IACE,OAAOA,KAAkB,aACpBA,EAAcJ,CAAK,IAErBI,IAGF,CAAC,GAAG,IAAI,IAAID,EAAgB,IAAI,CAACK,MAAaA,EAAI,OAAON,CAAE,CAAC,CAAC,CAAC,EAClE,OAAO,CAACO,MAAUA,CAAK,EACvB,IAAI,CAACA,OAAW;AAAA,IACf,OAAOA;AAAA,IACP,OAAAA;AAAA,EAAA,EACA;AAOC,SAAA;AAAA,IACL,OAAOJ;AAAA,IACP,UANe,CAACK,GAAWD,MAAe;AAC1C,MAAAH,EAAUG,KAAS,MAAS;AAAA,IAC9B;AAAA,IAKE,SAAS,CAAC,EAAE,OAAO,IAAI,OAAO,MAAO,CAAA,EAAE,OAAOF,CAAO;AAAA,EACvD;AACF;AAEO,SAASI,EAA2DX,GAAuB;AAChG,QAAM,EAAE,OAAAS,GAAO,SAAAG,GAAS,UAAAC,EAAS,IAAId,EAAsBC,CAAK;AAG9D,SAAA,gBAAAc;AAAA,IAACC;AAAA,IAAA;AAAA,MAEC,MAAM,UAAUf,EAAM,OAAO,EAAE;AAAA,MAC/B,MAAM;AAAA,MACN,OAAAS;AAAA,MACA,SAAAG;AAAA,MACA,UAAAC;AAAA,IAAA;AAAA,IALK,UAAUb,EAAM,OAAO,EAAE;AAAA,EAMhC;AAEJ;"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { FilterProps } from 'react-table';
|
|
2
|
-
export declare function SliderColumnFilter<D extends Record<string, unknown> = {}>({ column: { filterValue, setFilter, preFilteredRows, id } }: FilterProps<D> & {
|
|
3
|
-
column: {
|
|
4
|
-
filterValue: any;
|
|
5
|
-
setFilter: any;
|
|
6
|
-
preFilteredRows: any[];
|
|
7
|
-
id: string;
|
|
8
|
-
};
|
|
9
|
-
}): import("react/jsx-runtime").JSX.Element;
|