@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
|
@@ -1,45 +1,30 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as n, jsx as i, Fragment as x } from "react/jsx-runtime";
|
|
2
2
|
import { c as d } from "../../../chunks/index.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
buttonType: l = "primary",
|
|
10
|
-
buttonOutline: c,
|
|
11
|
-
onClick: m,
|
|
12
|
-
action: n,
|
|
13
|
-
icon: o = "",
|
|
14
|
-
title: t = "",
|
|
15
|
-
i18n: p = (b) => b,
|
|
16
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
17
|
-
data: N,
|
|
18
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
19
|
-
ctx: j,
|
|
20
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
21
|
-
permissionsResolver: C,
|
|
22
|
-
...u
|
|
23
|
-
} = r;
|
|
24
|
-
return /* @__PURE__ */ i(
|
|
3
|
+
import { registerComponent as C } from "../../../registries/components.js";
|
|
4
|
+
import { iconClass as N } from "../../../utils/iconClass.js";
|
|
5
|
+
import { stopPropagationWrapper as O } from "../../../utils/stopPropagationWrapper.js";
|
|
6
|
+
function g(r) {
|
|
7
|
+
const { i18n: e = (f) => f, onClick: a, operation: l, info: h, ...s } = r, { className: p = "btn", buttonSize: m = "xs", buttonType: c = "primary", buttonOutline: u, action: b, title: t = "", icon: o = "" } = l;
|
|
8
|
+
return /* @__PURE__ */ n(
|
|
25
9
|
"button",
|
|
26
10
|
{
|
|
27
|
-
...
|
|
28
|
-
"aria-label": "Operation button: " + (t ||
|
|
29
|
-
className: d(
|
|
30
|
-
onClick:
|
|
11
|
+
...s,
|
|
12
|
+
"aria-label": "Operation button: " + (t || b),
|
|
13
|
+
className: d(p, ["btn", u && "outline", c].filter(Boolean).join("-"), `btn-${m}`),
|
|
14
|
+
onClick: O(() => a()),
|
|
31
15
|
children: [
|
|
32
|
-
o ? /* @__PURE__ */
|
|
33
|
-
/* @__PURE__ */
|
|
16
|
+
o ? /* @__PURE__ */ n(x, { children: [
|
|
17
|
+
/* @__PURE__ */ i("i", { className: N(void 0, o) }),
|
|
34
18
|
" ",
|
|
35
19
|
t && " "
|
|
36
20
|
] }) : null,
|
|
37
|
-
t && /* @__PURE__ */
|
|
21
|
+
t && /* @__PURE__ */ i("span", { className: o && t ? "ml-1" : "", children: e(t) })
|
|
38
22
|
]
|
|
39
23
|
}
|
|
40
24
|
);
|
|
41
25
|
}
|
|
26
|
+
C("OperationButton", g);
|
|
42
27
|
export {
|
|
43
|
-
|
|
28
|
+
g as DefaultOperationButton
|
|
44
29
|
};
|
|
45
30
|
//# sourceMappingURL=DefaultOperationButton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultOperationButton.js","sources":["../../../../src/molecules/table/components/DefaultOperationButton.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"DefaultOperationButton.js","sources":["../../../../src/molecules/table/components/DefaultOperationButton.tsx"],"sourcesContent":["import { CellContext } from \"@tanstack/react-table\";\nimport cx from \"classnames\";\nimport { HTMLAttributes } from \"react\";\n\nimport { type CellMetadata, type JSON, Operation } from \"../../../interfaces\";\nimport { registerComponent } from \"../../../registries/components\";\nimport { iconClass } from \"../../../utils/iconClass\";\nimport { stopPropagationWrapper } from \"../../../utils/stopPropagationWrapper\";\n\nexport interface OperationButtonProps<Data extends { [key: string]: JSON } = { [key: string]: JSON }>\n extends Omit<HTMLAttributes<HTMLButtonElement>, \"onClick\"> {\n operation: Operation<Data>;\n info: CellContext<Data, unknown>;\n metadata?: CellMetadata;\n onClick: () => void;\n i18n?: (i18n: string) => string;\n}\n\nexport function DefaultOperationButton<Data extends { [key: string]: JSON } = { [key: string]: JSON }>(props: OperationButtonProps<Data>) {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { i18n = (f: string) => f, onClick, operation, info, ...extraProps } = props;\n const { className = \"btn\", buttonSize = \"xs\", buttonType = \"primary\", buttonOutline, action, title = \"\", icon = \"\" } = operation;\n\n return (\n <button\n {...extraProps}\n aria-label={\"Operation button: \" + (title || action)}\n className={cx(className, [\"btn\", buttonOutline && \"outline\", buttonType].filter(Boolean).join(\"-\"), `btn-${buttonSize}`)}\n onClick={stopPropagationWrapper(() => onClick())}\n >\n {icon ? (\n <>\n <i className={iconClass(undefined, icon)} /> {title && \" \"}\n </>\n ) : null}\n {title && <span className={icon && title ? \"ml-1\" : \"\"}>{i18n(title)}</span>}\n </button>\n );\n}\n\nregisterComponent(\"OperationButton\", DefaultOperationButton);\n"],"names":["DefaultOperationButton","props","i18n","onClick","operation","info","extraProps","className","buttonSize","buttonType","buttonOutline","action","title","icon","jsxs","cx","stopPropagationWrapper","Fragment","jsx","iconClass","registerComponent"],"mappings":";;;;;AAkBO,SAASA,EAAuFC,GAAmC;AAExI,QAAM,EAAE,MAAAC,IAAO,CAAC,MAAc,GAAG,SAAAC,GAAS,WAAAC,GAAW,MAAAC,GAAM,GAAGC,EAAA,IAAeL,GACvE,EAAE,WAAAM,IAAY,OAAO,YAAAC,IAAa,MAAM,YAAAC,IAAa,WAAW,eAAAC,GAAe,QAAAC,GAAQ,OAAAC,IAAQ,IAAI,MAAAC,IAAO,OAAOT;AAEvH,SACE,gBAAAU;AAAA,IAAC;AAAA,IAAA;AAAA,MACE,GAAGR;AAAA,MACJ,cAAY,wBAAwBM,KAASD;AAAA,MAC7C,WAAWI,EAAGR,GAAW,CAAC,OAAOG,KAAiB,WAAWD,CAAU,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG,GAAG,OAAOD,CAAU,EAAE;AAAA,MACvH,SAASQ,EAAuB,MAAMb,GAAS;AAAA,MAE9C,UAAA;AAAA,QAAAU,IACC,gBAAAC,EAAAG,GAAA,EACE,UAAA;AAAA,UAAA,gBAAAC,EAAC,KAAA,EAAE,WAAWC,EAAU,QAAWN,CAAI,GAAG;AAAA,UAAE;AAAA,UAAED,KAAS;AAAA,QAAA,EAAA,CACzD,IACE;AAAA,QACHA,KAAS,gBAAAM,EAAC,QAAA,EAAK,WAAWL,KAAQD,IAAQ,SAAS,IAAK,UAAAV,EAAKU,CAAK,EAAA,CAAE;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAG3E;AAEAQ,EAAkB,mBAAmBpB,CAAsB;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Filters.d.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jsxs as u, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { registerComponent as p, getComponent as x } from "../../../registries/components.js";
|
|
3
|
+
function g({ header: c, options: a }) {
|
|
4
|
+
const { column: l } = c, r = x("InputText"), m = c.column.getFilterValue(), t = a.min ?? l.getFacetedMinMaxValues()?.[0], n = a.max ?? l.getFacetedMinMaxValues()?.[1], o = a.step ?? 1;
|
|
5
|
+
return /* @__PURE__ */ u("div", { children: [
|
|
6
|
+
/* @__PURE__ */ u("div", { className: "flex space-x-2", children: [
|
|
7
|
+
/* @__PURE__ */ e("div", { className: "w-1/2", children: /* @__PURE__ */ e(
|
|
8
|
+
r,
|
|
9
|
+
{
|
|
10
|
+
type: "number",
|
|
11
|
+
size: "small",
|
|
12
|
+
min: t,
|
|
13
|
+
max: n,
|
|
14
|
+
step: o,
|
|
15
|
+
value: m?.[0] ?? "",
|
|
16
|
+
onChange: (d, s) => l.setFilterValue((i) => [s, i?.[1]]),
|
|
17
|
+
placeholder: `Min ${t !== void 0 ? `(${t})` : ""}`
|
|
18
|
+
}
|
|
19
|
+
) }),
|
|
20
|
+
/* @__PURE__ */ e("div", { className: "w-1/2", children: /* @__PURE__ */ e(
|
|
21
|
+
r,
|
|
22
|
+
{
|
|
23
|
+
type: "number",
|
|
24
|
+
size: "small",
|
|
25
|
+
min: t,
|
|
26
|
+
max: n,
|
|
27
|
+
step: o,
|
|
28
|
+
value: m?.[1] ?? "",
|
|
29
|
+
onChange: (d, s) => l.setFilterValue((i) => [i?.[0], s]),
|
|
30
|
+
placeholder: `Max ${n ? `(${n})` : ""}`
|
|
31
|
+
}
|
|
32
|
+
) })
|
|
33
|
+
] }),
|
|
34
|
+
/* @__PURE__ */ e("div", { className: "h-1" })
|
|
35
|
+
] });
|
|
36
|
+
}
|
|
37
|
+
p("Filter.range", g);
|
|
38
|
+
export {
|
|
39
|
+
g as RangeFilter
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=RangeFilter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RangeFilter.js","sources":["../../../../src/molecules/table/filters/RangeFilter.tsx"],"sourcesContent":["import { getComponent, registerComponent } from \"../../../registries/components\";\nimport { type InputText as DefaultInputText } from \"../../forms/input-text/InputText\";\nimport type { FilterProps } from \"../components/DefaultFilter\";\nimport { FilterRangeOptions } from \"./Filters\";\n\nexport function RangeFilter<Data = any>({ header, options }: FilterProps<Data, FilterRangeOptions>) {\n const { column } = header;\n const InputText = getComponent<typeof DefaultInputText>(\"InputText\");\n const columnFilterValue = header.column.getFilterValue();\n const min = options.min ?? column.getFacetedMinMaxValues()?.[0];\n const max = options.max ?? column.getFacetedMinMaxValues()?.[1];\n const step = options.step ?? 1;\n\n return (\n <div>\n <div className='flex space-x-2'>\n <div className='w-1/2'>\n <InputText\n type='number'\n size='small'\n {...{ min, max, step }}\n value={(columnFilterValue as [number, number])?.[0] ?? \"\"}\n onChange={(_, value) => column.setFilterValue((old: [number, number]) => [value, old?.[1]])}\n placeholder={`Min ${min !== undefined ? `(${min})` : \"\"}`}\n />\n </div>\n <div className='w-1/2'>\n <InputText\n type='number'\n size='small'\n {...{ min, max, step }}\n value={(columnFilterValue as [number, number])?.[1] ?? \"\"}\n onChange={(_, value) => column.setFilterValue((old: [number, number]) => [old?.[0], value])}\n placeholder={`Max ${max ? `(${max})` : \"\"}`}\n />\n </div>\n </div>\n <div className='h-1' />\n </div>\n );\n}\n\nregisterComponent(\"Filter.range\", RangeFilter);\n"],"names":["RangeFilter","header","options","column","InputText","getComponent","columnFilterValue","min","max","step","jsxs","jsx","_","value","old","registerComponent"],"mappings":";;AAKO,SAASA,EAAwB,EAAE,QAAAC,GAAQ,SAAAC,KAAkD;AAClG,QAAM,EAAE,QAAAC,MAAWF,GACbG,IAAYC,EAAsC,WAAW,GAC7DC,IAAoBL,EAAO,OAAO,eAAA,GAClCM,IAAML,EAAQ,OAAOC,EAAO,uBAAA,IAA2B,CAAC,GACxDK,IAAMN,EAAQ,OAAOC,EAAO,uBAAA,IAA2B,CAAC,GACxDM,IAAOP,EAAQ,QAAQ;AAE7B,2BACG,OAAA,EACC,UAAA;AAAA,IAAA,gBAAAQ,EAAC,OAAA,EAAI,WAAU,kBACb,UAAA;AAAA,MAAA,gBAAAC,EAAC,OAAA,EAAI,WAAU,SACb,UAAA,gBAAAA;AAAA,QAACP;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,MAAK;AAAA,UACC,KAAAG;AAAA,UAAK,KAAAC;AAAA,UAAK,MAAAC;AAAA,UAChB,OAAQH,IAAyC,CAAC,KAAK;AAAA,UACvD,UAAU,CAACM,GAAGC,MAAUV,EAAO,eAAe,CAACW,MAA0B,CAACD,GAAOC,IAAM,CAAC,CAAC,CAAC;AAAA,UAC1F,aAAa,OAAOP,MAAQ,SAAY,IAAIA,CAAG,MAAM,EAAE;AAAA,QAAA;AAAA,MAAA,GAE3D;AAAA,MACA,gBAAAI,EAAC,OAAA,EAAI,WAAU,SACb,UAAA,gBAAAA;AAAA,QAACP;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,MAAK;AAAA,UACC,KAAAG;AAAA,UAAK,KAAAC;AAAA,UAAK,MAAAC;AAAA,UAChB,OAAQH,IAAyC,CAAC,KAAK;AAAA,UACvD,UAAU,CAACM,GAAGC,MAAUV,EAAO,eAAe,CAACW,MAA0B,CAACA,IAAM,CAAC,GAAGD,CAAK,CAAC;AAAA,UAC1F,aAAa,OAAOL,IAAM,IAAIA,CAAG,MAAM,EAAE;AAAA,QAAA;AAAA,MAAA,EAC3C,CACF;AAAA,IAAA,GACF;AAAA,IACA,gBAAAG,EAAC,OAAA,EAAI,WAAU,MAAA,CAAM;AAAA,EAAA,GACvB;AAEJ;AAEAI,EAAkB,gBAAgBf,CAAW;"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx as o, Fragment as u } from "react/jsx-runtime";
|
|
2
|
+
import { registerComponent as a, getComponent as p } from "../../../registries/components.js";
|
|
3
|
+
import { useUniqValues as f } from "../hooks/useUniqValues.js";
|
|
4
|
+
function F({ header: t, options: e }) {
|
|
5
|
+
const n = p("Select"), i = t.column.getFilterValue(), c = f({ header: t, filterVariant: "text" }), r = e.layout === "choicesjs" ? {
|
|
6
|
+
placeholder: void 0
|
|
7
|
+
} : {
|
|
8
|
+
placeholder: `Filter by ${t.column.columnDef.header}`
|
|
9
|
+
}, m = [
|
|
10
|
+
{
|
|
11
|
+
label: `Filter by ${t.column.columnDef.header}`,
|
|
12
|
+
value: ""
|
|
13
|
+
}
|
|
14
|
+
].concat(e.options || c.map((l) => ({ label: l, value: l })));
|
|
15
|
+
return /* @__PURE__ */ o(u, { children: /* @__PURE__ */ o(
|
|
16
|
+
n,
|
|
17
|
+
{
|
|
18
|
+
size: "small",
|
|
19
|
+
...e,
|
|
20
|
+
...r,
|
|
21
|
+
options: m,
|
|
22
|
+
name: `filter_${t.column.id}`,
|
|
23
|
+
"data-testid": `filter_${t.column.id}`,
|
|
24
|
+
value: i,
|
|
25
|
+
onChange: (l, s) => t.column.setFilterValue(s)
|
|
26
|
+
}
|
|
27
|
+
) });
|
|
28
|
+
}
|
|
29
|
+
a("Filter.select", F);
|
|
30
|
+
export {
|
|
31
|
+
F as SelectFilter
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=SelectFilter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectFilter.js","sources":["../../../../src/molecules/table/filters/SelectFilter.tsx"],"sourcesContent":["import { getComponent, registerComponent } from \"../../../registries/components\";\nimport type { Select as DefaultSelect } from \"../../forms/select/Select\";\nimport { SelectOptionProps } from \"../../forms/select/Select.interface\";\nimport type { FilterProps } from \"../components/DefaultFilter\";\nimport { useUniqValues } from \"../hooks/useUniqValues\";\nimport { FilterSelectOptions } from \"./Filters\";\n\nexport function SelectFilter<Data = any>({ header, options }: FilterProps<Data, FilterSelectOptions>) {\n const Select = getComponent<typeof DefaultSelect>(\"Select\");\n const columnFilterValue = header.column.getFilterValue();\n const uniqValues = useUniqValues<Data>({ header, filterVariant: \"text\" });\n\n const opts =\n options.layout === \"choicesjs\"\n ? {\n placeholder: undefined\n }\n : {\n placeholder: `Filter by ${header.column.columnDef.header}`\n };\n\n const listOptions = (\n [\n {\n label: `Filter by ${header.column.columnDef.header}`,\n value: \"\"\n }\n ] as SelectOptionProps[]\n ).concat(options.options || uniqValues.map((value: any) => ({ label: value, value })));\n\n return (\n <>\n <Select<string>\n size='small'\n {...(options as any)}\n {...opts}\n options={listOptions}\n name={`filter_${header.column.id}`}\n data-testid={`filter_${header.column.id}`}\n value={columnFilterValue as string}\n onChange={(_, value) => header.column.setFilterValue(value)}\n />\n </>\n );\n}\n\nregisterComponent(\"Filter.select\", SelectFilter);\n"],"names":["SelectFilter","header","options","Select","getComponent","columnFilterValue","uniqValues","useUniqValues","opts","listOptions","value","jsx","Fragment","_","registerComponent"],"mappings":";;;AAOO,SAASA,EAAyB,EAAE,QAAAC,GAAQ,SAAAC,KAAmD;AACpG,QAAMC,IAASC,EAAmC,QAAQ,GACpDC,IAAoBJ,EAAO,OAAO,eAAA,GAClCK,IAAaC,EAAoB,EAAE,QAAAN,GAAQ,eAAe,QAAQ,GAElEO,IACJN,EAAQ,WAAW,cACf;AAAA,IACE,aAAa;AAAA,EAAA,IAEf;AAAA,IACE,aAAa,aAAaD,EAAO,OAAO,UAAU,MAAM;AAAA,EAAA,GAG1DQ,IACJ;AAAA,IACE;AAAA,MACE,OAAO,aAAaR,EAAO,OAAO,UAAU,MAAM;AAAA,MAClD,OAAO;AAAA,IAAA;AAAA,EACT,EAEF,OAAOC,EAAQ,WAAWI,EAAW,IAAI,CAACI,OAAgB,EAAE,OAAOA,GAAO,OAAAA,EAAA,EAAQ,CAAC;AAErF,SACE,gBAAAC,EAAAC,GAAA,EACE,UAAA,gBAAAD;AAAA,IAACR;AAAA,IAAA;AAAA,MACC,MAAK;AAAA,MACJ,GAAID;AAAA,MACJ,GAAGM;AAAA,MACJ,SAASC;AAAA,MACT,MAAM,UAAUR,EAAO,OAAO,EAAE;AAAA,MAChC,eAAa,UAAUA,EAAO,OAAO,EAAE;AAAA,MACvC,OAAOI;AAAA,MACP,UAAU,CAACQ,GAAGH,MAAUT,EAAO,OAAO,eAAeS,CAAK;AAAA,IAAA;AAAA,EAAA,GAE9D;AAEJ;AAEAI,EAAkB,iBAAiBd,CAAY;"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsxs as a, Fragment as u, jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { registerComponent as c, getComponent as d } from "../../../registries/components.js";
|
|
3
|
+
import { useUniqValues as p } from "../hooks/useUniqValues.js";
|
|
4
|
+
function f({ header: t, options: e }) {
|
|
5
|
+
const o = d("InputText"), m = t.column.getFilterValue(), r = p({ header: t, filterVariant: "text" }), n = `data_list_${t.column.id}`;
|
|
6
|
+
return /* @__PURE__ */ a(u, { children: [
|
|
7
|
+
!e.disableDatalist && /* @__PURE__ */ i("datalist", { id: n, children: r.map((l) => /* @__PURE__ */ i("option", { value: l }, l)) }),
|
|
8
|
+
/* @__PURE__ */ i(
|
|
9
|
+
o,
|
|
10
|
+
{
|
|
11
|
+
size: "small",
|
|
12
|
+
placeholder: `Filter by ${t.column.columnDef.header}`,
|
|
13
|
+
...e,
|
|
14
|
+
name: `filter_${t.column.id}`,
|
|
15
|
+
"data-testid": `filter_${t.column.id}`,
|
|
16
|
+
value: m ?? "",
|
|
17
|
+
list: n,
|
|
18
|
+
onChange: (l, s) => t.column.setFilterValue(s)
|
|
19
|
+
}
|
|
20
|
+
)
|
|
21
|
+
] });
|
|
22
|
+
}
|
|
23
|
+
c("Filter.text", f);
|
|
24
|
+
export {
|
|
25
|
+
f as TextFieldFilter
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=TextFieldFilter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextFieldFilter.js","sources":["../../../../src/molecules/table/filters/TextFieldFilter.tsx"],"sourcesContent":["import { getComponent, registerComponent } from \"../../../registries/components\";\nimport type { InputText as DefaultInputText } from \"../../forms/input-text/InputText\";\nimport type { FilterProps } from \"../components/DefaultFilter\";\nimport { useUniqValues } from \"../hooks/useUniqValues\";\nimport { FilterTextOptions } from \"./Filters\";\n\nexport function TextFieldFilter<Data = any>({ header, options }: FilterProps<Data, FilterTextOptions>) {\n const InputText = getComponent<typeof DefaultInputText>(\"InputText\");\n const columnFilterValue = header.column.getFilterValue();\n const uniqValues = useUniqValues<Data>({ header, filterVariant: \"text\" });\n const datalistId = `data_list_${header.column.id}`;\n\n return (\n <>\n {!options.disableDatalist && (\n <datalist id={datalistId}>\n {uniqValues.map((value: any) => (\n <option value={value} key={value} />\n ))}\n </datalist>\n )}\n <InputText<string>\n size='small'\n placeholder={`Filter by ${header.column.columnDef.header}`}\n {...options}\n name={`filter_${header.column.id}`}\n data-testid={`filter_${header.column.id}`}\n value={(columnFilterValue ?? \"\") as string}\n list={datalistId}\n onChange={(_, value) => header.column.setFilterValue(value)}\n />\n </>\n );\n}\n\nregisterComponent(\"Filter.text\", TextFieldFilter);\n"],"names":["TextFieldFilter","header","options","InputText","getComponent","columnFilterValue","uniqValues","useUniqValues","datalistId","jsxs","Fragment","jsx","value","_","registerComponent"],"mappings":";;;AAMO,SAASA,EAA4B,EAAE,QAAAC,GAAQ,SAAAC,KAAiD;AACrG,QAAMC,IAAYC,EAAsC,WAAW,GAC7DC,IAAoBJ,EAAO,OAAO,eAAA,GAClCK,IAAaC,EAAoB,EAAE,QAAAN,GAAQ,eAAe,QAAQ,GAClEO,IAAa,aAAaP,EAAO,OAAO,EAAE;AAEhD,SACE,gBAAAQ,EAAAC,GAAA,EACG,UAAA;AAAA,IAAA,CAACR,EAAQ,mBACR,gBAAAS,EAAC,YAAA,EAAS,IAAIH,GACX,UAAAF,EAAW,IAAI,CAACM,MACf,gBAAAD,EAAC,UAAA,EAAO,OAAAC,KAAmBA,CAAO,CACnC,GACH;AAAA,IAEF,gBAAAD;AAAA,MAACR;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,aAAa,aAAaF,EAAO,OAAO,UAAU,MAAM;AAAA,QACvD,GAAGC;AAAA,QACJ,MAAM,UAAUD,EAAO,OAAO,EAAE;AAAA,QAChC,eAAa,UAAUA,EAAO,OAAO,EAAE;AAAA,QACvC,OAAQI,KAAqB;AAAA,QAC7B,MAAMG;AAAA,QACN,UAAU,CAACK,GAAGD,MAAUX,EAAO,OAAO,eAAeW,CAAK;AAAA,MAAA;AAAA,IAAA;AAAA,EAC5D,GACF;AAEJ;AAEAE,EAAkB,eAAed,CAAe;"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { TableOptions, TableState } from '@tanstack/react-table';
|
|
2
|
+
import { FormOptions, JSON, Operation } from '../../../interfaces';
|
|
3
|
+
export interface UseTableProps<Data extends {
|
|
4
|
+
[key: string]: JSON;
|
|
5
|
+
} = {
|
|
6
|
+
[key: string]: JSON;
|
|
7
|
+
}> extends Omit<TableOptions<Data>, "getCoreRowModel" | "onClick"> {
|
|
8
|
+
operations: Operation<Data>[];
|
|
9
|
+
metadata?: Record<string, unknown>;
|
|
10
|
+
i18n?: FormOptions["i18n"];
|
|
11
|
+
onClick?: (data: Data, operation: Operation<Data>) => void;
|
|
12
|
+
manualFaceted?: boolean;
|
|
13
|
+
onChange?: (query: TableState) => void;
|
|
14
|
+
pageSizes?: number[];
|
|
15
|
+
}
|
|
16
|
+
export declare function useTable<Data extends {
|
|
17
|
+
[key: string]: JSON;
|
|
18
|
+
} = {
|
|
19
|
+
[key: string]: JSON;
|
|
20
|
+
}>(props: UseTableProps<Data>): {
|
|
21
|
+
i18n: (key: string, defaultValue?: string) => string;
|
|
22
|
+
tableInstance: import('@tanstack/table-core').Table<Data>;
|
|
23
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsx as R } from "react/jsx-runtime";
|
|
2
|
+
import { useReactTable as f, getFacetedUniqueValues as w, getFacetedRowModel as M, getSortedRowModel as C, getFilteredRowModel as S, getPaginationRowModel as b, getCoreRowModel as h } from "@tanstack/react-table";
|
|
3
|
+
import { useEffect as v } from "react";
|
|
4
|
+
import { useI18n as O } from "../../../hooks/useI18n.js";
|
|
5
|
+
import { getComponent as I } from "../../../registries/components.js";
|
|
6
|
+
function z(e) {
|
|
7
|
+
const n = I("CellOperations"), { t } = O(e.i18n), i = e.operations.length ? [
|
|
8
|
+
{
|
|
9
|
+
id: "operations",
|
|
10
|
+
header: t("Operations"),
|
|
11
|
+
cell: (F) => /* @__PURE__ */ R(n, { info: F, operations: e.operations, metadata: e.metadata, onClick: e.onClick, i18n: t })
|
|
12
|
+
}
|
|
13
|
+
] : [], o = f({
|
|
14
|
+
...e,
|
|
15
|
+
columns: [...e.columns, ...i],
|
|
16
|
+
getCoreRowModel: h(),
|
|
17
|
+
getPaginationRowModel: b(),
|
|
18
|
+
getFilteredRowModel: e.manualFiltering ? void 0 : S(),
|
|
19
|
+
getSortedRowModel: e.manualSorting ? void 0 : C(),
|
|
20
|
+
getFacetedRowModel: e.manualFaceted ? void 0 : M(),
|
|
21
|
+
// client-side faceting
|
|
22
|
+
getFacetedUniqueValues: e.manualFaceted ? void 0 : w()
|
|
23
|
+
// generate unique values for select filter/autocomplete
|
|
24
|
+
}), { columnFilters: a, sorting: l, pagination: d, columnOrder: g, columnPinning: c, columnSizing: m, columnSizingInfo: r, columnVisibility: u, globalFilter: s } = o.getState();
|
|
25
|
+
return v(() => {
|
|
26
|
+
e.onChange && e.onChange(o.getState());
|
|
27
|
+
}, [a, l, d, g, c, m, r, u, s]), {
|
|
28
|
+
i18n: t,
|
|
29
|
+
tableInstance: o
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export {
|
|
33
|
+
z as useTable
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=useTable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTable.js","sources":["../../../../src/molecules/table/hooks/useTable.tsx"],"sourcesContent":["import {\n type ColumnDef,\n getCoreRowModel,\n getFacetedRowModel,\n getFacetedUniqueValues,\n getFilteredRowModel,\n getPaginationRowModel,\n getSortedRowModel,\n type TableOptions,\n type TableState,\n useReactTable\n} from \"@tanstack/react-table\";\nimport { useEffect } from \"react\";\n\nimport { useI18n } from \"../../../hooks/useI18n.js\";\nimport { type FormOptions, type JSON, Operation } from \"../../../interfaces\";\nimport { getComponent } from \"../../../registries/components\";\nimport type { DefaultCellOperations } from \"../components/DefaultCellOperations\";\n\nexport interface UseTableProps<Data extends { [key: string]: JSON } = { [key: string]: JSON }>\n extends Omit<TableOptions<Data>, \"getCoreRowModel\" | \"onClick\"> {\n operations: Operation<Data>[];\n metadata?: Record<string, unknown>;\n i18n?: FormOptions[\"i18n\"];\n onClick?: (data: Data, operation: Operation<Data>) => void;\n manualFaceted?: boolean;\n onChange?: (query: TableState) => void;\n pageSizes?: number[];\n}\n\nexport function useTable<Data extends { [key: string]: JSON } = { [key: string]: JSON }>(props: UseTableProps<Data>) {\n const Operations = getComponent<typeof DefaultCellOperations<Data>>(\"CellOperations\");\n const { t } = useI18n(props.i18n);\n\n // const [pagination, setPagination] = useState({\n // pageIndex: 0, //initial page index\n // pageSize: 10 //default page size\n // });\n\n const operations = props.operations.length\n ? ([\n {\n id: \"operations\",\n header: t(\"Operations\"),\n cell: (info) => (\n <Operations info={info} operations={props.operations} metadata={props.metadata} onClick={props.onClick} i18n={t} />\n )\n }\n ] satisfies ColumnDef<Data>[])\n : [];\n\n const tableInstance = useReactTable({\n ...props,\n columns: [...props.columns, ...operations],\n getCoreRowModel: getCoreRowModel(),\n getPaginationRowModel: getPaginationRowModel(),\n getFilteredRowModel: !props.manualFiltering ? getFilteredRowModel() : undefined,\n getSortedRowModel: !props.manualSorting ? getSortedRowModel() : undefined,\n getFacetedRowModel: !props.manualFaceted ? getFacetedRowModel() : undefined, // client-side faceting\n getFacetedUniqueValues: !props.manualFaceted ? getFacetedUniqueValues() : undefined // generate unique values for select filter/autocomplete\n });\n\n const { columnFilters, sorting, pagination, columnOrder, columnPinning, columnSizing, columnSizingInfo, columnVisibility, globalFilter } =\n tableInstance.getState();\n\n useEffect(() => {\n if (props.onChange) {\n props.onChange(tableInstance.getState());\n }\n }, [columnFilters, sorting, pagination, columnOrder, columnPinning, columnSizing, columnSizingInfo, columnVisibility, globalFilter]);\n\n return {\n i18n: t,\n tableInstance\n };\n}\n"],"names":["useTable","props","Operations","getComponent","useI18n","operations","info","jsx","tableInstance","useReactTable","getCoreRowModel","getPaginationRowModel","getFilteredRowModel","getSortedRowModel","getFacetedRowModel","getFacetedUniqueValues","columnFilters","sorting","pagination","columnOrder","columnPinning","columnSizing","columnSizingInfo","columnVisibility","globalFilter","useEffect"],"mappings":";;;;;AA8BO,SAASA,EAAyEC,GAA4B;AACnH,QAAMC,IAAaC,EAAiD,gBAAgB,GAC9E,EAAE,EAAA,IAAMC,EAAQH,EAAM,IAAI,GAO1BI,IAAaJ,EAAM,WAAW,SAC/B;AAAA,IACC;AAAA,MACE,IAAI;AAAA,MACJ,QAAQ,EAAE,YAAY;AAAA,MACtB,MAAM,CAACK,MACL,gBAAAC,EAACL,GAAA,EAAW,MAAAI,GAAY,YAAYL,EAAM,YAAY,UAAUA,EAAM,UAAU,SAASA,EAAM,SAAS,MAAM,EAAA,CAAG;AAAA,IAAA;AAAA,EAErH,IAEF,CAAA,GAEEO,IAAgBC,EAAc;AAAA,IAClC,GAAGR;AAAA,IACH,SAAS,CAAC,GAAGA,EAAM,SAAS,GAAGI,CAAU;AAAA,IACzC,iBAAiBK,EAAA;AAAA,IACjB,uBAAuBC,EAAA;AAAA,IACvB,qBAAsBV,EAAM,kBAA0C,SAAxBW;IAC9C,mBAAoBX,EAAM,gBAAsC,SAAtBY;IAC1C,oBAAqBZ,EAAM,gBAAuC,SAAvBa;;IAC3C,wBAAyBb,EAAM,gBAA2C,SAA3Bc;;EAA2B,CAC3E,GAEK,EAAE,eAAAC,GAAe,SAAAC,GAAS,YAAAC,GAAY,aAAAC,GAAa,eAAAC,GAAe,cAAAC,GAAc,kBAAAC,GAAkB,kBAAAC,GAAkB,cAAAC,MACxHhB,EAAc,SAAA;AAEhB,SAAAiB,EAAU,MAAM;AACd,IAAIxB,EAAM,YACRA,EAAM,SAASO,EAAc,UAAU;AAAA,EAE3C,GAAG,CAACQ,GAAeC,GAASC,GAAYC,GAAaC,GAAeC,GAAcC,GAAkBC,GAAkBC,CAAY,CAAC,GAE5H;AAAA,IACL,MAAM;AAAA,IACN,eAAAhB;AAAA,EAAA;AAEJ;"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { useMemo as u } from "react";
|
|
2
|
+
function r({ header: e, filterVariant: o }) {
|
|
3
|
+
return u(
|
|
4
|
+
() => o === "range" ? [] : Array.from(e.column.getFacetedUniqueValues().keys()).flat().sort().slice(0, 5e3),
|
|
5
|
+
[e.column, o]
|
|
6
|
+
);
|
|
7
|
+
}
|
|
8
|
+
export {
|
|
9
|
+
r as useUniqValues
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=useUniqValues.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useUniqValues.js","sources":["../../../../src/molecules/table/hooks/useUniqValues.tsx"],"sourcesContent":["import type { Header } from \"@tanstack/react-table\";\nimport { useMemo } from \"react\";\n\nexport function useUniqValues<Data = any>({ header, filterVariant }: { header: Header<Data, unknown>; filterVariant: string }) {\n return useMemo(\n () => (filterVariant === \"range\" ? [] : Array.from(header.column.getFacetedUniqueValues().keys()).flat().sort().slice(0, 5000)),\n\n [header.column, filterVariant]\n );\n}\n"],"names":["useUniqValues","header","filterVariant","useMemo"],"mappings":";AAGO,SAASA,EAA0B,EAAE,QAAAC,GAAQ,eAAAC,KAA2E;AAC7H,SAAOC;AAAA,IACL,MAAOD,MAAkB,UAAU,CAAA,IAAK,MAAM,KAAKD,EAAO,OAAO,uBAAA,EAAyB,KAAA,CAAM,EAAE,KAAA,EAAO,OAAO,MAAM,GAAG,GAAI;AAAA,IAE7H,CAACA,EAAO,QAAQC,CAAa;AAAA,EAAA;AAEjC;"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { RowData } from '@tanstack/react-table';
|
|
2
|
+
import { TdHTMLAttributes } from 'react';
|
|
3
|
+
import { FilterOptions } from '../filters/Filters';
|
|
4
|
+
declare module "@tanstack/react-table" {
|
|
5
|
+
interface ColumnMeta<TData extends RowData, TValue> {
|
|
6
|
+
filter?: FilterOptions;
|
|
7
|
+
sort?: string;
|
|
8
|
+
cellProps?: TdHTMLAttributes<HTMLTableCellElement>;
|
|
9
|
+
/**
|
|
10
|
+
* Hide the cell
|
|
11
|
+
*/
|
|
12
|
+
hidden?: boolean;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extends.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
+
import { ColumnDef, ColumnDefResolved } from '@tanstack/react-table';
|
|
1
2
|
import { FormType } from '../../../interfaces';
|
|
2
|
-
|
|
3
|
-
export declare function mapFormToColumns(form: FormType): ExtendedColumn[];
|
|
3
|
+
export declare function mapFormToColumns<Data = any>(form: FormType, columns?: ColumnDefResolved<Data, any>[]): ColumnDef<Data, any>[];
|
|
@@ -1,22 +1,38 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import { c as d } from "../../../chunks/index2.js";
|
|
3
|
+
import { createColumnHelper as f } from "@tanstack/react-table";
|
|
4
|
+
import C from "lodash/cloneDeep";
|
|
5
|
+
import g from "lodash/get";
|
|
6
|
+
import { getComponent as x } from "../../../registries/components.js";
|
|
7
|
+
const b = {
|
|
8
|
+
number: "range",
|
|
9
|
+
currency: "range",
|
|
10
|
+
checkbox: "boolean"
|
|
11
|
+
};
|
|
12
|
+
function j(s, p = []) {
|
|
13
|
+
const u = f(), r = C(p), l = x("Cell");
|
|
14
|
+
return s.components.flatMap((e) => e.type === "tabs" ? e.components?.flatMap((t) => t.components) : [e]).filter((e) => e?.tableView).map((e) => {
|
|
15
|
+
const t = e, n = d.Components.create(t, {}, null), o = r.findIndex(({ accessorKey: a }) => a === `data.${t.key}`);
|
|
16
|
+
let m = r[o];
|
|
17
|
+
return m && r.splice(o, 1), u.accessor(`data.${t.key}`, {
|
|
18
|
+
header: (t.label || t.title || t.key)?.replace(/:/, ""),
|
|
19
|
+
cell: (a) => /* @__PURE__ */ c(l, { value: a.getValue(), render: (i) => n.asString(i) }),
|
|
20
|
+
meta: {
|
|
21
|
+
filter: { variant: b[t.type] || "text" },
|
|
22
|
+
...m?.meta || {}
|
|
23
|
+
},
|
|
24
|
+
...m || {}
|
|
25
|
+
});
|
|
26
|
+
}).concat(r).map((e, t) => ({
|
|
27
|
+
...e,
|
|
28
|
+
meta: {
|
|
29
|
+
...e.meta || {},
|
|
30
|
+
order: g(e, "meta.order", t * 10)
|
|
31
|
+
},
|
|
32
|
+
cell: e.cell || ((n) => /* @__PURE__ */ c(l, { value: n.getValue(), render: (o) => o }))
|
|
33
|
+
})).sort((e, t) => e.meta.order > t.meta.order ? 1 : -1);
|
|
18
34
|
}
|
|
19
35
|
export {
|
|
20
|
-
|
|
36
|
+
j as mapFormToColumns
|
|
21
37
|
};
|
|
22
38
|
//# sourceMappingURL=mapFormToColumns.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapFormToColumns.js","sources":["../../../../src/molecules/table/utils/mapFormToColumns.tsx"],"sourcesContent":["import { Components,
|
|
1
|
+
{"version":3,"file":"mapFormToColumns.js","sources":["../../../../src/molecules/table/utils/mapFormToColumns.tsx"],"sourcesContent":["import \"../interfaces/extends\";\n\nimport { Components } from \"@formio/js\";\nimport { ColumnDef, ColumnDefResolved, createColumnHelper } from \"@tanstack/react-table\";\nimport cloneDeep from \"lodash/cloneDeep\";\nimport get from \"lodash/get\";\n\nimport type { ComponentType, FormType } from \"../../../interfaces\";\nimport { getComponent } from \"../../../registries/components\";\nimport type { DefaultCell } from \"../components/DefaultCell\";\nimport type { FilterVariants } from \"../filters/Filters.js\";\n\nconst MAP_TYPES: Record<string, FilterVariants> = {\n number: \"range\",\n currency: \"range\",\n checkbox: \"boolean\"\n};\n\nexport function mapFormToColumns<Data = any>(form: FormType, columns: ColumnDefResolved<Data, any>[] = []): ColumnDef<Data, any>[] {\n const columnHelper = createColumnHelper<Data>();\n const columnsToKeep = cloneDeep(columns);\n\n const Cell = getComponent<typeof DefaultCell>(\"Cell\");\n\n const columnsFromComponents = form.components\n .flatMap((component) => {\n if (component.type === \"tabs\") {\n return component.components?.flatMap((subComponent: ComponentType) => subComponent.components);\n }\n\n return [component];\n })\n .filter((component) => component?.tableView)\n .map((c) => {\n const component = c as ComponentType;\n const cmp: any = Components.create(component, {}, null);\n\n const columnIndex = columnsToKeep.findIndex(({ accessorKey }) => {\n return accessorKey === `data.${component.key}`;\n });\n\n let column = columnsToKeep[columnIndex];\n\n if (column) {\n columnsToKeep.splice(columnIndex, 1);\n }\n\n return columnHelper.accessor(`data.${component.key}` as any, {\n header: (component.label || component.title || component.key)?.replace(/:/, \"\"),\n cell: (info) => {\n return <Cell value={info.getValue() as Data} render={(value: Data) => cmp.asString(value)} />;\n },\n meta: {\n filter: { variant: MAP_TYPES[component.type!] || \"text\" },\n ...(column?.meta || {})\n },\n ...(column || {})\n });\n });\n\n const mergedColumns = columnsFromComponents.concat(columnsToKeep as any[]).map((column, index) => ({\n ...column,\n meta: {\n ...(column.meta || {}),\n order: get(column, \"meta.order\", index * 10)\n },\n cell:\n column.cell ||\n ((info) => {\n return <Cell value={info.getValue() as Data} render={(value: Data) => value} />;\n })\n }));\n\n return mergedColumns.sort((a, b) => (a.meta.order > b.meta.order ? 1 : -1)) as ColumnDef<Data, any>[];\n}\n"],"names":["MAP_TYPES","mapFormToColumns","form","columns","columnHelper","createColumnHelper","columnsToKeep","cloneDeep","Cell","getComponent","component","subComponent","c","cmp","Components","columnIndex","accessorKey","column","info","jsx","value","index","get","a","b"],"mappings":";;;;;;AAYA,MAAMA,IAA4C;AAAA,EAChD,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,UAAU;AACZ;AAEO,SAASC,EAA6BC,GAAgBC,IAA0C,IAA4B;AACjI,QAAMC,IAAeC,EAAA,GACfC,IAAgBC,EAAUJ,CAAO,GAEjCK,IAAOC,EAAiC,MAAM;AAmDpD,SAjD8BP,EAAK,WAChC,QAAQ,CAACQ,MACJA,EAAU,SAAS,SACdA,EAAU,YAAY,QAAQ,CAACC,MAAgCA,EAAa,UAAU,IAGxF,CAACD,CAAS,CAClB,EACA,OAAO,CAACA,MAAcA,GAAW,SAAS,EAC1C,IAAI,CAACE,MAAM;AACV,UAAMF,IAAYE,GACZC,IAAWC,EAAAA,WAAW,OAAOJ,GAAW,CAAA,GAAI,IAAI,GAEhDK,IAAcT,EAAc,UAAU,CAAC,EAAE,aAAAU,QACtCA,MAAgB,QAAQN,EAAU,GAAG,EAC7C;AAED,QAAIO,IAASX,EAAcS,CAAW;AAEtC,WAAIE,KACFX,EAAc,OAAOS,GAAa,CAAC,GAG9BX,EAAa,SAAS,QAAQM,EAAU,GAAG,IAAW;AAAA,MAC3D,SAASA,EAAU,SAASA,EAAU,SAASA,EAAU,MAAM,QAAQ,KAAK,EAAE;AAAA,MAC9E,MAAM,CAACQ,MACE,gBAAAC,EAACX,GAAA,EAAK,OAAOU,EAAK,SAAA,GAAoB,QAAQ,CAACE,MAAgBP,EAAI,SAASO,CAAK,EAAA,CAAG;AAAA,MAE7F,MAAM;AAAA,QACJ,QAAQ,EAAE,SAASpB,EAAUU,EAAU,IAAK,KAAK,OAAA;AAAA,QACjD,GAAIO,GAAQ,QAAQ,CAAA;AAAA,MAAC;AAAA,MAEvB,GAAIA,KAAU,CAAA;AAAA,IAAC,CAChB;AAAA,EACH,CAAC,EAEyC,OAAOX,CAAsB,EAAE,IAAI,CAACW,GAAQI,OAAW;AAAA,IACjG,GAAGJ;AAAA,IACH,MAAM;AAAA,MACJ,GAAIA,EAAO,QAAQ,CAAA;AAAA,MACnB,OAAOK,EAAIL,GAAQ,cAAcI,IAAQ,EAAE;AAAA,IAAA;AAAA,IAE7C,MACEJ,EAAO,SACN,CAACC,MACO,gBAAAC,EAACX,KAAK,OAAOU,EAAK,YAAoB,QAAQ,CAACE,MAAgBA,GAAO;AAAA,EAC/E,EACF,EAEmB,KAAK,CAACG,GAAGC,MAAOD,EAAE,KAAK,QAAQC,EAAE,KAAK,QAAQ,IAAI,EAAG;AAC5E;"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
export interface TabProps {
|
|
3
|
+
icon?: string;
|
|
4
|
+
isActive?: boolean;
|
|
5
|
+
className?: string;
|
|
6
|
+
after?: React.ReactNode;
|
|
7
|
+
value: number;
|
|
8
|
+
/**
|
|
9
|
+
* on tab select handler
|
|
10
|
+
*/
|
|
11
|
+
onClick?: (value: number) => void;
|
|
12
|
+
}
|
|
13
|
+
export declare function Tab({ onClick, icon, value, children, className, after }: PropsWithChildren<TabProps>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { jsxs as l, jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { c as f } from "../../chunks/index.js";
|
|
3
|
+
import { useRef as b, useEffect as g, useCallback as n } from "react";
|
|
4
|
+
import { useKeyboardControls as v } from "../../hooks/useKeyboardControls.js";
|
|
5
|
+
import { registerComponent as A } from "../../registries/components.js";
|
|
6
|
+
import { iconClass as E } from "../../utils/iconClass.js";
|
|
7
|
+
import { useTabsUid as K, useActiveTab as j, useRegisterTabControl as k } from "./hooks/tabControl.js";
|
|
8
|
+
function D({ onClick: p, icon: u, value: e, children: _, className: d, after: T }) {
|
|
9
|
+
const m = K(), s = b(null), o = j(), t = k({ value: e, ref: s }), c = b(o), r = b(o === e);
|
|
10
|
+
r.current = o === e, g(() => {
|
|
11
|
+
c.current !== o && e === o && (s.current?.focus(), p?.(e)), c.current !== o && (c.current = o);
|
|
12
|
+
}, [e, p, o]);
|
|
13
|
+
const y = n(() => {
|
|
14
|
+
t({ type: "start" });
|
|
15
|
+
}, [t]), w = n(() => {
|
|
16
|
+
t({ type: "end" });
|
|
17
|
+
}, [t]), x = n(() => {
|
|
18
|
+
t({ type: "previous" });
|
|
19
|
+
}, [t]), h = n(() => {
|
|
20
|
+
t({ type: "next" });
|
|
21
|
+
}, [t]), C = n(() => {
|
|
22
|
+
const a = document.documentElement.dir === "rtl";
|
|
23
|
+
t({ type: a ? "next" : "previous" });
|
|
24
|
+
}, [t]), N = n(() => {
|
|
25
|
+
const a = document.documentElement.dir === "rtl";
|
|
26
|
+
t({ type: a ? "previous" : "next" });
|
|
27
|
+
}, [t]), R = v({
|
|
28
|
+
start: y,
|
|
29
|
+
end: w,
|
|
30
|
+
up: x,
|
|
31
|
+
down: h,
|
|
32
|
+
left: C,
|
|
33
|
+
right: N
|
|
34
|
+
}), $ = n(() => {
|
|
35
|
+
t({ type: "update", payload: e });
|
|
36
|
+
}, [t, e]);
|
|
37
|
+
return /* @__PURE__ */ l("div", { title: "button-wrapper", className: f("tw-tabs__button-wrapper", d, { "-active": r.current }, d), children: [
|
|
38
|
+
/* @__PURE__ */ l(
|
|
39
|
+
"button",
|
|
40
|
+
{
|
|
41
|
+
ref: s,
|
|
42
|
+
id: `Tab_${e}_${m}`,
|
|
43
|
+
"data-name": "Tab",
|
|
44
|
+
title: "button-tab",
|
|
45
|
+
role: "tab",
|
|
46
|
+
"aria-selected": r.current,
|
|
47
|
+
"aria-controls": `TabPanel_${e}_${m}`,
|
|
48
|
+
tabIndex: r.current ? 0 : -1,
|
|
49
|
+
className: "tw-tabs__button",
|
|
50
|
+
onClick: $,
|
|
51
|
+
onKeyDown: R,
|
|
52
|
+
children: [
|
|
53
|
+
u && /* @__PURE__ */ i("i", { className: f(E(void 0, u), "tw-tabs__button-icon") }),
|
|
54
|
+
/* @__PURE__ */ i("span", { className: "tw-tabs__button-label", children: _ }),
|
|
55
|
+
T
|
|
56
|
+
]
|
|
57
|
+
}
|
|
58
|
+
),
|
|
59
|
+
/* @__PURE__ */ i("div", { className: "tw-tabs__button-border" })
|
|
60
|
+
] });
|
|
61
|
+
}
|
|
62
|
+
A("Tab", D);
|
|
63
|
+
export {
|
|
64
|
+
D as Tab
|
|
65
|
+
};
|
|
66
|
+
//# sourceMappingURL=Tab.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tab.js","sources":["../../../src/molecules/tabs/Tab.tsx"],"sourcesContent":["import classnames from \"classnames\";\nimport { PropsWithChildren, useCallback, useEffect, useRef } from \"react\";\n\nimport { useKeyboardControls } from \"../../hooks/useKeyboardControls.js\";\nimport { registerComponent } from \"../../registries/components.js\";\nimport { iconClass } from \"../../utils/iconClass.js\";\nimport { useActiveTab, useRegisterTabControl, useTabsUid } from \"./hooks/tabControl.js\";\n\nexport interface TabProps {\n icon?: string;\n isActive?: boolean;\n className?: string;\n after?: React.ReactNode;\n value: number;\n /**\n * on tab select handler\n */\n onClick?: (value: number) => void;\n}\n\nexport function Tab({ onClick, icon, value, children, className, after }: PropsWithChildren<TabProps>) {\n const uid = useTabsUid();\n const ref = useRef<HTMLButtonElement>(null);\n const activeTab = useActiveTab();\n const dispatch = useRegisterTabControl({ value, ref });\n const previousActiveTab = useRef(activeTab);\n\n const isActive = useRef(activeTab === value);\n isActive.current = activeTab === value;\n\n useEffect(() => {\n if (previousActiveTab.current !== activeTab && value === activeTab) {\n ref.current?.focus();\n onClick?.(value);\n }\n if (previousActiveTab.current !== activeTab) {\n previousActiveTab.current = activeTab;\n }\n }, [value, onClick, activeTab]);\n\n const start = useCallback(() => {\n dispatch({ type: \"start\" });\n }, [dispatch]);\n\n const end = useCallback(() => {\n dispatch({ type: \"end\" });\n }, [dispatch]);\n\n const up = useCallback(() => {\n dispatch({ type: \"previous\" });\n }, [dispatch]);\n\n const down = useCallback(() => {\n dispatch({ type: \"next\" });\n }, [dispatch]);\n\n const left = useCallback(() => {\n const isRTL = document.documentElement.dir === \"rtl\";\n\n dispatch({ type: isRTL ? \"next\" : \"previous\" });\n }, [dispatch]);\n\n const right = useCallback(() => {\n const isRTL = document.documentElement.dir === \"rtl\";\n\n dispatch({ type: isRTL ? \"previous\" : \"next\" });\n }, [dispatch]);\n\n const handleKeyDown = useKeyboardControls({\n start,\n end,\n up,\n down,\n left,\n right\n });\n\n const handleClick = useCallback(() => {\n dispatch({ type: \"update\", payload: value });\n }, [dispatch, value]);\n\n return (\n <div title={\"button-wrapper\"} className={classnames(\"tw-tabs__button-wrapper\", className, { \"-active\": isActive.current }, className)}>\n <button\n ref={ref}\n id={`Tab_${value}_${uid}`}\n data-name='Tab'\n title='button-tab'\n role='tab'\n aria-selected={isActive.current}\n aria-controls={`TabPanel_${value}_${uid}`}\n tabIndex={isActive.current ? 0 : -1}\n className={\"tw-tabs__button\"}\n onClick={handleClick}\n onKeyDown={handleKeyDown}\n >\n {icon && <i className={classnames(iconClass(undefined, icon), \"tw-tabs__button-icon\")} />}\n <span className={\"tw-tabs__button-label\"}>{children}</span>\n {after}\n </button>\n <div className='tw-tabs__button-border' />\n </div>\n );\n}\n\nregisterComponent(\"Tab\", Tab);\n"],"names":["Tab","onClick","icon","value","children","className","after","uid","useTabsUid","ref","useRef","activeTab","useActiveTab","dispatch","useRegisterTabControl","previousActiveTab","isActive","useEffect","start","useCallback","end","up","down","left","isRTL","right","handleKeyDown","useKeyboardControls","handleClick","jsxs","classnames","jsx","iconClass","registerComponent"],"mappings":";;;;;;;AAoBO,SAASA,EAAI,EAAE,SAAAC,GAAS,MAAAC,GAAM,OAAAC,GAAO,UAAAC,GAAU,WAAAC,GAAW,OAAAC,KAAsC;AACrG,QAAMC,IAAMC,EAAA,GACNC,IAAMC,EAA0B,IAAI,GACpCC,IAAYC,EAAA,GACZC,IAAWC,EAAsB,EAAE,OAAAX,GAAO,KAAAM,GAAK,GAC/CM,IAAoBL,EAAOC,CAAS,GAEpCK,IAAWN,EAAOC,MAAcR,CAAK;AAC3C,EAAAa,EAAS,UAAUL,MAAcR,GAEjCc,EAAU,MAAM;AACd,IAAIF,EAAkB,YAAYJ,KAAaR,MAAUQ,MACvDF,EAAI,SAAS,MAAA,GACbR,IAAUE,CAAK,IAEbY,EAAkB,YAAYJ,MAChCI,EAAkB,UAAUJ;AAAA,EAEhC,GAAG,CAACR,GAAOF,GAASU,CAAS,CAAC;AAE9B,QAAMO,IAAQC,EAAY,MAAM;AAC9B,IAAAN,EAAS,EAAE,MAAM,SAAS;AAAA,EAC5B,GAAG,CAACA,CAAQ,CAAC,GAEPO,IAAMD,EAAY,MAAM;AAC5B,IAAAN,EAAS,EAAE,MAAM,OAAO;AAAA,EAC1B,GAAG,CAACA,CAAQ,CAAC,GAEPQ,IAAKF,EAAY,MAAM;AAC3B,IAAAN,EAAS,EAAE,MAAM,YAAY;AAAA,EAC/B,GAAG,CAACA,CAAQ,CAAC,GAEPS,IAAOH,EAAY,MAAM;AAC7B,IAAAN,EAAS,EAAE,MAAM,QAAQ;AAAA,EAC3B,GAAG,CAACA,CAAQ,CAAC,GAEPU,IAAOJ,EAAY,MAAM;AAC7B,UAAMK,IAAQ,SAAS,gBAAgB,QAAQ;AAE/C,IAAAX,EAAS,EAAE,MAAMW,IAAQ,SAAS,YAAY;AAAA,EAChD,GAAG,CAACX,CAAQ,CAAC,GAEPY,IAAQN,EAAY,MAAM;AAC9B,UAAMK,IAAQ,SAAS,gBAAgB,QAAQ;AAE/C,IAAAX,EAAS,EAAE,MAAMW,IAAQ,aAAa,QAAQ;AAAA,EAChD,GAAG,CAACX,CAAQ,CAAC,GAEPa,IAAgBC,EAAoB;AAAA,IACxC,OAAAT;AAAA,IACA,KAAAE;AAAA,IACA,IAAAC;AAAA,IACA,MAAAC;AAAA,IACA,MAAAC;AAAA,IACA,OAAAE;AAAA,EAAA,CACD,GAEKG,IAAcT,EAAY,MAAM;AACpC,IAAAN,EAAS,EAAE,MAAM,UAAU,SAASV,GAAO;AAAA,EAC7C,GAAG,CAACU,GAAUV,CAAK,CAAC;AAEpB,SACE,gBAAA0B,EAAC,OAAA,EAAI,OAAO,kBAAkB,WAAWC,EAAW,2BAA2BzB,GAAW,EAAE,WAAWW,EAAS,QAAA,GAAWX,CAAS,GAClI,UAAA;AAAA,IAAA,gBAAAwB;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,KAAApB;AAAA,QACA,IAAI,OAAON,CAAK,IAAII,CAAG;AAAA,QACvB,aAAU;AAAA,QACV,OAAM;AAAA,QACN,MAAK;AAAA,QACL,iBAAeS,EAAS;AAAA,QACxB,iBAAe,YAAYb,CAAK,IAAII,CAAG;AAAA,QACvC,UAAUS,EAAS,UAAU,IAAI;AAAA,QACjC,WAAW;AAAA,QACX,SAASY;AAAA,QACT,WAAWF;AAAA,QAEV,UAAA;AAAA,UAAAxB,KAAQ,gBAAA6B,EAAC,OAAE,WAAWD,EAAWE,EAAU,QAAW9B,CAAI,GAAG,sBAAsB,EAAA,CAAG;AAAA,UACvF,gBAAA6B,EAAC,QAAA,EAAK,WAAW,yBAA0B,UAAA3B,EAAA,CAAS;AAAA,UACnDE;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,IAEH,gBAAAyB,EAAC,OAAA,EAAI,WAAU,yBAAA,CAAyB;AAAA,EAAA,GAC1C;AAEJ;AAEAE,EAAkB,OAAOjC,CAAG;"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
2
|
+
import { Children as o, isValidElement as m } from "react";
|
|
3
|
+
import { registerComponent as p } from "../../registries/components.js";
|
|
4
|
+
function f(i) {
|
|
5
|
+
const s = [], a = [], r = [];
|
|
6
|
+
return o.forEach(i.children, (e) => {
|
|
7
|
+
if (m(e) && e.type?.name === "Tab") {
|
|
8
|
+
r.push(e);
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
r.length > 0 ? a.push(e) : s.push(e);
|
|
12
|
+
}), /* @__PURE__ */ t("nav", { className: "tw-tabs__header", children: /* @__PURE__ */ n("div", { className: "tw-tabs__header-wrapper", children: [
|
|
13
|
+
/* @__PURE__ */ t("div", { className: "tw-tabs__header-border" }),
|
|
14
|
+
s,
|
|
15
|
+
/* @__PURE__ */ t("div", { role: "tablist", children: r }),
|
|
16
|
+
a
|
|
17
|
+
] }) });
|
|
18
|
+
}
|
|
19
|
+
p("TabList", f);
|
|
20
|
+
export {
|
|
21
|
+
f as TabList
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=TabList.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TabList.js","sources":["../../../src/molecules/tabs/TabList.tsx"],"sourcesContent":["import { Children, isValidElement, PropsWithChildren, ReactNode } from \"react\";\n\nimport { registerComponent } from \"../../registries/components.js\";\n\nexport function TabList(props: PropsWithChildren<{}>) {\n const before: ReactNode[] = [];\n const after: ReactNode[] = [];\n const items: ReactNode[] = [];\n\n Children.forEach(props.children, (child) => {\n if (isValidElement(child)) {\n if ((child.type as any)?.name === \"Tab\") {\n items.push(child);\n return;\n }\n }\n\n if (items.length > 0) {\n after.push(child);\n } else {\n before.push(child);\n }\n });\n\n return (\n <nav className='tw-tabs__header'>\n <div className='tw-tabs__header-wrapper'>\n <div className='tw-tabs__header-border' />\n {before}\n <div role='tablist'>{items}</div>\n {after}\n </div>\n </nav>\n );\n}\n\nregisterComponent(\"TabList\", TabList);\n"],"names":["TabList","props","before","after","items","Children","child","isValidElement","jsxs","jsx","registerComponent"],"mappings":";;;AAIO,SAASA,EAAQC,GAA8B;AACpD,QAAMC,IAAsB,CAAA,GACtBC,IAAqB,CAAA,GACrBC,IAAqB,CAAA;AAE3B,SAAAC,EAAS,QAAQJ,EAAM,UAAU,CAACK,MAAU;AAC1C,QAAIC,EAAeD,CAAK,KACjBA,EAAM,MAAc,SAAS,OAAO;AACvC,MAAAF,EAAM,KAAKE,CAAK;AAChB;AAAA,IACF;AAGF,IAAIF,EAAM,SAAS,IACjBD,EAAM,KAAKG,CAAK,IAEhBJ,EAAO,KAAKI,CAAK;AAAA,EAErB,CAAC,qBAGE,OAAA,EAAI,WAAU,mBACb,UAAA,gBAAAE,EAAC,OAAA,EAAI,WAAU,2BACb,UAAA;AAAA,IAAA,gBAAAC,EAAC,OAAA,EAAI,WAAU,yBAAA,CAAyB;AAAA,IACvCP;AAAA,IACD,gBAAAO,EAAC,OAAA,EAAI,MAAK,WAAW,UAAAL,GAAM;AAAA,IAC1BD;AAAA,EAAA,EAAA,CACH,EAAA,CACF;AAEJ;AAEAO,EAAkB,WAAWV,CAAO;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface TabPanelProps {
|
|
2
|
+
className?: string;
|
|
3
|
+
/**
|
|
4
|
+
* Tab panel index<br/>
|
|
5
|
+
* _Can be **0** or **1** indexed_
|
|
6
|
+
*/
|
|
7
|
+
value: number;
|
|
8
|
+
}
|
|
9
|
+
export declare function TabPanel({ value, className, children }: React.PropsWithChildren<TabPanelProps>): import("react/jsx-runtime").JSX.Element;
|