fastapi-rtk 0.1.18 → 0.1.19
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/.bundled/jsonforms/lib/index.d.ts +1 -0
- package/dist/.external/cjs/{@tanstack_react-query@5.75.7_react@18.3.1 → @tanstack_react-query@5.76.1_react@18.3.1}/@tanstack/react-query/build/modern/errorBoundaryUtils.cjs +1 -1
- package/dist/.external/cjs/{@tanstack_react-query@5.75.7_react@18.3.1 → @tanstack_react-query@5.76.1_react@18.3.1}/@tanstack/react-query/build/modern/useBaseQuery.cjs +2 -2
- package/dist/.external/cjs/{@tanstack_react-query@5.75.7_react@18.3.1 → @tanstack_react-query@5.76.1_react@18.3.1}/@tanstack/react-query/build/modern/useQuery.cjs +1 -1
- package/dist/.external/esm/{@tanstack_react-query@5.75.7_react@18.3.1 → @tanstack_react-query@5.76.1_react@18.3.1}/@tanstack/react-query/build/modern/errorBoundaryUtils.mjs +1 -1
- package/dist/.external/esm/{@tanstack_react-query@5.75.7_react@18.3.1 → @tanstack_react-query@5.76.1_react@18.3.1}/@tanstack/react-query/build/modern/useBaseQuery.mjs +2 -2
- package/dist/.external/esm/{@tanstack_react-query@5.75.7_react@18.3.1 → @tanstack_react-query@5.76.1_react@18.3.1}/@tanstack/react-query/build/modern/useQuery.mjs +1 -1
- package/dist/constants/lib/index.d.ts +24 -0
- package/dist/core/cjs/ActionIcons/Add/AddDialog.cjs +4 -3
- package/dist/core/cjs/ActionIcons/Edit/EditDialog.cjs +13 -6
- package/dist/core/cjs/ActionIcons/Modals/CommonModal.cjs +43 -2
- package/dist/core/cjs/Tables/NextGenDataGrid/NextGenDataGrid.cjs +3 -2
- package/dist/core/cjs/Tables/NextGenDataGrid/hooks/useColumns/ColumnHeaderFilter/HeaderInputs/HeaderMultiSelectInput.cjs +2 -1
- package/dist/core/cjs/Tables/NextGenDataGrid/hooks/useColumns/useColumns.cjs +14 -3
- package/dist/core/cjs/Wrappers/ApiProvider/ApiProvider.cjs +21 -5
- package/dist/core/cjs/Wrappers/ApiProvider/Contexts/ApiContext.cjs +2 -2
- package/dist/core/cjs/Wrappers/ApiProvider/Contexts/FormContext.cjs +12 -0
- package/dist/core/cjs/Wrappers/ApiProvider/hooks/useProvideApi.cjs +2 -2
- package/dist/core/cjs/Wrappers/ApiProvider/hooks/useProvideForm.cjs +5 -1
- package/dist/core/cjs/Wrappers/Provider/Contexts/AuthContext.cjs +1 -1
- package/dist/core/cjs/Wrappers/Provider/Provider.cjs +22 -7
- package/dist/core/cjs/Wrappers/Provider/hooks/useProvideAuth.cjs +2 -2
- package/dist/core/cjs/Wrappers/Provider/hooks/useProvideInfo.cjs +1 -1
- package/dist/core/cjs/fab-react-toolkit-patch/api/hooks/useProvideApi.cjs +307 -0
- package/dist/core/cjs/fab-react-toolkit-patch/api/hooks/useProvideBulk.cjs +30 -0
- package/dist/core/cjs/fab-react-toolkit-patch/api/utils/api/createItem.cjs +14 -0
- package/dist/core/cjs/fab-react-toolkit-patch/api/utils/api/deleteItem.cjs +10 -0
- package/dist/core/cjs/fab-react-toolkit-patch/api/utils/api/downloadItems.cjs +41 -0
- package/dist/core/cjs/fab-react-toolkit-patch/api/utils/api/getInfo.cjs +13 -0
- package/dist/core/cjs/fab-react-toolkit-patch/api/utils/api/getItem.cjs +10 -0
- package/dist/core/cjs/fab-react-toolkit-patch/api/utils/api/getItems.cjs +10 -0
- package/dist/core/cjs/fab-react-toolkit-patch/api/utils/api/updateItem.cjs +10 -0
- package/dist/core/cjs/fab-react-toolkit-patch/api/utils/api/uploadItems.cjs +27 -0
- package/dist/core/cjs/fab-react-toolkit-patch/api/utils/api/utils/parseResponse.cjs +19 -0
- package/dist/core/cjs/fab-react-toolkit-patch/api/utils/bulkActions/postBulkAction.cjs +26 -0
- package/dist/core/cjs/fab-react-toolkit-patch/api/utils/convertId.cjs +12 -0
- package/dist/core/cjs/fab-react-toolkit-patch/api/utils/convertInfo.cjs +20 -0
- package/dist/core/cjs/fab-react-toolkit-patch/api/utils/createQueryParams.cjs +18 -0
- package/dist/core/cjs/fab-react-toolkit-patch/api/utils/getDefaultValues.cjs +28 -0
- package/dist/core/cjs/fab-react-toolkit-patch/api/utils/getValidationSchema.cjs +38 -0
- package/dist/core/cjs/fab-react-toolkit-patch/auth/hooks/useProvideAuth.cjs +58 -0
- package/dist/core/cjs/fab-react-toolkit-patch/auth/hooks/useProvideInfo.cjs +19 -0
- package/dist/core/cjs/fab-react-toolkit-patch/auth/utils/authFetch.cjs +90 -0
- package/dist/core/cjs/fab-react-toolkit-patch/auth/utils/userCRUD.cjs +32 -0
- package/dist/core/cjs/fab-react-toolkit-patch/utils/convertToFormInputs.cjs +24 -0
- package/dist/core/esm/ActionIcons/Add/AddDialog.mjs +4 -3
- package/dist/core/esm/ActionIcons/Edit/EditDialog.mjs +13 -6
- package/dist/core/esm/ActionIcons/Modals/CommonModal.mjs +44 -3
- package/dist/core/esm/Tables/NextGenDataGrid/NextGenDataGrid.mjs +3 -2
- package/dist/core/esm/Tables/NextGenDataGrid/hooks/useColumns/ColumnHeaderFilter/HeaderInputs/HeaderMultiSelectInput.mjs +2 -1
- package/dist/core/esm/Tables/NextGenDataGrid/hooks/useColumns/useColumns.mjs +16 -5
- package/dist/core/esm/Wrappers/ApiProvider/ApiProvider.mjs +19 -3
- package/dist/core/esm/Wrappers/ApiProvider/Contexts/ApiContext.mjs +2 -2
- package/dist/core/esm/Wrappers/ApiProvider/Contexts/FormContext.mjs +12 -0
- package/dist/core/esm/Wrappers/ApiProvider/hooks/useProvideApi.mjs +2 -2
- package/dist/core/esm/Wrappers/ApiProvider/hooks/useProvideForm.mjs +5 -1
- package/dist/core/esm/Wrappers/Provider/Contexts/AuthContext.mjs +1 -1
- package/dist/core/esm/Wrappers/Provider/Provider.mjs +20 -5
- package/dist/core/esm/Wrappers/Provider/hooks/useProvideAuth.mjs +2 -2
- package/dist/core/esm/Wrappers/Provider/hooks/useProvideInfo.mjs +1 -1
- package/dist/core/esm/fab-react-toolkit-patch/api/hooks/useProvideApi.mjs +307 -0
- package/dist/core/esm/fab-react-toolkit-patch/api/hooks/useProvideBulk.mjs +30 -0
- package/dist/core/esm/fab-react-toolkit-patch/api/utils/api/createItem.mjs +14 -0
- package/dist/core/esm/fab-react-toolkit-patch/api/utils/api/deleteItem.mjs +10 -0
- package/dist/core/esm/fab-react-toolkit-patch/api/utils/api/downloadItems.mjs +41 -0
- package/dist/core/esm/fab-react-toolkit-patch/api/utils/api/getInfo.mjs +13 -0
- package/dist/core/esm/fab-react-toolkit-patch/api/utils/api/getItem.mjs +10 -0
- package/dist/core/esm/fab-react-toolkit-patch/api/utils/api/getItems.mjs +10 -0
- package/dist/core/esm/fab-react-toolkit-patch/api/utils/api/updateItem.mjs +10 -0
- package/dist/core/esm/fab-react-toolkit-patch/api/utils/api/uploadItems.mjs +27 -0
- package/dist/core/esm/fab-react-toolkit-patch/api/utils/api/utils/parseResponse.mjs +19 -0
- package/dist/core/esm/fab-react-toolkit-patch/api/utils/bulkActions/postBulkAction.mjs +26 -0
- package/dist/core/esm/fab-react-toolkit-patch/api/utils/convertId.mjs +12 -0
- package/dist/core/esm/fab-react-toolkit-patch/api/utils/convertInfo.mjs +20 -0
- package/dist/core/esm/fab-react-toolkit-patch/api/utils/createQueryParams.mjs +18 -0
- package/dist/core/esm/fab-react-toolkit-patch/api/utils/getDefaultValues.mjs +28 -0
- package/dist/core/esm/fab-react-toolkit-patch/api/utils/getValidationSchema.mjs +39 -0
- package/dist/core/esm/fab-react-toolkit-patch/auth/hooks/useProvideAuth.mjs +58 -0
- package/dist/core/esm/fab-react-toolkit-patch/auth/hooks/useProvideInfo.mjs +19 -0
- package/dist/core/esm/fab-react-toolkit-patch/auth/utils/authFetch.mjs +90 -0
- package/dist/core/esm/fab-react-toolkit-patch/auth/utils/userCRUD.mjs +32 -0
- package/dist/core/esm/fab-react-toolkit-patch/utils/convertToFormInputs.mjs +24 -0
- package/dist/core/lib/ActionIcons/Actions.d.ts +1 -0
- package/dist/core/lib/ActionIcons/Add/Add.d.ts +1 -0
- package/dist/core/lib/ActionIcons/Add/AddDialog.d.ts +4 -0
- package/dist/core/lib/ActionIcons/Delete/Delete.d.ts +1 -0
- package/dist/core/lib/ActionIcons/Download/Download.d.ts +1 -0
- package/dist/core/lib/ActionIcons/Edit/Edit.d.ts +1 -0
- package/dist/core/lib/ActionIcons/Edit/EditDialog.d.ts +4 -0
- package/dist/core/lib/ActionIcons/Modals/CommonModal.d.ts +15 -0
- package/dist/core/lib/ActionIcons/Modals/normalProps.d.ts +12 -0
- package/dist/core/lib/ActionIcons/Modals/overlayProps.d.ts +25 -0
- package/dist/core/lib/ActionIcons/Refresh/Refresh.d.ts +1 -0
- package/dist/core/lib/ActionIcons/Upload/Upload.d.ts +1 -0
- package/dist/core/lib/ActionIcons/View/RelationPanel.d.ts +6 -0
- package/dist/core/lib/ActionIcons/View/View.d.ts +1 -0
- package/dist/core/lib/ActionIcons/View/ViewDialog.d.ts +7 -0
- package/dist/core/lib/ActionIcons/utils/convertToFormInputs.d.ts +11 -0
- package/dist/core/lib/Dialogs/AlertDialog/AlertDialog.d.ts +6 -0
- package/dist/core/lib/Menu/UserMenu/UserMenu.d.ts +6 -0
- package/dist/core/lib/Tables/DataGrid/DataGrid.d.ts +1 -0
- package/dist/core/lib/Tables/DataGrid/ErrorDialog.d.ts +1 -0
- package/dist/core/lib/Tables/DataGrid/FormField/FormField.d.ts +8 -0
- package/dist/core/lib/Tables/DataGrid/FormField/Inputs/FormAutocomplete.d.ts +6 -0
- package/dist/core/lib/Tables/DataGrid/FormField/Inputs/FormDatePicker.d.ts +5 -0
- package/dist/core/lib/Tables/DataGrid/FormField/Inputs/FormDateTimePicker.d.ts +5 -0
- package/dist/core/lib/Tables/DataGrid/FormField/Inputs/FormGeometryField.d.ts +6 -0
- package/dist/core/lib/Tables/DataGrid/FormField/Inputs/FormJsonField.d.ts +6 -0
- package/dist/core/lib/Tables/DataGrid/FormField/Inputs/FormRelatedListSelect.d.ts +6 -0
- package/dist/core/lib/Tables/DataGrid/FormField/Inputs/FormRelatedSelect.d.ts +7 -0
- package/dist/core/lib/Tables/DataGrid/FormField/Inputs/FormSelect.d.ts +6 -0
- package/dist/core/lib/Tables/DataGrid/FormField/Inputs/FormTextField.d.ts +5 -0
- package/dist/core/lib/Tables/DataGrid/Main/Body/Body.d.ts +11 -0
- package/dist/core/lib/Tables/DataGrid/Main/Body/Field/Field.d.ts +2 -0
- package/dist/core/lib/Tables/DataGrid/Main/Body/Row/Row.d.ts +5 -0
- package/dist/core/lib/Tables/DataGrid/Main/Header/FieldTitle/FieldTitle.d.ts +12 -0
- package/dist/core/lib/Tables/DataGrid/Main/Header/Header.d.ts +1 -0
- package/dist/core/lib/Tables/DataGrid/Main/Main.d.ts +13 -0
- package/dist/core/lib/Tables/DataGrid/Pagination/Pagination.d.ts +1 -0
- package/dist/core/lib/Tables/DataGrid/Toolbar/Filter/Filter.d.ts +1 -0
- package/dist/core/lib/Tables/DataGrid/Toolbar/Filter/FilterMenu.d.ts +4 -0
- package/dist/core/lib/Tables/DataGrid/Toolbar/Filter/FormFilterField.d.ts +8 -0
- package/dist/core/lib/Tables/DataGrid/Toolbar/Filter/FormFilterIn.d.ts +7 -0
- package/dist/core/lib/Tables/DataGrid/Toolbar/Filter/FormOperatorField.d.ts +8 -0
- package/dist/core/lib/Tables/DataGrid/Toolbar/Settings/Settings.d.ts +0 -0
- package/dist/core/lib/Tables/DataGrid/Toolbar/Toolbar.d.ts +1 -0
- package/dist/core/lib/Tables/NextGenDataGrid/FallbackWrapper.d.ts +12 -0
- package/dist/core/lib/Tables/NextGenDataGrid/NextGenDataGrid.d.ts +133 -0
- package/dist/core/lib/Tables/NextGenDataGrid/hooks/useActions.d.ts +8 -0
- package/dist/core/lib/Tables/NextGenDataGrid/hooks/useCheckbox.d.ts +3 -0
- package/dist/core/lib/Tables/NextGenDataGrid/hooks/useColumns/AdvancedFilters.d.ts +3 -0
- package/dist/core/lib/Tables/NextGenDataGrid/hooks/useColumns/AdvancedFiltersMenu.d.ts +6 -0
- package/dist/core/lib/Tables/NextGenDataGrid/hooks/useColumns/BasicFilters.d.ts +6 -0
- package/dist/core/lib/Tables/NextGenDataGrid/hooks/useColumns/ColumnHeaderFilter/ColumnHeaderFilter.d.ts +15 -0
- package/dist/core/lib/Tables/NextGenDataGrid/hooks/useColumns/ColumnHeaderFilter/HeaderInput.d.ts +9 -0
- package/dist/core/lib/Tables/NextGenDataGrid/hooks/useColumns/ColumnHeaderFilter/HeaderInputs/HeaderBetweenInput.d.ts +1 -0
- package/dist/core/lib/Tables/NextGenDataGrid/hooks/useColumns/ColumnHeaderFilter/HeaderInputs/HeaderBooleanInput.d.ts +1 -0
- package/dist/core/lib/Tables/NextGenDataGrid/hooks/useColumns/ColumnHeaderFilter/HeaderInputs/HeaderDateInput.d.ts +1 -0
- package/dist/core/lib/Tables/NextGenDataGrid/hooks/useColumns/ColumnHeaderFilter/HeaderInputs/HeaderMultiSelectInput.d.ts +1 -0
- package/dist/core/lib/Tables/NextGenDataGrid/hooks/useColumns/ColumnHeaderFilter/HeaderInputs/HeaderNumberInput.d.ts +1 -0
- package/dist/core/lib/Tables/NextGenDataGrid/hooks/useColumns/ColumnHeaderFilter/HeaderInputs/HeaderSelectInput.d.ts +1 -0
- package/dist/core/lib/Tables/NextGenDataGrid/hooks/useColumns/ColumnHeaderFilter/HeaderInputs/HeaderTagsInput.d.ts +1 -0
- package/dist/core/lib/Tables/NextGenDataGrid/hooks/useColumns/ColumnHeaderFilter/HeaderInputs/HeaderTagsNumberInput.d.ts +1 -0
- package/dist/core/lib/Tables/NextGenDataGrid/hooks/useColumns/ColumnHeaderFilter/HeaderInputs/HeaderTextInput.d.ts +1 -0
- package/dist/core/lib/Tables/NextGenDataGrid/hooks/useColumns/FilterMenu.d.ts +9 -0
- package/dist/core/lib/Tables/NextGenDataGrid/hooks/useColumns/MultiLineHighlight.d.ts +5 -0
- package/dist/core/lib/Tables/NextGenDataGrid/hooks/useColumns/useColumns.d.ts +4 -0
- package/dist/core/lib/Tables/NextGenDataGrid/hooks/useColumns/utils.d.ts +1 -0
- package/dist/core/lib/Tables/NextGenDataGrid/hooks/useData.d.ts +7 -0
- package/dist/core/lib/Tables/NextGenDataGrid/hooks/useEvent.d.ts +10 -0
- package/dist/core/lib/Tables/NextGenDataGrid/hooks/useFilters.d.ts +3 -0
- package/dist/core/lib/Tables/NextGenDataGrid/hooks/useGlobalFilter.d.ts +7 -0
- package/dist/core/lib/Tables/NextGenDataGrid/hooks/usePagination.d.ts +14 -0
- package/dist/core/lib/Tables/NextGenDataGrid/hooks/useQueryParams.d.ts +1 -0
- package/dist/core/lib/Tables/NextGenDataGrid/hooks/useSize.d.ts +17 -0
- package/dist/core/lib/Tables/NextGenDataGrid/hooks/useSorting.d.ts +10 -0
- package/dist/core/lib/Tables/NextGenDataGrid/hooks/useToolbar/basicToolbars.d.ts +17 -0
- package/dist/core/lib/Tables/NextGenDataGrid/hooks/useToolbar/useToolbar.d.ts +9 -0
- package/dist/core/lib/Tables/NextGenDataGrid/hooks/useToolbarAlertBanner/FASTAPI_RTK_ToolbarAlertBanner.d.ts +5 -0
- package/dist/core/lib/Tables/NextGenDataGrid/hooks/useToolbarAlertBanner/useToolbarAlertBanner.d.ts +5 -0
- package/dist/core/lib/Tables/NextGenDataGrid/utils.d.ts +6 -0
- package/dist/core/lib/Wrappers/ApiProvider/ApiProvider.d.ts +14 -0
- package/dist/core/lib/Wrappers/ApiProvider/Contexts/ApiContext.d.ts +131 -0
- package/dist/core/lib/Wrappers/ApiProvider/Contexts/BulkActionsContext.d.ts +28 -0
- package/dist/core/lib/Wrappers/ApiProvider/Contexts/FormContext.d.ts +30 -0
- package/dist/core/lib/Wrappers/ApiProvider/hooks/useProvideApi.d.ts +41 -0
- package/dist/core/lib/Wrappers/ApiProvider/hooks/useProvideBulk.d.ts +10 -0
- package/dist/core/lib/Wrappers/ApiProvider/hooks/useProvideForm.d.ts +1 -0
- package/dist/core/lib/Wrappers/ApiProvider/utils/api/createItem.d.ts +1 -0
- package/dist/core/lib/Wrappers/ApiProvider/utils/api/deleteItem.d.ts +1 -0
- package/dist/core/lib/Wrappers/ApiProvider/utils/api/downloadItems.d.ts +1 -0
- package/dist/core/lib/Wrappers/ApiProvider/utils/api/getInfo.d.ts +1 -0
- package/dist/core/lib/Wrappers/ApiProvider/utils/api/getItem.d.ts +1 -0
- package/dist/core/lib/Wrappers/ApiProvider/utils/api/getItems.d.ts +1 -0
- package/dist/core/lib/Wrappers/ApiProvider/utils/api/updateItem.d.ts +1 -0
- package/dist/core/lib/Wrappers/ApiProvider/utils/api/uploadItems.d.ts +1 -0
- package/dist/core/lib/Wrappers/ApiProvider/utils/api/utils/parseResponse.d.ts +1 -0
- package/dist/core/lib/Wrappers/ApiProvider/utils/bulkActions/postBulkAction.d.ts +1 -0
- package/dist/core/lib/Wrappers/ApiProvider/utils/convertId.d.ts +1 -0
- package/dist/core/lib/Wrappers/ApiProvider/utils/convertInfo.d.ts +1 -0
- package/dist/core/lib/Wrappers/ApiProvider/utils/createQueryParams.d.ts +10 -0
- package/dist/core/lib/Wrappers/ApiProvider/utils/getDefaultValues.d.ts +1 -0
- package/dist/core/lib/Wrappers/ApiProvider/utils/getValidationSchema.d.ts +6 -0
- package/dist/core/lib/Wrappers/LazyLoadWrapper/LazyLoadWrapper.d.ts +12 -0
- package/dist/core/lib/Wrappers/Provider/Contexts/AuthContext.d.ts +29 -0
- package/dist/core/lib/Wrappers/Provider/Contexts/InfoContext.d.ts +22 -0
- package/dist/core/lib/Wrappers/Provider/Provider.d.ts +6 -0
- package/dist/core/lib/Wrappers/Provider/hooks/useProvideAuth.d.ts +14 -0
- package/dist/core/lib/Wrappers/Provider/hooks/useProvideInfo.d.ts +6 -0
- package/dist/core/lib/Wrappers/Provider/utils/authFetch.d.ts +53 -0
- package/dist/core/lib/Wrappers/Provider/utils/userCRUD.d.ts +18 -0
- package/dist/core/lib/fab-react-toolkit-patch/api/hooks/useProvideApi.d.ts +41 -0
- package/dist/core/lib/fab-react-toolkit-patch/api/hooks/useProvideBulk.d.ts +10 -0
- package/dist/core/lib/fab-react-toolkit-patch/api/utils/api/createItem.d.ts +1 -0
- package/dist/core/lib/fab-react-toolkit-patch/api/utils/api/deleteItem.d.ts +1 -0
- package/dist/core/lib/fab-react-toolkit-patch/api/utils/api/downloadItems.d.ts +1 -0
- package/dist/core/lib/fab-react-toolkit-patch/api/utils/api/getInfo.d.ts +1 -0
- package/dist/core/lib/fab-react-toolkit-patch/api/utils/api/getItem.d.ts +1 -0
- package/dist/core/lib/fab-react-toolkit-patch/api/utils/api/getItems.d.ts +1 -0
- package/dist/core/lib/fab-react-toolkit-patch/api/utils/api/updateItem.d.ts +1 -0
- package/dist/core/lib/fab-react-toolkit-patch/api/utils/api/uploadItems.d.ts +1 -0
- package/dist/core/lib/fab-react-toolkit-patch/api/utils/api/utils/parseResponse.d.ts +1 -0
- package/dist/core/lib/fab-react-toolkit-patch/api/utils/bulkActions/postBulkAction.d.ts +1 -0
- package/dist/core/lib/fab-react-toolkit-patch/api/utils/convertId.d.ts +1 -0
- package/dist/core/lib/fab-react-toolkit-patch/api/utils/convertInfo.d.ts +1 -0
- package/dist/core/lib/fab-react-toolkit-patch/api/utils/createQueryParams.d.ts +10 -0
- package/dist/core/lib/fab-react-toolkit-patch/api/utils/getDefaultValues.d.ts +1 -0
- package/dist/core/lib/fab-react-toolkit-patch/api/utils/getValidationSchema.d.ts +6 -0
- package/dist/core/lib/fab-react-toolkit-patch/auth/hooks/useProvideAuth.d.ts +14 -0
- package/dist/core/lib/fab-react-toolkit-patch/auth/hooks/useProvideInfo.d.ts +7 -0
- package/dist/core/lib/fab-react-toolkit-patch/auth/utils/authFetch.d.ts +53 -0
- package/dist/core/lib/fab-react-toolkit-patch/auth/utils/userCRUD.d.ts +18 -0
- package/dist/core/lib/fab-react-toolkit-patch/utils/convertToFormInputs.d.ts +9 -0
- package/dist/core/lib/hooks/api/useApi.d.ts +66 -0
- package/dist/core/lib/hooks/api/useBulkActions.d.ts +11 -0
- package/dist/core/lib/hooks/api/useForms.d.ts +15 -0
- package/dist/core/lib/hooks/auth/useAuth.d.ts +23 -0
- package/dist/core/lib/hooks/auth/useInfo.d.ts +16 -0
- package/dist/core/lib/index.d.ts +21 -0
- package/dist/core/lib/sub-packages-exporter.d.ts +5 -0
- package/dist/hooks/lib/index.d.ts +3 -0
- package/dist/hooks/lib/useActionIcon/useActionIcon.d.ts +9 -0
- package/dist/hooks/lib/useCustomFetch/useCustomFetch.d.ts +11 -0
- package/dist/hooks/lib/useTrueOnce/useTrueOnce.d.ts +7 -0
- package/dist/jsonforms/lib/JsonFormsWithCustomizer/JsonFormsWithCustomizer.d.ts +1 -0
- package/dist/jsonforms/lib/MantineInputs/MantineBooleanInput.d.ts +1 -0
- package/dist/jsonforms/lib/MantineInputs/MantineDateInput.d.ts +1 -0
- package/dist/jsonforms/lib/MantineInputs/MantineDateTimeInput.d.ts +1 -0
- package/dist/jsonforms/lib/MantineInputs/MantineEnumArrayInput.d.ts +1 -0
- package/dist/jsonforms/lib/MantineInputs/MantineEnumInput.d.ts +1 -0
- package/dist/jsonforms/lib/MantineInputs/MantineJsonInput.d.ts +1 -0
- package/dist/jsonforms/lib/MantineInputs/MantineNumberInput.d.ts +1 -0
- package/dist/jsonforms/lib/MantineInputs/MantineObjectInput.d.ts +1 -0
- package/dist/jsonforms/lib/MantineInputs/MantineOneOfEnumInput.d.ts +1 -0
- package/dist/jsonforms/lib/MantineInputs/MantineTextInput.d.ts +1 -0
- package/dist/jsonforms/lib/cells/MantineBooleanCell.d.ts +2 -0
- package/dist/jsonforms/lib/cells/MantineDateCell.d.ts +2 -0
- package/dist/jsonforms/lib/cells/MantineDateTimeCell.d.ts +2 -0
- package/dist/jsonforms/lib/cells/MantineEnumArrayCell.d.ts +2 -0
- package/dist/jsonforms/lib/cells/MantineEnumCell.d.ts +2 -0
- package/dist/jsonforms/lib/cells/MantineIntegerCell.d.ts +2 -0
- package/dist/jsonforms/lib/cells/MantineJsonCell.d.ts +2 -0
- package/dist/jsonforms/lib/cells/MantineNumberCell.d.ts +2 -0
- package/dist/jsonforms/lib/cells/MantineOneOfEnumCell.d.ts +2 -0
- package/dist/jsonforms/lib/cells/MantineTextCell.d.ts +2 -0
- package/dist/jsonforms/lib/complex/MantineArrayControl/DeleteDialog.d.ts +2 -0
- package/dist/jsonforms/lib/complex/MantineArrayControl/MantineArrayControl.d.ts +2 -0
- package/dist/jsonforms/lib/complex/MantineEnumArrayControl.d.ts +2 -0
- package/dist/jsonforms/lib/complex/MantineObjectControl.d.ts +2 -0
- package/dist/jsonforms/lib/complex/MantineTableControl/MantineTableControl.d.ts +3 -0
- package/dist/jsonforms/lib/complex/MantineTableControl/NoBorderTableCell.d.ts +4 -0
- package/dist/jsonforms/lib/complex/MantineTableControl/TableToolbar.d.ts +1 -0
- package/dist/jsonforms/lib/complex/MantineTableControl/ValidationIcon.d.ts +4 -0
- package/dist/jsonforms/lib/controls/MantineBooleanControl.d.ts +2 -0
- package/dist/jsonforms/lib/controls/MantineDateControl.d.ts +2 -0
- package/dist/jsonforms/lib/controls/MantineDateTimeControl.d.ts +2 -0
- package/dist/jsonforms/lib/controls/MantineEnumControl.d.ts +2 -0
- package/dist/jsonforms/lib/controls/MantineIntegerControl.d.ts +2 -0
- package/dist/jsonforms/lib/controls/MantineJsonControl.d.ts +2 -0
- package/dist/jsonforms/lib/controls/MantineNumberControl.d.ts +2 -0
- package/dist/jsonforms/lib/controls/MantineOneOfEnumControl.d.ts +2 -0
- package/dist/jsonforms/lib/controls/MantineTextControl.d.ts +2 -0
- package/dist/jsonforms/lib/hooks/useBooleanProps.d.ts +26 -0
- package/dist/jsonforms/lib/hooks/useCommonProps.d.ts +30 -0
- package/dist/jsonforms/lib/hooks/useContextProps.d.ts +11 -0
- package/dist/jsonforms/lib/hooks/useDateProps.d.ts +21 -0
- package/dist/jsonforms/lib/hooks/useJsonProps.d.ts +21 -0
- package/dist/jsonforms/lib/hooks/useMultiSelectProps.d.ts +20 -0
- package/dist/jsonforms/lib/hooks/useNumberProps.d.ts +18 -0
- package/dist/jsonforms/lib/hooks/useSelectProps.d.ts +23 -0
- package/dist/jsonforms/lib/hooks/useTextProps.d.ts +15 -0
- package/dist/jsonforms/lib/hooks/useThemeCustomizer.d.ts +141 -0
- package/dist/jsonforms/lib/index.d.ts +19 -0
- package/dist/jsonforms/lib/labels/MantineLabelRenderer.d.ts +2 -0
- package/dist/jsonforms/lib/layouts/MantineGroupLayoutRenderer.d.ts +2 -0
- package/dist/jsonforms/lib/layouts/MantineHotizontalLayoutRenderer.d.ts +2 -0
- package/dist/jsonforms/lib/layouts/MantineVerticalLayoutRenderer.d.ts +2 -0
- package/dist/jsonforms/lib/renderers/mantineCells.d.ts +7 -0
- package/dist/jsonforms/lib/renderers/mantineRenderers.d.ts +10 -0
- package/dist/jsonforms/lib/testers/isEnumArrayArrayControl.d.ts +13 -0
- package/dist/jsonforms/lib/testers/isEnumArrayControl.d.ts +13 -0
- package/dist/jsonforms/lib/testers/isJsonArrayControl.d.ts +13 -0
- package/dist/jsonforms/lib/testers/isJsonControl.d.ts +13 -0
- package/dist/jsonforms/lib/utils/debounce.d.ts +1 -0
- package/dist/jsonforms/lib/utils/isSchemaTypeInclude.d.ts +8 -0
- package/dist/jsonforms/lib/utils/layout.d.ts +10 -0
- package/dist/jsonforms/lib/utils/utcConverter.d.ts +25 -0
- package/dist/utils/cjs/parseValue/parseValue.cjs +1 -1
- package/dist/utils/esm/parseValue/parseValue.mjs +1 -1
- package/dist/utils/lib/createFetchParams/createFetchParams.d.ts +19 -0
- package/dist/utils/lib/deepMerge/deepMerge.d.ts +1 -0
- package/dist/utils/lib/getValue/getValue.d.ts +1 -0
- package/dist/utils/lib/getValueOrDefault/getValueOrDefault.d.ts +1 -0
- package/dist/utils/lib/index.d.ts +8 -0
- package/dist/utils/lib/isTruthy/isTruthy.d.ts +9 -0
- package/dist/utils/lib/parseFromValuesOrFunc/parseFromValuesOrFunc.d.ts +1 -0
- package/dist/utils/lib/parseValue/parseValue.d.ts +1 -0
- package/dist/utils/lib/urlJoin/urlJoin.d.ts +2 -0
- package/dist/zustand/lib/index.d.ts +3 -0
- package/dist/zustand/lib/useProxy/useProxy.d.ts +11 -0
- package/dist/zustand/lib/utils/compareStateWithStore.d.ts +1 -0
- package/dist/zustand/lib/utils/createProxy.d.ts +1 -0
- package/package.json +12 -2
- /package/dist/.external/cjs/{@tanstack_query-core@5.75.7 → @tanstack_query-core@5.76.0}/@tanstack/query-core/build/modern/focusManager.cjs +0 -0
- /package/dist/.external/cjs/{@tanstack_query-core@5.75.7 → @tanstack_query-core@5.76.0}/@tanstack/query-core/build/modern/infiniteQueryBehavior.cjs +0 -0
- /package/dist/.external/cjs/{@tanstack_query-core@5.75.7 → @tanstack_query-core@5.76.0}/@tanstack/query-core/build/modern/mutation.cjs +0 -0
- /package/dist/.external/cjs/{@tanstack_query-core@5.75.7 → @tanstack_query-core@5.76.0}/@tanstack/query-core/build/modern/mutationCache.cjs +0 -0
- /package/dist/.external/cjs/{@tanstack_query-core@5.75.7 → @tanstack_query-core@5.76.0}/@tanstack/query-core/build/modern/notifyManager.cjs +0 -0
- /package/dist/.external/cjs/{@tanstack_query-core@5.75.7 → @tanstack_query-core@5.76.0}/@tanstack/query-core/build/modern/onlineManager.cjs +0 -0
- /package/dist/.external/cjs/{@tanstack_query-core@5.75.7 → @tanstack_query-core@5.76.0}/@tanstack/query-core/build/modern/query.cjs +0 -0
- /package/dist/.external/cjs/{@tanstack_query-core@5.75.7 → @tanstack_query-core@5.76.0}/@tanstack/query-core/build/modern/queryCache.cjs +0 -0
- /package/dist/.external/cjs/{@tanstack_query-core@5.75.7 → @tanstack_query-core@5.76.0}/@tanstack/query-core/build/modern/queryClient.cjs +0 -0
- /package/dist/.external/cjs/{@tanstack_query-core@5.75.7 → @tanstack_query-core@5.76.0}/@tanstack/query-core/build/modern/queryObserver.cjs +0 -0
- /package/dist/.external/cjs/{@tanstack_query-core@5.75.7 → @tanstack_query-core@5.76.0}/@tanstack/query-core/build/modern/removable.cjs +0 -0
- /package/dist/.external/cjs/{@tanstack_query-core@5.75.7 → @tanstack_query-core@5.76.0}/@tanstack/query-core/build/modern/retryer.cjs +0 -0
- /package/dist/.external/cjs/{@tanstack_query-core@5.75.7 → @tanstack_query-core@5.76.0}/@tanstack/query-core/build/modern/subscribable.cjs +0 -0
- /package/dist/.external/cjs/{@tanstack_query-core@5.75.7 → @tanstack_query-core@5.76.0}/@tanstack/query-core/build/modern/thenable.cjs +0 -0
- /package/dist/.external/cjs/{@tanstack_query-core@5.75.7 → @tanstack_query-core@5.76.0}/@tanstack/query-core/build/modern/utils.cjs +0 -0
- /package/dist/.external/cjs/{@tanstack_react-query@5.75.7_react@18.3.1 → @tanstack_react-query@5.76.1_react@18.3.1}/@tanstack/react-query/build/modern/IsRestoringProvider.cjs +0 -0
- /package/dist/.external/cjs/{@tanstack_react-query@5.75.7_react@18.3.1 → @tanstack_react-query@5.76.1_react@18.3.1}/@tanstack/react-query/build/modern/QueryClientProvider.cjs +0 -0
- /package/dist/.external/cjs/{@tanstack_react-query@5.75.7_react@18.3.1 → @tanstack_react-query@5.76.1_react@18.3.1}/@tanstack/react-query/build/modern/QueryErrorResetBoundary.cjs +0 -0
- /package/dist/.external/cjs/{@tanstack_react-query@5.75.7_react@18.3.1 → @tanstack_react-query@5.76.1_react@18.3.1}/@tanstack/react-query/build/modern/suspense.cjs +0 -0
- /package/dist/.external/esm/{@tanstack_query-core@5.75.7 → @tanstack_query-core@5.76.0}/@tanstack/query-core/build/modern/focusManager.mjs +0 -0
- /package/dist/.external/esm/{@tanstack_query-core@5.75.7 → @tanstack_query-core@5.76.0}/@tanstack/query-core/build/modern/infiniteQueryBehavior.mjs +0 -0
- /package/dist/.external/esm/{@tanstack_query-core@5.75.7 → @tanstack_query-core@5.76.0}/@tanstack/query-core/build/modern/mutation.mjs +0 -0
- /package/dist/.external/esm/{@tanstack_query-core@5.75.7 → @tanstack_query-core@5.76.0}/@tanstack/query-core/build/modern/mutationCache.mjs +0 -0
- /package/dist/.external/esm/{@tanstack_query-core@5.75.7 → @tanstack_query-core@5.76.0}/@tanstack/query-core/build/modern/notifyManager.mjs +0 -0
- /package/dist/.external/esm/{@tanstack_query-core@5.75.7 → @tanstack_query-core@5.76.0}/@tanstack/query-core/build/modern/onlineManager.mjs +0 -0
- /package/dist/.external/esm/{@tanstack_query-core@5.75.7 → @tanstack_query-core@5.76.0}/@tanstack/query-core/build/modern/query.mjs +0 -0
- /package/dist/.external/esm/{@tanstack_query-core@5.75.7 → @tanstack_query-core@5.76.0}/@tanstack/query-core/build/modern/queryCache.mjs +0 -0
- /package/dist/.external/esm/{@tanstack_query-core@5.75.7 → @tanstack_query-core@5.76.0}/@tanstack/query-core/build/modern/queryClient.mjs +0 -0
- /package/dist/.external/esm/{@tanstack_query-core@5.75.7 → @tanstack_query-core@5.76.0}/@tanstack/query-core/build/modern/queryObserver.mjs +0 -0
- /package/dist/.external/esm/{@tanstack_query-core@5.75.7 → @tanstack_query-core@5.76.0}/@tanstack/query-core/build/modern/removable.mjs +0 -0
- /package/dist/.external/esm/{@tanstack_query-core@5.75.7 → @tanstack_query-core@5.76.0}/@tanstack/query-core/build/modern/retryer.mjs +0 -0
- /package/dist/.external/esm/{@tanstack_query-core@5.75.7 → @tanstack_query-core@5.76.0}/@tanstack/query-core/build/modern/subscribable.mjs +0 -0
- /package/dist/.external/esm/{@tanstack_query-core@5.75.7 → @tanstack_query-core@5.76.0}/@tanstack/query-core/build/modern/thenable.mjs +0 -0
- /package/dist/.external/esm/{@tanstack_query-core@5.75.7 → @tanstack_query-core@5.76.0}/@tanstack/query-core/build/modern/utils.mjs +0 -0
- /package/dist/.external/esm/{@tanstack_react-query@5.75.7_react@18.3.1 → @tanstack_react-query@5.76.1_react@18.3.1}/@tanstack/react-query/build/modern/IsRestoringProvider.mjs +0 -0
- /package/dist/.external/esm/{@tanstack_react-query@5.75.7_react@18.3.1 → @tanstack_react-query@5.76.1_react@18.3.1}/@tanstack/react-query/build/modern/QueryClientProvider.mjs +0 -0
- /package/dist/.external/esm/{@tanstack_react-query@5.75.7_react@18.3.1 → @tanstack_react-query@5.76.1_react@18.3.1}/@tanstack/react-query/build/modern/QueryErrorResetBoundary.mjs +0 -0
- /package/dist/.external/esm/{@tanstack_react-query@5.75.7_react@18.3.1 → @tanstack_react-query@5.76.1_react@18.3.1}/@tanstack/react-query/build/modern/suspense.mjs +0 -0
|
@@ -1,22 +1,37 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useProxy } from "fastapi-rtk/zustand";
|
|
3
|
-
import { QueryClient } from "../../../../.external/esm/@tanstack_query-core@5.
|
|
4
|
-
import { QueryClientProvider } from "../../../../.external/esm/@tanstack_react-query@5.
|
|
3
|
+
import { QueryClient } from "../../../../.external/esm/@tanstack_query-core@5.76.0/@tanstack/query-core/build/modern/queryClient.mjs";
|
|
4
|
+
import { QueryClientProvider } from "../../../../.external/esm/@tanstack_react-query@5.76.1_react@18.3.1/@tanstack/react-query/build/modern/QueryClientProvider.mjs";
|
|
5
5
|
import { useState } from "react";
|
|
6
|
+
import { useFabProvideAuth } from "../../fab-react-toolkit-patch/auth/hooks/useProvideAuth.mjs";
|
|
7
|
+
import { useFabProvideInfo } from "../../fab-react-toolkit-patch/auth/hooks/useProvideInfo.mjs";
|
|
6
8
|
import { AuthContext } from "./Contexts/AuthContext.mjs";
|
|
7
9
|
import { InfoContext } from "./Contexts/InfoContext.mjs";
|
|
8
10
|
import { useProvideAuth } from "./hooks/useProvideAuth.mjs";
|
|
9
11
|
import { useProvideInfo } from "./hooks/useProvideInfo.mjs";
|
|
12
|
+
function useAuth(baseUrl, authQueryProps, fab) {
|
|
13
|
+
if (fab) {
|
|
14
|
+
return useFabProvideAuth(baseUrl, authQueryProps);
|
|
15
|
+
}
|
|
16
|
+
return useProvideAuth(baseUrl, authQueryProps);
|
|
17
|
+
}
|
|
18
|
+
function useInfo(baseUrl, auth, fab) {
|
|
19
|
+
if (fab) {
|
|
20
|
+
return useFabProvideInfo(baseUrl, auth);
|
|
21
|
+
}
|
|
22
|
+
return useProvideInfo(baseUrl, auth);
|
|
23
|
+
}
|
|
10
24
|
function InnerProvider(providerProps) {
|
|
11
25
|
const defaultproviderProps = { baseUrl: new URL(document.baseURI).pathname + "/api/v1", inheritMantineTheme: false };
|
|
12
26
|
const { baseUrl, authQueryProps, children } = { ...defaultproviderProps, ...providerProps };
|
|
13
|
-
const auth =
|
|
27
|
+
const auth = useAuth(baseUrl, authQueryProps, providerProps.fab);
|
|
14
28
|
const authProxy = useProxy(auth);
|
|
15
|
-
const info =
|
|
29
|
+
const info = useInfo(baseUrl, auth, providerProps.fab);
|
|
16
30
|
const infoProxy = useProxy(info);
|
|
17
31
|
return /* @__PURE__ */ jsx(AuthContext.Provider, { value: authProxy, children: /* @__PURE__ */ jsx(InfoContext.Provider, { value: infoProxy, children }) });
|
|
18
32
|
}
|
|
19
|
-
const Provider = (
|
|
33
|
+
const Provider = ({ fab, baseUrl, authQueryProps, ...rest }) => {
|
|
34
|
+
const props = { fab, baseUrl, authQueryProps, ...rest };
|
|
20
35
|
const [queryClient] = useState(() => new QueryClient());
|
|
21
36
|
return /* @__PURE__ */ jsx(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsx(InnerProvider, { ...props }) });
|
|
22
37
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useQuery } from "../../../../../.external/esm/@tanstack_react-query@5.
|
|
2
|
-
import { useQueryClient } from "../../../../../.external/esm/@tanstack_react-query@5.
|
|
1
|
+
import { useQuery } from "../../../../../.external/esm/@tanstack_react-query@5.76.1_react@18.3.1/@tanstack/react-query/build/modern/useQuery.mjs";
|
|
2
|
+
import { useQueryClient } from "../../../../../.external/esm/@tanstack_react-query@5.76.1_react@18.3.1/@tanstack/react-query/build/modern/QueryClientProvider.mjs";
|
|
3
3
|
import { useState, useCallback } from "react";
|
|
4
4
|
import { authSignin, authSignout, authResetPassword, authOAuthSignin } from "../utils/authFetch.mjs";
|
|
5
5
|
import { getUser, updateUser } from "../utils/userCRUD.mjs";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useQuery } from "../../../../../.external/esm/@tanstack_react-query@5.
|
|
1
|
+
import { useQuery } from "../../../../../.external/esm/@tanstack_react-query@5.76.1_react@18.3.1/@tanstack/react-query/build/modern/useQuery.mjs";
|
|
2
2
|
import { useEffect } from "react";
|
|
3
3
|
import { authInfo } from "../utils/authFetch.mjs";
|
|
4
4
|
function useProvideInfo(baseUrl, auth) {
|
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
import { useState, useRef, useEffect, useMemo, useCallback } from "react";
|
|
2
|
+
import { urlJoin } from "fastapi-rtk/utils";
|
|
3
|
+
import { useDidUpdate, useSetState } from "@mantine/hooks";
|
|
4
|
+
import { keepPreviousData } from "../../../../../.external/esm/@tanstack_query-core@5.76.0/@tanstack/query-core/build/modern/utils.mjs";
|
|
5
|
+
import { useQuery } from "../../../../../.external/esm/@tanstack_react-query@5.76.1_react@18.3.1/@tanstack/react-query/build/modern/useQuery.mjs";
|
|
6
|
+
import { createItem } from "../utils/api/createItem.mjs";
|
|
7
|
+
import { deleteItem } from "../utils/api/deleteItem.mjs";
|
|
8
|
+
import { downloadItems } from "../utils/api/downloadItems.mjs";
|
|
9
|
+
import { getInfo } from "../utils/api/getInfo.mjs";
|
|
10
|
+
import { getItem } from "../utils/api/getItem.mjs";
|
|
11
|
+
import { getItems } from "../utils/api/getItems.mjs";
|
|
12
|
+
import { updateItem } from "../utils/api/updateItem.mjs";
|
|
13
|
+
import { uploadItems } from "../utils/api/uploadItems.mjs";
|
|
14
|
+
import { convertId } from "../utils/convertId.mjs";
|
|
15
|
+
import { convertInfo } from "../utils/convertInfo.mjs";
|
|
16
|
+
import { createQueryParams } from "../utils/createQueryParams.mjs";
|
|
17
|
+
function useFabProvideApi({
|
|
18
|
+
path,
|
|
19
|
+
initialQueryParams,
|
|
20
|
+
relation,
|
|
21
|
+
fetchInfo = true,
|
|
22
|
+
clearInfoOnRefetch = false,
|
|
23
|
+
clearDataOnRefetch = false,
|
|
24
|
+
resetQueryParamsOnPathChange = true,
|
|
25
|
+
infoQueryProps,
|
|
26
|
+
dataQueryProps,
|
|
27
|
+
throwOnError = false,
|
|
28
|
+
streaming: streamingMode = false
|
|
29
|
+
}) {
|
|
30
|
+
const [queryParams, setQueryParams] = useState(
|
|
31
|
+
initialQueryParams ? createQueryParams(null, initialQueryParams) : null
|
|
32
|
+
);
|
|
33
|
+
const pathRef = useRef(path);
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
pathRef.current = path;
|
|
36
|
+
}, [path]);
|
|
37
|
+
const memoizedQueryParamsPathRef = useRef(path);
|
|
38
|
+
const memoizedQueryParams = useMemo(
|
|
39
|
+
() => {
|
|
40
|
+
memoizedQueryParamsPathRef.current = path;
|
|
41
|
+
return queryParams ? {
|
|
42
|
+
...queryParams,
|
|
43
|
+
...relation ? {
|
|
44
|
+
filters: [
|
|
45
|
+
...queryParams.filters || [],
|
|
46
|
+
{ col: relation.foreign_key, opr: relation.type, value: convertId(relation.id) }
|
|
47
|
+
]
|
|
48
|
+
} : {}
|
|
49
|
+
} : null;
|
|
50
|
+
},
|
|
51
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
52
|
+
[queryParams, relation]
|
|
53
|
+
);
|
|
54
|
+
const queryParamsRef = useRef(memoizedQueryParams);
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
queryParamsRef.current = memoizedQueryParams;
|
|
57
|
+
}, [memoizedQueryParams]);
|
|
58
|
+
const setQueryParamsCallback = useCallback(
|
|
59
|
+
(partialQueryParams) => setQueryParams((prev) => {
|
|
60
|
+
if (typeof partialQueryParams === "function") {
|
|
61
|
+
partialQueryParams = partialQueryParams(prev);
|
|
62
|
+
}
|
|
63
|
+
if (!prev) {
|
|
64
|
+
return createQueryParams(null, partialQueryParams);
|
|
65
|
+
}
|
|
66
|
+
const newQueryParams = createQueryParams({ ...prev }, partialQueryParams);
|
|
67
|
+
if (partialQueryParams) {
|
|
68
|
+
if ((partialQueryParams.filters || partialQueryParams.order_column || partialQueryParams.order_direction) && !partialQueryParams.page) {
|
|
69
|
+
newQueryParams.page = 0;
|
|
70
|
+
}
|
|
71
|
+
if (streamingMode) {
|
|
72
|
+
if (partialQueryParams.page && partialQueryParams.page !== prev.page && !partialQueryParams.streaming) {
|
|
73
|
+
throw new Error("You cannot change page in streaming mode, use streaming.fetch() instead");
|
|
74
|
+
}
|
|
75
|
+
if (partialQueryParams.page_size && partialQueryParams.page_size !== prev.page_size) {
|
|
76
|
+
throw new Error("You cannot change page size in streaming mode, use streaming.fetch() instead");
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return newQueryParams;
|
|
81
|
+
}),
|
|
82
|
+
[streamingMode]
|
|
83
|
+
);
|
|
84
|
+
const [error, setError] = useState(null);
|
|
85
|
+
const memoizedError = useMemo(() => error, [error]);
|
|
86
|
+
const resetError = useCallback(() => setError(null), []);
|
|
87
|
+
const {
|
|
88
|
+
data: info,
|
|
89
|
+
isFetching: infoLoading,
|
|
90
|
+
refetch: infoRefetch,
|
|
91
|
+
error: infoError
|
|
92
|
+
} = useQuery({
|
|
93
|
+
queryKey: [`info`, path],
|
|
94
|
+
queryFn: ({ signal }) => getInfo(urlJoin(path, "_info"), signal).then((data2) => ({ ...convertInfo(data2), path })),
|
|
95
|
+
placeholderData: clearInfoOnRefetch ? null : keepPreviousData,
|
|
96
|
+
enabled: fetchInfo,
|
|
97
|
+
retry: false,
|
|
98
|
+
refetchOnMount: false,
|
|
99
|
+
refetchOnReconnect: false,
|
|
100
|
+
refetchOnWindowFocus: false,
|
|
101
|
+
...infoQueryProps
|
|
102
|
+
});
|
|
103
|
+
const {
|
|
104
|
+
data,
|
|
105
|
+
isFetching: dataLoading,
|
|
106
|
+
refetch: dataRefetch,
|
|
107
|
+
error: dataError
|
|
108
|
+
} = useQuery({
|
|
109
|
+
queryKey: [`data`, memoizedQueryParamsPathRef.current, JSON.stringify(memoizedQueryParams)],
|
|
110
|
+
queryFn: ({ signal }) => memoizedQueryParams ? getItems(urlJoin(memoizedQueryParamsPathRef.current, "/"), memoizedQueryParams, signal).then((data2) => ({
|
|
111
|
+
...data2,
|
|
112
|
+
result: data2.result.map((item, index) => ({ ...item, id: data2.ids[index] })),
|
|
113
|
+
path: memoizedQueryParamsPathRef.current
|
|
114
|
+
})) : null,
|
|
115
|
+
placeholderData: clearDataOnRefetch ? null : keepPreviousData,
|
|
116
|
+
retry: false,
|
|
117
|
+
...dataQueryProps
|
|
118
|
+
});
|
|
119
|
+
useEffect(() => {
|
|
120
|
+
if (infoError) {
|
|
121
|
+
setError({ message: `Couldn't fetch info`, originalError: infoError });
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
if (dataError) {
|
|
125
|
+
setError({ message: `Couldn't fetch list`, originalError: dataError });
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
resetError();
|
|
129
|
+
}, [infoError, dataError, resetError]);
|
|
130
|
+
const loading = useMemo(() => infoLoading || dataLoading, [infoLoading, dataLoading]);
|
|
131
|
+
useDidUpdate(() => {
|
|
132
|
+
if (!resetQueryParamsOnPathChange) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
const newQueryParams = createQueryParams(null, initialQueryParams);
|
|
136
|
+
if (queryParams == null ? void 0 : queryParams.page_size) {
|
|
137
|
+
newQueryParams.page_size = queryParams.page_size;
|
|
138
|
+
}
|
|
139
|
+
setQueryParams({ ...newQueryParams });
|
|
140
|
+
}, [path]);
|
|
141
|
+
const getEntry = useCallback(
|
|
142
|
+
async (id) => {
|
|
143
|
+
try {
|
|
144
|
+
const response = await getItem(pathRef.current, convertId(id));
|
|
145
|
+
resetError();
|
|
146
|
+
return response;
|
|
147
|
+
} catch (error2) {
|
|
148
|
+
setError({ message: `Couldn't fetch item with id ${id}`, originalError: error2 });
|
|
149
|
+
if (throwOnError) {
|
|
150
|
+
throw error2;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
[resetError, throwOnError]
|
|
155
|
+
);
|
|
156
|
+
const addEntry = useCallback(
|
|
157
|
+
async (item) => {
|
|
158
|
+
try {
|
|
159
|
+
const response = await createItem(pathRef.current, item);
|
|
160
|
+
resetError();
|
|
161
|
+
return response;
|
|
162
|
+
} catch (error2) {
|
|
163
|
+
setError({ message: `Couldn't add item`, originalError: error2 });
|
|
164
|
+
if (throwOnError) {
|
|
165
|
+
throw error2;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
[resetError, throwOnError]
|
|
170
|
+
);
|
|
171
|
+
const updateEntry = useCallback(
|
|
172
|
+
async (id, item) => {
|
|
173
|
+
try {
|
|
174
|
+
const response = await updateItem(pathRef.current, convertId(id), item);
|
|
175
|
+
resetError();
|
|
176
|
+
return response;
|
|
177
|
+
} catch (error2) {
|
|
178
|
+
setError({ message: `Couldn't update item with id ${id}`, originalError: error2 });
|
|
179
|
+
if (throwOnError) {
|
|
180
|
+
throw error2;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
[resetError, throwOnError]
|
|
185
|
+
);
|
|
186
|
+
const deleteEntry = useCallback(
|
|
187
|
+
async (id) => {
|
|
188
|
+
try {
|
|
189
|
+
const response = await deleteItem(pathRef.current, convertId(id));
|
|
190
|
+
resetError();
|
|
191
|
+
return response;
|
|
192
|
+
} catch (error2) {
|
|
193
|
+
setError({ message: `Couldn't delete item with id ${id}`, originalError: error2 });
|
|
194
|
+
if (throwOnError) {
|
|
195
|
+
throw error2;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
[resetError, throwOnError]
|
|
200
|
+
);
|
|
201
|
+
const download = useCallback(
|
|
202
|
+
async (label, { export_mode, delimiter, quotechar } = {}) => {
|
|
203
|
+
try {
|
|
204
|
+
await downloadItems(pathRef.current, queryParamsRef.current, { label, export_mode, delimiter, quotechar });
|
|
205
|
+
resetError();
|
|
206
|
+
} catch (error2) {
|
|
207
|
+
setError({ message: `Couldn't download`, originalError: error2 });
|
|
208
|
+
if (throwOnError) {
|
|
209
|
+
throw error2;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
},
|
|
213
|
+
[resetError, throwOnError]
|
|
214
|
+
);
|
|
215
|
+
const upload = useCallback(
|
|
216
|
+
async (file, { delimiter, quotechar } = {}) => {
|
|
217
|
+
try {
|
|
218
|
+
const response = await uploadItems(pathRef.current, file, { delimiter, quotechar });
|
|
219
|
+
resetError();
|
|
220
|
+
return response;
|
|
221
|
+
} catch (error2) {
|
|
222
|
+
setError({ message: `Couldn't upload`, originalError: error2 });
|
|
223
|
+
if (throwOnError) {
|
|
224
|
+
throw error2;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
},
|
|
228
|
+
[resetError, throwOnError]
|
|
229
|
+
);
|
|
230
|
+
const [streaming, setStreaming] = useSetState({
|
|
231
|
+
data: {},
|
|
232
|
+
isEnd: false,
|
|
233
|
+
fetch: () => null
|
|
234
|
+
});
|
|
235
|
+
useEffect(() => {
|
|
236
|
+
if (!streamingMode) {
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
setStreaming({
|
|
240
|
+
fetch: () => setQueryParamsCallback({ page: 0, streaming: true })
|
|
241
|
+
});
|
|
242
|
+
}, [setQueryParamsCallback, setStreaming, streamingMode]);
|
|
243
|
+
useEffect(() => {
|
|
244
|
+
if (!streamingMode) {
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
if (!data) {
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
setStreaming((prev) => {
|
|
251
|
+
let latestPage = Object.keys(prev.data).length;
|
|
252
|
+
const newStreaming = { isEnd: false };
|
|
253
|
+
if (memoizedQueryParams.page < latestPage) {
|
|
254
|
+
latestPage = memoizedQueryParams.page;
|
|
255
|
+
newStreaming.data = { [memoizedQueryParams.page]: data.result };
|
|
256
|
+
} else {
|
|
257
|
+
newStreaming.data = { ...prev.data, [memoizedQueryParams.page]: data.result };
|
|
258
|
+
}
|
|
259
|
+
if (data.result.length < memoizedQueryParams.page_size) {
|
|
260
|
+
newStreaming.isEnd = true;
|
|
261
|
+
newStreaming.fetch = () => null;
|
|
262
|
+
} else {
|
|
263
|
+
newStreaming.fetch = () => setQueryParamsCallback({ page: latestPage + 1, streaming: true });
|
|
264
|
+
}
|
|
265
|
+
return newStreaming;
|
|
266
|
+
});
|
|
267
|
+
}, [data, setQueryParamsCallback, setStreaming, streamingMode]);
|
|
268
|
+
const specialKey = useMemo(() => {
|
|
269
|
+
const specialKey2 = {
|
|
270
|
+
all: "all",
|
|
271
|
+
actions: "actions"
|
|
272
|
+
};
|
|
273
|
+
data == null ? void 0 : data.list_columns.forEach((key) => {
|
|
274
|
+
if (specialKey2[key]) {
|
|
275
|
+
specialKey2[key] = `_${key}`;
|
|
276
|
+
}
|
|
277
|
+
});
|
|
278
|
+
return specialKey2;
|
|
279
|
+
}, [data == null ? void 0 : data.list_columns]);
|
|
280
|
+
const refetch = useCallback(
|
|
281
|
+
() => queryParamsRef.current ? dataRefetch() : setQueryParamsCallback(),
|
|
282
|
+
[dataRefetch, setQueryParamsCallback]
|
|
283
|
+
);
|
|
284
|
+
return {
|
|
285
|
+
path,
|
|
286
|
+
data,
|
|
287
|
+
info,
|
|
288
|
+
queryParams: memoizedQueryParams,
|
|
289
|
+
loading,
|
|
290
|
+
error: memoizedError,
|
|
291
|
+
streaming,
|
|
292
|
+
specialKey,
|
|
293
|
+
setQueryParams: setQueryParamsCallback,
|
|
294
|
+
refetch,
|
|
295
|
+
refetchInfo: infoRefetch,
|
|
296
|
+
getEntry,
|
|
297
|
+
addEntry,
|
|
298
|
+
updateEntry,
|
|
299
|
+
deleteEntry,
|
|
300
|
+
download,
|
|
301
|
+
upload,
|
|
302
|
+
resetError
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
export {
|
|
306
|
+
useFabProvideApi
|
|
307
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { useState, useCallback, useMemo } from "react";
|
|
2
|
+
import { postBulk } from "../utils/bulkActions/postBulkAction.mjs";
|
|
3
|
+
const useFabProvideBulk = ({ path }) => {
|
|
4
|
+
const [selectedIds, setSelectedIds] = useState([]);
|
|
5
|
+
const [error, setError] = useState();
|
|
6
|
+
const dispatchBulkActions = useCallback(
|
|
7
|
+
async (handler, data) => {
|
|
8
|
+
try {
|
|
9
|
+
if (data === void 0) {
|
|
10
|
+
data = selectedIds;
|
|
11
|
+
}
|
|
12
|
+
const response = await postBulk(path, handler, data);
|
|
13
|
+
setError(void 0);
|
|
14
|
+
return response;
|
|
15
|
+
} catch (error2) {
|
|
16
|
+
setError({ message: `Couldn't perform bulk action`, originalError: error2 });
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
[path, selectedIds]
|
|
20
|
+
);
|
|
21
|
+
const bulkActions = useMemo(() => ({ selectedIds, setSelectedIds }), [selectedIds, setSelectedIds]);
|
|
22
|
+
return {
|
|
23
|
+
bulkActions,
|
|
24
|
+
dispatchBulkActions,
|
|
25
|
+
error
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
export {
|
|
29
|
+
useFabProvideBulk
|
|
30
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { createFetchParams, urlJoin } from "fastapi-rtk/utils";
|
|
2
|
+
import { parseResponse } from "./utils/parseResponse.mjs";
|
|
3
|
+
const createItem = async (path, data) => {
|
|
4
|
+
const { fetchPath, options } = createFetchParams({
|
|
5
|
+
path: urlJoin(path, "/"),
|
|
6
|
+
method: "POST",
|
|
7
|
+
body: data
|
|
8
|
+
});
|
|
9
|
+
const response = await fetch(fetchPath, options);
|
|
10
|
+
return await parseResponse(response);
|
|
11
|
+
};
|
|
12
|
+
export {
|
|
13
|
+
createItem
|
|
14
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createFetchParams, urlJoin } from "fastapi-rtk/utils";
|
|
2
|
+
import { parseResponse } from "./utils/parseResponse.mjs";
|
|
3
|
+
const deleteItem = async (path, id) => {
|
|
4
|
+
const { fetchPath, options } = createFetchParams({ path: urlJoin(path, id.toString()), method: "DELETE" });
|
|
5
|
+
const response = await fetch(fetchPath, options);
|
|
6
|
+
return await parseResponse(response);
|
|
7
|
+
};
|
|
8
|
+
export {
|
|
9
|
+
deleteItem
|
|
10
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { createFetchParams, urlJoin } from "fastapi-rtk/utils";
|
|
2
|
+
const downloadItems = async (path, queryParams, { label, export_mode, delimiter, quotechar } = {}) => {
|
|
3
|
+
const _queryParams = { ...queryParams, check_validity: true };
|
|
4
|
+
if (label) {
|
|
5
|
+
_queryParams.label = label;
|
|
6
|
+
}
|
|
7
|
+
if (export_mode) {
|
|
8
|
+
_queryParams.export_mode = export_mode;
|
|
9
|
+
}
|
|
10
|
+
if (delimiter) {
|
|
11
|
+
_queryParams.delimiter = delimiter;
|
|
12
|
+
}
|
|
13
|
+
if (quotechar) {
|
|
14
|
+
_queryParams.quotechar = quotechar;
|
|
15
|
+
}
|
|
16
|
+
delete _queryParams.check_validity;
|
|
17
|
+
const { fetchPath, options } = createFetchParams({
|
|
18
|
+
path: urlJoin(path, "/download"),
|
|
19
|
+
method: "POST",
|
|
20
|
+
body: {
|
|
21
|
+
..._queryParams,
|
|
22
|
+
queryParams
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
const response = await fetch(fetchPath, options);
|
|
26
|
+
if (!response.ok) {
|
|
27
|
+
throw new Error(response.statusText);
|
|
28
|
+
}
|
|
29
|
+
const data = await response.blob();
|
|
30
|
+
const link = URL.createObjectURL(data);
|
|
31
|
+
const a = document.createElement("a");
|
|
32
|
+
a.href = link;
|
|
33
|
+
a.download = (label || _queryParams.label || path.split("/").pop()) + ".csv";
|
|
34
|
+
a.style.display = "none";
|
|
35
|
+
document.body.appendChild(a);
|
|
36
|
+
a.click();
|
|
37
|
+
document.body.removeChild(a);
|
|
38
|
+
};
|
|
39
|
+
export {
|
|
40
|
+
downloadItems
|
|
41
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createFetchParams } from "fastapi-rtk/utils";
|
|
2
|
+
import { parseResponse } from "./utils/parseResponse.mjs";
|
|
3
|
+
const getInfo = async (path, signal) => {
|
|
4
|
+
const { fetchPath, options } = createFetchParams({
|
|
5
|
+
path,
|
|
6
|
+
method: "GET"
|
|
7
|
+
});
|
|
8
|
+
const response = await fetch(fetchPath, { signal, ...options });
|
|
9
|
+
return await parseResponse(response);
|
|
10
|
+
};
|
|
11
|
+
export {
|
|
12
|
+
getInfo
|
|
13
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createFetchParams, urlJoin } from "fastapi-rtk/utils";
|
|
2
|
+
import { parseResponse } from "./utils/parseResponse.mjs";
|
|
3
|
+
const getItem = async (path, id) => {
|
|
4
|
+
const { fetchPath, options } = createFetchParams({ path: urlJoin(path, id.toString()), method: "GET" });
|
|
5
|
+
const response = await fetch(fetchPath, options);
|
|
6
|
+
return await parseResponse(response);
|
|
7
|
+
};
|
|
8
|
+
export {
|
|
9
|
+
getItem
|
|
10
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createFetchParams } from "fastapi-rtk/utils";
|
|
2
|
+
import { parseResponse } from "./utils/parseResponse.mjs";
|
|
3
|
+
const getItems = async (path, queryParams, signal) => {
|
|
4
|
+
const { fetchPath, options } = createFetchParams({ path, method: "GET", queryParams: { q: queryParams } });
|
|
5
|
+
const response = await fetch(fetchPath, { signal, ...options });
|
|
6
|
+
return await parseResponse(response);
|
|
7
|
+
};
|
|
8
|
+
export {
|
|
9
|
+
getItems
|
|
10
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createFetchParams, urlJoin } from "fastapi-rtk/utils";
|
|
2
|
+
import { parseResponse } from "./utils/parseResponse.mjs";
|
|
3
|
+
const updateItem = async (path, id, data) => {
|
|
4
|
+
const { fetchPath, options } = createFetchParams({ path: urlJoin(path, id.toString()), method: "PUT", body: data });
|
|
5
|
+
const response = await fetch(fetchPath, options);
|
|
6
|
+
return await parseResponse(response);
|
|
7
|
+
};
|
|
8
|
+
export {
|
|
9
|
+
updateItem
|
|
10
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { createFetchParams, urlJoin } from "fastapi-rtk/utils";
|
|
2
|
+
import { parseResponse } from "./utils/parseResponse.mjs";
|
|
3
|
+
const uploadItems = async (path, file, { delimiter, quotechar } = {}) => {
|
|
4
|
+
const formData = new FormData();
|
|
5
|
+
formData.append("file", file);
|
|
6
|
+
const queryParams = {};
|
|
7
|
+
if (delimiter) {
|
|
8
|
+
queryParams.delimiter = delimiter;
|
|
9
|
+
}
|
|
10
|
+
if (quotechar) {
|
|
11
|
+
queryParams.quotechar = quotechar;
|
|
12
|
+
}
|
|
13
|
+
const { fetchPath, options } = createFetchParams({
|
|
14
|
+
path: urlJoin(path, "/upload"),
|
|
15
|
+
method: "POST",
|
|
16
|
+
queryParams
|
|
17
|
+
});
|
|
18
|
+
const response = await fetch(fetchPath, {
|
|
19
|
+
...options,
|
|
20
|
+
headers: void 0,
|
|
21
|
+
body: formData
|
|
22
|
+
});
|
|
23
|
+
return await parseResponse(response);
|
|
24
|
+
};
|
|
25
|
+
export {
|
|
26
|
+
uploadItems
|
|
27
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const parseResponse = async (response) => {
|
|
2
|
+
let newData = void 0;
|
|
3
|
+
const contentType = response.headers.get("content-type");
|
|
4
|
+
if (contentType && contentType.includes("application/json")) {
|
|
5
|
+
newData = await response.json();
|
|
6
|
+
} else {
|
|
7
|
+
newData = await response.text();
|
|
8
|
+
}
|
|
9
|
+
if (!response.ok) {
|
|
10
|
+
if (typeof newData === "object") {
|
|
11
|
+
throw new Error(typeof newData.message === "string" ? newData.message : JSON.stringify(newData, void 0, 2));
|
|
12
|
+
}
|
|
13
|
+
throw new Error(newData);
|
|
14
|
+
}
|
|
15
|
+
return newData;
|
|
16
|
+
};
|
|
17
|
+
export {
|
|
18
|
+
parseResponse
|
|
19
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { createFetchParams, urlJoin } from "fastapi-rtk/utils";
|
|
2
|
+
const postBulk = async (path, handler, data) => {
|
|
3
|
+
const { fetchPath, options } = createFetchParams({
|
|
4
|
+
path: urlJoin(path, "/bulk", handler),
|
|
5
|
+
method: "POST",
|
|
6
|
+
body: data
|
|
7
|
+
});
|
|
8
|
+
const response = await fetch(fetchPath, options);
|
|
9
|
+
let newData = null;
|
|
10
|
+
const contentType = response.headers.get("content-type");
|
|
11
|
+
if (contentType && contentType.includes("application/json")) {
|
|
12
|
+
newData = await response.json();
|
|
13
|
+
} else {
|
|
14
|
+
newData = await response.text();
|
|
15
|
+
}
|
|
16
|
+
if (!response.ok) {
|
|
17
|
+
if (typeof newData === "object") {
|
|
18
|
+
throw new Error(typeof newData.message === "string" ? newData.message : JSON.stringify(newData, null, 2));
|
|
19
|
+
}
|
|
20
|
+
throw new Error(newData);
|
|
21
|
+
}
|
|
22
|
+
return newData;
|
|
23
|
+
};
|
|
24
|
+
export {
|
|
25
|
+
postBulk
|
|
26
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { getDefaultValues } from "./getDefaultValues.mjs";
|
|
2
|
+
import { getValidationSchema } from "./getValidationSchema.mjs";
|
|
3
|
+
const convertInfo = (info) => info ? {
|
|
4
|
+
...info,
|
|
5
|
+
add: {
|
|
6
|
+
columns: info.add_columns,
|
|
7
|
+
title: info.add_title,
|
|
8
|
+
schema: getValidationSchema(info.add_columns),
|
|
9
|
+
defaultValues: getDefaultValues(info.add_columns)
|
|
10
|
+
},
|
|
11
|
+
edit: {
|
|
12
|
+
columns: info.edit_columns,
|
|
13
|
+
title: info.edit_title,
|
|
14
|
+
schema: getValidationSchema(info.edit_columns),
|
|
15
|
+
defaultValues: getDefaultValues(info.edit_columns)
|
|
16
|
+
}
|
|
17
|
+
} : null;
|
|
18
|
+
export {
|
|
19
|
+
convertInfo
|
|
20
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const initialQueryParams = {
|
|
2
|
+
columns: [],
|
|
3
|
+
filters: [],
|
|
4
|
+
page: 0,
|
|
5
|
+
page_size: 25
|
|
6
|
+
};
|
|
7
|
+
function createQueryParams(currentQueryParams, partialQueryParams = {}) {
|
|
8
|
+
return Object.entries(partialQueryParams).reduce((acc, [key, value]) => {
|
|
9
|
+
if (value === null || value === void 0) {
|
|
10
|
+
delete acc[key];
|
|
11
|
+
return acc;
|
|
12
|
+
}
|
|
13
|
+
return { ...acc, [key]: value };
|
|
14
|
+
}, currentQueryParams || initialQueryParams);
|
|
15
|
+
}
|
|
16
|
+
export {
|
|
17
|
+
createQueryParams
|
|
18
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
const getDefaultValues = (columns) => {
|
|
2
|
+
const defaultValues = {};
|
|
3
|
+
for (const item of columns) {
|
|
4
|
+
switch (item.type) {
|
|
5
|
+
case "RelatedList":
|
|
6
|
+
defaultValues[item.name] = [];
|
|
7
|
+
break;
|
|
8
|
+
case "Boolean":
|
|
9
|
+
defaultValues[item.name] = "false";
|
|
10
|
+
break;
|
|
11
|
+
case "Date":
|
|
12
|
+
case "DateTime":
|
|
13
|
+
case "Integer":
|
|
14
|
+
case "Float":
|
|
15
|
+
case "Geometry":
|
|
16
|
+
case "Raw":
|
|
17
|
+
case "Related":
|
|
18
|
+
defaultValues[item.name] = void 0;
|
|
19
|
+
break;
|
|
20
|
+
default:
|
|
21
|
+
defaultValues[item.name] = "";
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return defaultValues;
|
|
25
|
+
};
|
|
26
|
+
export {
|
|
27
|
+
getDefaultValues
|
|
28
|
+
};
|