@strato-admin/faker-ecommerce 0.1.1 → 0.3.0
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/dataProvider.js +1 -2
- package/dist/generate.d.ts +2 -1
- package/dist/generate.js +15 -8
- package/dist/ra-core/src/auth/LogoutOnMount.d.ts +8 -0
- package/dist/ra-core/src/auth/LogoutOnMount.js +16 -0
- package/dist/ra-core/src/auth/addRefreshAuthToAuthProvider.d.ts +22 -0
- package/dist/ra-core/src/auth/addRefreshAuthToAuthProvider.js +41 -0
- package/dist/ra-core/src/auth/addRefreshAuthToDataProvider.d.ts +21 -0
- package/dist/ra-core/src/auth/addRefreshAuthToDataProvider.js +30 -0
- package/dist/ra-core/src/auth/convertLegacyAuthProvider.d.ts +12 -0
- package/dist/ra-core/src/auth/convertLegacyAuthProvider.js +19 -0
- package/dist/ra-core/src/auth/index.d.ts +27 -0
- package/dist/ra-core/src/auth/index.js +34 -0
- package/dist/ra-core/src/auth/types.d.ts +7 -0
- package/dist/ra-core/src/auth/types.js +5 -0
- package/dist/ra-core/src/auth/useAuthProvider.d.ts +10 -0
- package/dist/ra-core/src/auth/useAuthProvider.js +11 -0
- package/dist/ra-core/src/auth/useAuthState.d.ts +48 -0
- package/dist/ra-core/src/auth/useAuthState.js +171 -0
- package/dist/ra-core/src/auth/useAuthenticated.d.ts +36 -0
- package/dist/ra-core/src/auth/useAuthenticated.js +34 -0
- package/dist/ra-core/src/auth/useCanAccess.d.ts +56 -0
- package/dist/ra-core/src/auth/useCanAccess.js +108 -0
- package/dist/ra-core/src/auth/useCanAccessCallback.d.ts +39 -0
- package/dist/ra-core/src/auth/useCanAccessCallback.js +45 -0
- package/dist/ra-core/src/auth/useCanAccessResources.d.ts +67 -0
- package/dist/ra-core/src/auth/useCanAccessResources.js +92 -0
- package/dist/ra-core/src/auth/useCheckAuth.d.ts +48 -0
- package/dist/ra-core/src/auth/useCheckAuth.js +76 -0
- package/dist/ra-core/src/auth/useGetIdentity.d.ts +41 -0
- package/dist/ra-core/src/auth/useGetIdentity.js +86 -0
- package/dist/ra-core/src/auth/useGetPermissions.d.ts +41 -0
- package/dist/ra-core/src/auth/useGetPermissions.js +47 -0
- package/dist/ra-core/src/auth/useHandleAuthCallback.d.ts +20 -0
- package/dist/ra-core/src/auth/useHandleAuthCallback.js +83 -0
- package/dist/ra-core/src/auth/useIsAuthPending.d.ts +13 -0
- package/dist/ra-core/src/auth/useIsAuthPending.js +30 -0
- package/dist/ra-core/src/auth/useLogin.d.ts +34 -0
- package/dist/ra-core/src/auth/useLogin.js +78 -0
- package/dist/ra-core/src/auth/useLogout.d.ts +31 -0
- package/dist/ra-core/src/auth/useLogout.js +117 -0
- package/dist/ra-core/src/auth/useLogoutIfAccessDenied.d.ts +42 -0
- package/dist/ra-core/src/auth/useLogoutIfAccessDenied.js +111 -0
- package/dist/ra-core/src/auth/usePermissions.d.ts +41 -0
- package/dist/ra-core/src/auth/usePermissions.js +123 -0
- package/dist/ra-core/src/controller/button/index.d.ts +7 -0
- package/dist/ra-core/src/controller/button/index.js +7 -0
- package/dist/ra-core/src/controller/button/useBulkDeleteController.d.ts +14 -0
- package/dist/ra-core/src/controller/button/useBulkDeleteController.js +66 -0
- package/dist/ra-core/src/controller/create/index.d.ts +6 -0
- package/dist/ra-core/src/controller/create/index.js +6 -0
- package/dist/ra-core/src/controller/create/useCreateController.d.ts +50 -0
- package/dist/ra-core/src/controller/create/useCreateController.js +149 -0
- package/dist/ra-core/src/controller/edit/index.d.ts +6 -0
- package/dist/ra-core/src/controller/edit/index.js +6 -0
- package/dist/ra-core/src/controller/edit/useEditController.d.ts +72 -0
- package/dist/ra-core/src/controller/edit/useEditController.js +206 -0
- package/dist/ra-core/src/controller/field/index.d.ts +12 -0
- package/dist/ra-core/src/controller/field/index.js +12 -0
- package/dist/ra-core/src/controller/field/sanitizeFieldRestProps.d.ts +1 -0
- package/dist/ra-core/src/controller/field/sanitizeFieldRestProps.js +1 -0
- package/dist/ra-core/src/controller/field/types.d.ts +28 -0
- package/dist/ra-core/src/controller/field/types.js +1 -0
- package/dist/ra-core/src/controller/field/useReferenceArrayFieldController.d.ts +39 -0
- package/dist/ra-core/src/controller/field/useReferenceArrayFieldController.js +82 -0
- package/dist/ra-core/src/controller/field/useReferenceFieldController.d.ts +14 -0
- package/dist/ra-core/src/controller/field/useReferenceFieldController.js +31 -0
- package/dist/ra-core/src/controller/field/useReferenceManyFieldController.d.ts +49 -0
- package/dist/ra-core/src/controller/field/useReferenceManyFieldController.js +264 -0
- package/dist/ra-core/src/controller/index.d.ts +17 -0
- package/dist/ra-core/src/controller/index.js +16 -0
- package/dist/ra-core/src/controller/input/ArrayInputContext.d.ts +9 -0
- package/dist/ra-core/src/controller/input/ArrayInputContext.js +8 -0
- package/dist/ra-core/src/controller/input/SimpleFormIteratorContext.d.ts +15 -0
- package/dist/ra-core/src/controller/input/SimpleFormIteratorContext.js +8 -0
- package/dist/ra-core/src/controller/input/SimpleFormIteratorItemContext.d.ts +13 -0
- package/dist/ra-core/src/controller/input/SimpleFormIteratorItemContext.js +8 -0
- package/dist/ra-core/src/controller/input/index.d.ts +17 -0
- package/dist/ra-core/src/controller/input/index.js +17 -0
- package/dist/ra-core/src/controller/input/referenceDataStatus.d.ts +32 -0
- package/dist/ra-core/src/controller/input/referenceDataStatus.js +74 -0
- package/dist/ra-core/src/controller/input/sanitizeInputRestProps.d.ts +1 -0
- package/dist/ra-core/src/controller/input/sanitizeInputRestProps.js +1 -0
- package/dist/ra-core/src/controller/input/types.d.ts +3 -0
- package/dist/ra-core/src/controller/input/types.js +1 -0
- package/dist/ra-core/src/controller/input/useArrayInput.d.ts +8 -0
- package/dist/ra-core/src/controller/input/useArrayInput.js +29 -0
- package/dist/ra-core/src/controller/input/useGetArrayInputNewItemDefaults.d.ts +3 -0
- package/dist/ra-core/src/controller/input/useGetArrayInputNewItemDefaults.js +37 -0
- package/dist/ra-core/src/controller/input/useReferenceArrayInputController.d.ts +48 -0
- package/dist/ra-core/src/controller/input/useReferenceArrayInputController.js +137 -0
- package/dist/ra-core/src/controller/input/useReferenceInputController.d.ts +54 -0
- package/dist/ra-core/src/controller/input/useReferenceInputController.js +208 -0
- package/dist/ra-core/src/controller/input/useReferenceParams.d.ts +106 -0
- package/dist/ra-core/src/controller/input/useReferenceParams.js +226 -0
- package/dist/ra-core/src/controller/input/useSimpleFormIterator.d.ts +7 -0
- package/dist/ra-core/src/controller/input/useSimpleFormIterator.js +15 -0
- package/dist/ra-core/src/controller/input/useSimpleFormIteratorItem.d.ts +7 -0
- package/dist/ra-core/src/controller/input/useSimpleFormIteratorItem.js +15 -0
- package/dist/ra-core/src/controller/list/InfinitePaginationContext.d.ts +25 -0
- package/dist/ra-core/src/controller/list/InfinitePaginationContext.js +32 -0
- package/dist/ra-core/src/controller/list/index.d.ts +30 -0
- package/dist/ra-core/src/controller/list/index.js +30 -0
- package/dist/ra-core/src/controller/list/queryReducer.d.ts +45 -0
- package/dist/ra-core/src/controller/list/queryReducer.js +85 -0
- package/dist/ra-core/src/controller/list/useFilterContext.d.ts +2 -0
- package/dist/ra-core/src/controller/list/useFilterContext.js +5 -0
- package/dist/ra-core/src/controller/list/useInfiniteListController.d.ts +44 -0
- package/dist/ra-core/src/controller/list/useInfiniteListController.js +175 -0
- package/dist/ra-core/src/controller/list/useInfinitePaginationContext.d.ts +16 -0
- package/dist/ra-core/src/controller/list/useInfinitePaginationContext.js +17 -0
- package/dist/ra-core/src/controller/list/useList.d.ts +55 -0
- package/dist/ra-core/src/controller/list/useList.js +223 -0
- package/dist/ra-core/src/controller/list/useListContext.d.ts +59 -0
- package/dist/ra-core/src/controller/list/useListContext.js +65 -0
- package/dist/ra-core/src/controller/list/useListContextWithProps.d.ts +44 -0
- package/dist/ra-core/src/controller/list/useListContextWithProps.js +84 -0
- package/dist/ra-core/src/controller/list/useListController.d.ts +296 -0
- package/dist/ra-core/src/controller/list/useListController.js +234 -0
- package/dist/ra-core/src/controller/list/useListFilterContext.d.ts +11 -0
- package/dist/ra-core/src/controller/list/useListFilterContext.js +18 -0
- package/dist/ra-core/src/controller/list/useListPaginationContext.d.ts +12 -0
- package/dist/ra-core/src/controller/list/useListPaginationContext.js +19 -0
- package/dist/ra-core/src/controller/list/useListParams.d.ts +116 -0
- package/dist/ra-core/src/controller/list/useListParams.js +281 -0
- package/dist/ra-core/src/controller/list/useListSortContext.d.ts +12 -0
- package/dist/ra-core/src/controller/list/useListSortContext.js +19 -0
- package/dist/ra-core/src/controller/list/useRecordSelection.d.ts +32 -0
- package/dist/ra-core/src/controller/list/useRecordSelection.js +93 -0
- package/dist/ra-core/src/controller/list/useSavedQueries.d.ts +14 -0
- package/dist/ra-core/src/controller/list/useSavedQueries.js +29 -0
- package/dist/ra-core/src/controller/list/useUnselect.d.ts +10 -0
- package/dist/ra-core/src/controller/list/useUnselect.js +18 -0
- package/dist/ra-core/src/controller/list/useUnselectAll.d.ts +9 -0
- package/dist/ra-core/src/controller/list/useUnselectAll.js +18 -0
- package/dist/ra-core/src/controller/record/index.d.ts +5 -0
- package/dist/ra-core/src/controller/record/index.js +5 -0
- package/dist/ra-core/src/controller/record/useRecordContext.d.ts +34 -0
- package/dist/ra-core/src/controller/record/useRecordContext.js +36 -0
- package/dist/ra-core/src/controller/saveContext/SaveContext.d.ts +20 -0
- package/dist/ra-core/src/controller/saveContext/SaveContext.js +2 -0
- package/dist/ra-core/src/controller/saveContext/index.d.ts +6 -0
- package/dist/ra-core/src/controller/saveContext/index.js +6 -0
- package/dist/ra-core/src/controller/saveContext/useMutationMiddlewares.d.ts +39 -0
- package/dist/ra-core/src/controller/saveContext/useMutationMiddlewares.js +79 -0
- package/dist/ra-core/src/controller/saveContext/usePickSaveContext.d.ts +5 -0
- package/dist/ra-core/src/controller/saveContext/usePickSaveContext.js +25 -0
- package/dist/ra-core/src/controller/saveContext/useRegisterMutationMiddleware.d.ts +6 -0
- package/dist/ra-core/src/controller/saveContext/useRegisterMutationMiddleware.js +18 -0
- package/dist/ra-core/src/controller/saveContext/useSaveContext.d.ts +14 -0
- package/dist/ra-core/src/controller/saveContext/useSaveContext.js +17 -0
- package/dist/ra-core/src/controller/show/index.d.ts +6 -0
- package/dist/ra-core/src/controller/show/index.js +6 -0
- package/dist/ra-core/src/controller/show/useShowController.d.ts +75 -0
- package/dist/ra-core/src/controller/show/useShowController.js +110 -0
- package/dist/ra-core/src/controller/useFilterState.d.ts +46 -0
- package/dist/ra-core/src/controller/useFilterState.js +70 -0
- package/dist/ra-core/src/controller/usePaginationState.d.ts +33 -0
- package/dist/ra-core/src/controller/usePaginationState.js +45 -0
- package/dist/ra-core/src/controller/usePrevNextController.d.ts +127 -0
- package/dist/ra-core/src/controller/usePrevNextController.js +215 -0
- package/dist/ra-core/src/controller/useReference.d.ts +49 -0
- package/dist/ra-core/src/controller/useReference.js +42 -0
- package/dist/ra-core/src/controller/useSortState.d.ts +61 -0
- package/dist/ra-core/src/controller/useSortState.js +96 -0
- package/dist/ra-core/src/core/DefaultTitleContext.d.ts +15 -0
- package/dist/ra-core/src/core/DefaultTitleContext.js +15 -0
- package/dist/ra-core/src/core/HasDashboardContext.d.ts +21 -0
- package/dist/ra-core/src/core/HasDashboardContext.js +22 -0
- package/dist/ra-core/src/core/ResourceContext.d.ts +19 -0
- package/dist/ra-core/src/core/ResourceContext.js +19 -0
- package/dist/ra-core/src/core/UserMenuContext.d.ts +34 -0
- package/dist/ra-core/src/core/UserMenuContext.js +28 -0
- package/dist/ra-core/src/core/index.d.ts +27 -0
- package/dist/ra-core/src/core/index.js +27 -0
- package/dist/ra-core/src/core/useGetRecordRepresentation.d.ts +13 -0
- package/dist/ra-core/src/core/useGetRecordRepresentation.js +44 -0
- package/dist/ra-core/src/core/useGetResourceLabel.d.ts +22 -0
- package/dist/ra-core/src/core/useGetResourceLabel.js +42 -0
- package/dist/ra-core/src/core/useIsOffline.d.ts +7 -0
- package/dist/ra-core/src/core/useIsOffline.js +18 -0
- package/dist/ra-core/src/core/useResourceContext.d.ts +36 -0
- package/dist/ra-core/src/core/useResourceContext.js +38 -0
- package/dist/ra-core/src/core/useResourceDefinition.d.ts +31 -0
- package/dist/ra-core/src/core/useResourceDefinition.js +48 -0
- package/dist/ra-core/src/core/useResourceDefinitionContext.d.ts +1 -0
- package/dist/ra-core/src/core/useResourceDefinitionContext.js +3 -0
- package/dist/ra-core/src/core/useResourceDefinitions.d.ts +21 -0
- package/dist/ra-core/src/core/useResourceDefinitions.js +20 -0
- package/dist/ra-core/src/core/useUserMenu.d.ts +28 -0
- package/dist/ra-core/src/core/useUserMenu.js +30 -0
- package/dist/ra-core/src/core/useWrappedSource.d.ts +11 -0
- package/dist/ra-core/src/core/useWrappedSource.js +15 -0
- package/dist/ra-core/src/dataProvider/DataProviderContext.d.ts +3 -0
- package/dist/ra-core/src/dataProvider/DataProviderContext.js +4 -0
- package/dist/ra-core/src/dataProvider/HttpError.d.ts +6 -0
- package/dist/ra-core/src/dataProvider/HttpError.js +19 -0
- package/dist/ra-core/src/dataProvider/combineDataProviders.d.ts +21 -0
- package/dist/ra-core/src/dataProvider/combineDataProviders.js +32 -0
- package/dist/ra-core/src/dataProvider/convertLegacyDataProvider.d.ts +12 -0
- package/dist/ra-core/src/dataProvider/convertLegacyDataProvider.js +40 -0
- package/dist/ra-core/src/dataProvider/dataFetchActions.d.ts +15 -0
- package/dist/ra-core/src/dataProvider/dataFetchActions.js +49 -0
- package/dist/ra-core/src/dataProvider/defaultDataProvider.d.ts +2 -0
- package/dist/ra-core/src/dataProvider/defaultDataProvider.js +12 -0
- package/dist/ra-core/src/dataProvider/fetch.d.ts +32 -0
- package/dist/ra-core/src/dataProvider/fetch.js +78 -0
- package/dist/ra-core/src/dataProvider/index.d.ts +34 -0
- package/dist/ra-core/src/dataProvider/index.js +33 -0
- package/dist/ra-core/src/dataProvider/populateQueryCache.d.ts +22 -0
- package/dist/ra-core/src/dataProvider/populateQueryCache.js +30 -0
- package/dist/ra-core/src/dataProvider/testDataProvider.d.ts +2 -0
- package/dist/ra-core/src/dataProvider/testDataProvider.js +41 -0
- package/dist/ra-core/src/dataProvider/undo/index.d.ts +6 -0
- package/dist/ra-core/src/dataProvider/undo/index.js +6 -0
- package/dist/ra-core/src/dataProvider/undo/types.d.ts +3 -0
- package/dist/ra-core/src/dataProvider/undo/types.js +1 -0
- package/dist/ra-core/src/dataProvider/undoableEventEmitter.d.ts +3 -0
- package/dist/ra-core/src/dataProvider/undoableEventEmitter.js +2 -0
- package/dist/ra-core/src/dataProvider/useCreate.d.ts +89 -0
- package/dist/ra-core/src/dataProvider/useCreate.js +155 -0
- package/dist/ra-core/src/dataProvider/useDataProvider.d.ts +2 -0
- package/dist/ra-core/src/dataProvider/useDataProvider.js +140 -0
- package/dist/ra-core/src/dataProvider/useDelete.d.ts +83 -0
- package/dist/ra-core/src/dataProvider/useDelete.js +171 -0
- package/dist/ra-core/src/dataProvider/useDeleteMany.d.ts +81 -0
- package/dist/ra-core/src/dataProvider/useDeleteMany.js +193 -0
- package/dist/ra-core/src/dataProvider/useGetList.d.ts +58 -0
- package/dist/ra-core/src/dataProvider/useGetList.js +131 -0
- package/dist/ra-core/src/dataProvider/useGetMany.d.ts +49 -0
- package/dist/ra-core/src/dataProvider/useGetMany.js +143 -0
- package/dist/ra-core/src/dataProvider/useGetManyAggregate.d.ts +62 -0
- package/dist/ra-core/src/dataProvider/useGetManyAggregate.js +295 -0
- package/dist/ra-core/src/dataProvider/useGetManyReference.d.ts +62 -0
- package/dist/ra-core/src/dataProvider/useGetManyReference.js +117 -0
- package/dist/ra-core/src/dataProvider/useGetOne.d.ts +48 -0
- package/dist/ra-core/src/dataProvider/useGetOne.js +94 -0
- package/dist/ra-core/src/dataProvider/useGetRecordId.d.ts +14 -0
- package/dist/ra-core/src/dataProvider/useGetRecordId.js +22 -0
- package/dist/ra-core/src/dataProvider/useInfiniteGetList.d.ts +64 -0
- package/dist/ra-core/src/dataProvider/useInfiniteGetList.js +177 -0
- package/dist/ra-core/src/dataProvider/useIsDataLoaded.d.ts +13 -0
- package/dist/ra-core/src/dataProvider/useIsDataLoaded.js +35 -0
- package/dist/ra-core/src/dataProvider/useLoading.d.ts +12 -0
- package/dist/ra-core/src/dataProvider/useLoading.js +41 -0
- package/dist/ra-core/src/dataProvider/useMutationWithMutationMode.d.ts +51 -0
- package/dist/ra-core/src/dataProvider/useMutationWithMutationMode.js +238 -0
- package/dist/ra-core/src/dataProvider/useRefresh.d.ts +14 -0
- package/dist/ra-core/src/dataProvider/useRefresh.js +21 -0
- package/dist/ra-core/src/dataProvider/useUpdate.d.ts +89 -0
- package/dist/ra-core/src/dataProvider/useUpdate.js +183 -0
- package/dist/ra-core/src/dataProvider/useUpdateMany.d.ts +81 -0
- package/dist/ra-core/src/dataProvider/useUpdateMany.js +171 -0
- package/dist/ra-core/src/dataProvider/validateResponseFormat.d.ts +5 -0
- package/dist/ra-core/src/dataProvider/validateResponseFormat.js +35 -0
- package/dist/ra-core/src/dataProvider/withLifecycleCallbacks.d.ts +162 -0
- package/dist/ra-core/src/dataProvider/withLifecycleCallbacks.js +377 -0
- package/dist/ra-core/src/dataTable/DataTableCallbacksContext.d.ts +18 -0
- package/dist/ra-core/src/dataTable/DataTableCallbacksContext.js +3 -0
- package/dist/ra-core/src/dataTable/DataTableColumnFilterContext.d.ts +2 -0
- package/dist/ra-core/src/dataTable/DataTableColumnFilterContext.js +3 -0
- package/dist/ra-core/src/dataTable/DataTableColumnRankContext.d.ts +2 -0
- package/dist/ra-core/src/dataTable/DataTableColumnRankContext.js +3 -0
- package/dist/ra-core/src/dataTable/DataTableConfigContext.d.ts +22 -0
- package/dist/ra-core/src/dataTable/DataTableConfigContext.js +7 -0
- package/dist/ra-core/src/dataTable/DataTableDataContext.d.ts +4 -0
- package/dist/ra-core/src/dataTable/DataTableDataContext.js +3 -0
- package/dist/ra-core/src/dataTable/DataTableRenderContext.d.ts +3 -0
- package/dist/ra-core/src/dataTable/DataTableRenderContext.js +3 -0
- package/dist/ra-core/src/dataTable/DataTableSelectedIdsContext.d.ts +3 -0
- package/dist/ra-core/src/dataTable/DataTableSelectedIdsContext.js +3 -0
- package/dist/ra-core/src/dataTable/DataTableSortContext.d.ts +3 -0
- package/dist/ra-core/src/dataTable/DataTableSortContext.js +3 -0
- package/dist/ra-core/src/dataTable/DataTableStoreContext.d.ts +8 -0
- package/dist/ra-core/src/dataTable/DataTableStoreContext.js +6 -0
- package/dist/ra-core/src/dataTable/index.d.ts +11 -0
- package/dist/ra-core/src/dataTable/index.js +11 -0
- package/dist/ra-core/src/dataTable/types.d.ts +2 -0
- package/dist/ra-core/src/dataTable/types.js +1 -0
- package/dist/ra-core/src/export/ExporterContext.d.ts +2 -0
- package/dist/ra-core/src/export/ExporterContext.js +4 -0
- package/dist/ra-core/src/export/defaultExporter.d.ts +2 -0
- package/dist/ra-core/src/export/defaultExporter.js +3 -0
- package/dist/ra-core/src/export/downloadCSV.d.ts +1 -0
- package/dist/ra-core/src/export/downloadCSV.js +17 -0
- package/dist/ra-core/src/export/fetchRelatedRecords.d.ts +14 -0
- package/dist/ra-core/src/export/fetchRelatedRecords.js +19 -0
- package/dist/ra-core/src/export/getRelatedIds.d.ts +24 -0
- package/dist/ra-core/src/export/getRelatedIds.js +26 -0
- package/dist/ra-core/src/export/index.d.ts +5 -0
- package/dist/ra-core/src/export/index.js +5 -0
- package/dist/ra-core/src/export/useBulkExport.d.ts +11 -0
- package/dist/ra-core/src/export/useBulkExport.js +30 -0
- package/dist/ra-core/src/form/WarnWhenUnsavedChanges.d.ts +5 -0
- package/dist/ra-core/src/form/WarnWhenUnsavedChanges.js +5 -0
- package/dist/ra-core/src/form/choices/ChoicesContext.d.ts +65 -0
- package/dist/ra-core/src/form/choices/ChoicesContext.js +7 -0
- package/dist/ra-core/src/form/choices/index.d.ts +4 -0
- package/dist/ra-core/src/form/choices/index.js +4 -0
- package/dist/ra-core/src/form/choices/useChoicesContext.d.ts +5 -0
- package/dist/ra-core/src/form/choices/useChoicesContext.js +62 -0
- package/dist/ra-core/src/form/getFormInitialValues.d.ts +8 -0
- package/dist/ra-core/src/form/getFormInitialValues.js +14 -0
- package/dist/ra-core/src/form/groups/FormGroupContext.d.ts +9 -0
- package/dist/ra-core/src/form/groups/FormGroupContext.js +9 -0
- package/dist/ra-core/src/form/groups/index.d.ts +6 -0
- package/dist/ra-core/src/form/groups/index.js +6 -0
- package/dist/ra-core/src/form/groups/useFormGroup.d.ts +67 -0
- package/dist/ra-core/src/form/groups/useFormGroup.js +146 -0
- package/dist/ra-core/src/form/groups/useFormGroupContext.d.ts +4 -0
- package/dist/ra-core/src/form/groups/useFormGroupContext.js +9 -0
- package/dist/ra-core/src/form/groups/useFormGroups.d.ts +4 -0
- package/dist/ra-core/src/form/groups/useFormGroups.js +9 -0
- package/dist/ra-core/src/form/index.d.ts +14 -0
- package/dist/ra-core/src/form/index.js +14 -0
- package/dist/ra-core/src/form/sanitizeEmptyValues.d.ts +7 -0
- package/dist/ra-core/src/form/sanitizeEmptyValues.js +26 -0
- package/dist/ra-core/src/form/useApplyInputDefaultValues.d.ts +19 -0
- package/dist/ra-core/src/form/useApplyInputDefaultValues.js +71 -0
- package/dist/ra-core/src/form/useAugmentedForm.d.ts +32 -0
- package/dist/ra-core/src/form/useAugmentedForm.js +101 -0
- package/dist/ra-core/src/form/useFormIsDirty.d.ts +4 -0
- package/dist/ra-core/src/form/useFormIsDirty.js +39 -0
- package/dist/ra-core/src/form/useInput.d.ts +33 -0
- package/dist/ra-core/src/form/useInput.js +100 -0
- package/dist/ra-core/src/form/useRecordFromLocation.d.ts +22 -0
- package/dist/ra-core/src/form/useRecordFromLocation.js +59 -0
- package/dist/ra-core/src/form/useSuggestions.d.ts +43 -0
- package/dist/ra-core/src/form/useSuggestions.js +186 -0
- package/dist/ra-core/src/form/validation/getSimpleValidationResolver.d.ts +31 -0
- package/dist/ra-core/src/form/validation/getSimpleValidationResolver.js +87 -0
- package/dist/ra-core/src/form/validation/index.d.ts +7 -0
- package/dist/ra-core/src/form/validation/index.js +7 -0
- package/dist/ra-core/src/form/validation/setSubmissionErrors.d.ts +21 -0
- package/dist/ra-core/src/form/validation/setSubmissionErrors.js +34 -0
- package/dist/ra-core/src/form/validation/useGetValidationErrorMessage.d.ts +26 -0
- package/dist/ra-core/src/form/validation/useGetValidationErrorMessage.js +35 -0
- package/dist/ra-core/src/form/validation/useNotifyIsFormInvalid.d.ts +9 -0
- package/dist/ra-core/src/form/validation/useNotifyIsFormInvalid.js +30 -0
- package/dist/ra-core/src/form/validation/useUnique.d.ts +57 -0
- package/dist/ra-core/src/form/validation/useUnique.js +107 -0
- package/dist/ra-core/src/form/validation/validate.d.ts +168 -0
- package/dist/ra-core/src/form/validation/validate.js +218 -0
- package/dist/ra-core/src/i18n/I18nContext.d.ts +3 -0
- package/dist/ra-core/src/i18n/I18nContext.js +11 -0
- package/dist/ra-core/src/i18n/TranslatableContext.d.ts +16 -0
- package/dist/ra-core/src/i18n/TranslatableContext.js +2 -0
- package/dist/ra-core/src/i18n/TranslationMessages.d.ts +221 -0
- package/dist/ra-core/src/i18n/TranslationMessages.js +1 -0
- package/dist/ra-core/src/i18n/TranslationUtils.d.ts +60 -0
- package/dist/ra-core/src/i18n/TranslationUtils.js +70 -0
- package/dist/ra-core/src/i18n/index.d.ts +20 -0
- package/dist/ra-core/src/i18n/index.js +20 -0
- package/dist/ra-core/src/i18n/substituteTokens.d.ts +8 -0
- package/dist/ra-core/src/i18n/substituteTokens.js +18 -0
- package/dist/ra-core/src/i18n/useI18nProvider.d.ts +12 -0
- package/dist/ra-core/src/i18n/useI18nProvider.js +14 -0
- package/dist/ra-core/src/i18n/useLocales.d.ts +31 -0
- package/dist/ra-core/src/i18n/useLocales.js +28 -0
- package/dist/ra-core/src/i18n/useResourceTranslation.d.ts +8 -0
- package/dist/ra-core/src/i18n/useResourceTranslation.js +18 -0
- package/dist/ra-core/src/i18n/useTranslatable.d.ts +29 -0
- package/dist/ra-core/src/i18n/useTranslatable.js +98 -0
- package/dist/ra-core/src/i18n/useTranslatableContext.d.ts +31 -0
- package/dist/ra-core/src/i18n/useTranslatableContext.js +38 -0
- package/dist/ra-core/src/i18n/useTranslate.d.ts +21 -0
- package/dist/ra-core/src/i18n/useTranslate.js +29 -0
- package/dist/ra-core/src/i18n/useTranslateLabel.d.ts +6 -0
- package/dist/ra-core/src/i18n/useTranslateLabel.js +26 -0
- package/dist/ra-core/src/index.d.ts +16 -0
- package/dist/ra-core/src/index.js +16 -0
- package/dist/ra-core/src/inference/InferredElement.d.ts +12 -0
- package/dist/ra-core/src/inference/InferredElement.js +40 -0
- package/dist/ra-core/src/inference/assertions.d.ts +26 -0
- package/dist/ra-core/src/inference/assertions.js +38 -0
- package/dist/ra-core/src/inference/getElementsFromRecords.d.ts +35 -0
- package/dist/ra-core/src/inference/getElementsFromRecords.js +39 -0
- package/dist/ra-core/src/inference/getValuesFromRecords.d.ts +28 -0
- package/dist/ra-core/src/inference/getValuesFromRecords.js +40 -0
- package/dist/ra-core/src/inference/index.d.ts +6 -0
- package/dist/ra-core/src/inference/index.js +6 -0
- package/dist/ra-core/src/inference/inferTypeFromValues.d.ts +21 -0
- package/dist/ra-core/src/inference/inferTypeFromValues.js +141 -0
- package/dist/ra-core/src/inference/types.d.ts +9 -0
- package/dist/ra-core/src/inference/types.js +1 -0
- package/dist/ra-core/src/notification/CloseNotificationContext.d.ts +2 -0
- package/dist/ra-core/src/notification/CloseNotificationContext.js +2 -0
- package/dist/ra-core/src/notification/NotificationContext.d.ts +37 -0
- package/dist/ra-core/src/notification/NotificationContext.js +35 -0
- package/dist/ra-core/src/notification/index.d.ts +9 -0
- package/dist/ra-core/src/notification/index.js +9 -0
- package/dist/ra-core/src/notification/types.d.ts +14 -0
- package/dist/ra-core/src/notification/types.js +1 -0
- package/dist/ra-core/src/notification/useCloseNotification.d.ts +1 -0
- package/dist/ra-core/src/notification/useCloseNotification.js +9 -0
- package/dist/ra-core/src/notification/useNotificationContext.d.ts +1 -0
- package/dist/ra-core/src/notification/useNotificationContext.js +3 -0
- package/dist/ra-core/src/notification/useNotify.d.ts +20 -0
- package/dist/ra-core/src/notification/useNotify.js +28 -0
- package/dist/ra-core/src/preferences/index.d.ts +7 -0
- package/dist/ra-core/src/preferences/index.js +7 -0
- package/dist/ra-core/src/preferences/usePreference.d.ts +18 -0
- package/dist/ra-core/src/preferences/usePreference.js +10 -0
- package/dist/ra-core/src/preferences/usePreferenceInput.d.ts +22 -0
- package/dist/ra-core/src/preferences/usePreferenceInput.js +43 -0
- package/dist/ra-core/src/preferences/usePreferencesEditor.d.ts +2 -0
- package/dist/ra-core/src/preferences/usePreferencesEditor.js +9 -0
- package/dist/ra-core/src/preferences/useSetInspectorTitle.d.ts +7 -0
- package/dist/ra-core/src/preferences/useSetInspectorTitle.js +19 -0
- package/dist/ra-core/src/routing/BasenameContext.d.ts +1 -0
- package/dist/ra-core/src/routing/BasenameContext.js +2 -0
- package/dist/ra-core/src/routing/RouterProvider.d.ts +163 -0
- package/dist/ra-core/src/routing/RouterProvider.js +1 -0
- package/dist/ra-core/src/routing/index.d.ts +28 -0
- package/dist/ra-core/src/routing/index.js +28 -0
- package/dist/ra-core/src/routing/types.d.ts +3 -0
- package/dist/ra-core/src/routing/types.js +1 -0
- package/dist/ra-core/src/routing/useBasename.d.ts +21 -0
- package/dist/ra-core/src/routing/useBasename.js +23 -0
- package/dist/ra-core/src/routing/useBlocker.d.ts +14 -0
- package/dist/ra-core/src/routing/useBlocker.js +17 -0
- package/dist/ra-core/src/routing/useCanBlock.d.ts +7 -0
- package/dist/ra-core/src/routing/useCanBlock.js +11 -0
- package/dist/ra-core/src/routing/useCreatePath.d.ts +42 -0
- package/dist/ra-core/src/routing/useCreatePath.js +69 -0
- package/dist/ra-core/src/routing/useGetPathForRecord.d.ts +42 -0
- package/dist/ra-core/src/routing/useGetPathForRecord.js +135 -0
- package/dist/ra-core/src/routing/useGetPathForRecordCallback.d.ts +6 -0
- package/dist/ra-core/src/routing/useGetPathForRecordCallback.js +82 -0
- package/dist/ra-core/src/routing/useInRouterContext.d.ts +11 -0
- package/dist/ra-core/src/routing/useInRouterContext.js +15 -0
- package/dist/ra-core/src/routing/useLocation.d.ts +10 -0
- package/dist/ra-core/src/routing/useLocation.js +13 -0
- package/dist/ra-core/src/routing/useMatch.d.ts +15 -0
- package/dist/ra-core/src/routing/useMatch.js +15 -0
- package/dist/ra-core/src/routing/useMatchPath.d.ts +17 -0
- package/dist/ra-core/src/routing/useMatchPath.js +17 -0
- package/dist/ra-core/src/routing/useNavigate.d.ts +12 -0
- package/dist/ra-core/src/routing/useNavigate.js +15 -0
- package/dist/ra-core/src/routing/useParams.d.ts +9 -0
- package/dist/ra-core/src/routing/useParams.js +13 -0
- package/dist/ra-core/src/routing/useRedirect.d.ts +30 -0
- package/dist/ra-core/src/routing/useRedirect.js +66 -0
- package/dist/ra-core/src/routing/useResetErrorBoundaryOnLocationChange.d.ts +7 -0
- package/dist/ra-core/src/routing/useResetErrorBoundaryOnLocationChange.js +17 -0
- package/dist/ra-core/src/routing/useRestoreScrollPosition.d.ts +40 -0
- package/dist/ra-core/src/routing/useRestoreScrollPosition.js +70 -0
- package/dist/ra-core/src/routing/useSplatPathBase.d.ts +13 -0
- package/dist/ra-core/src/routing/useSplatPathBase.js +21 -0
- package/dist/ra-core/src/store/index.d.ts +11 -0
- package/dist/ra-core/src/store/index.js +11 -0
- package/dist/ra-core/src/store/localStorageStore.d.ts +27 -0
- package/dist/ra-core/src/store/localStorageStore.js +198 -0
- package/dist/ra-core/src/store/types.d.ts +11 -0
- package/dist/ra-core/src/store/types.js +1 -0
- package/dist/ra-core/src/store/useRemoveFromStore.d.ts +17 -0
- package/dist/ra-core/src/store/useRemoveFromStore.js +29 -0
- package/dist/ra-core/src/store/useRemoveItemsFromStore.d.ts +17 -0
- package/dist/ra-core/src/store/useRemoveItemsFromStore.js +29 -0
- package/dist/ra-core/src/store/useResetStore.d.ts +17 -0
- package/dist/ra-core/src/store/useResetStore.js +21 -0
- package/dist/ra-core/src/store/useStore.d.ts +48 -0
- package/dist/ra-core/src/store/useStore.js +32 -0
- package/dist/ra-core/src/store/useStoreContext.d.ts +4 -0
- package/dist/ra-core/src/store/useStoreContext.js +6 -0
- package/dist/ra-core/src/test-ui/defaultI18nProvider.d.ts +2 -0
- package/dist/ra-core/src/test-ui/defaultI18nProvider.js +10 -0
- package/dist/ra-core/src/test-ui/index.d.ts +21 -0
- package/dist/ra-core/src/test-ui/index.js +21 -0
- package/dist/ra-core/src/types.d.ts +284 -0
- package/dist/ra-core/src/types.js +5 -0
- package/dist/ra-core/src/util/asyncDebounce.d.ts +7 -0
- package/dist/ra-core/src/util/asyncDebounce.js +29 -0
- package/dist/ra-core/src/util/escapePath.d.ts +11 -0
- package/dist/ra-core/src/util/escapePath.js +10 -0
- package/dist/ra-core/src/util/genericMemo.d.ts +5 -0
- package/dist/ra-core/src/util/genericMemo.js +14 -0
- package/dist/ra-core/src/util/getFieldLabelTranslationArgs.d.ts +22 -0
- package/dist/ra-core/src/util/getFieldLabelTranslationArgs.js +73 -0
- package/dist/ra-core/src/util/getMutationMode.d.ts +1 -0
- package/dist/ra-core/src/util/getMutationMode.js +13 -0
- package/dist/ra-core/src/util/hooks.d.ts +15 -0
- package/dist/ra-core/src/util/hooks.js +73 -0
- package/dist/ra-core/src/util/index.d.ts +20 -0
- package/dist/ra-core/src/util/index.js +19 -0
- package/dist/ra-core/src/util/mergeRefs.d.ts +2 -0
- package/dist/ra-core/src/util/mergeRefs.js +13 -0
- package/dist/ra-core/src/util/removeEmpty.d.ts +2 -0
- package/dist/ra-core/src/util/removeEmpty.js +16 -0
- package/dist/ra-core/src/util/removeKey.d.ts +2 -0
- package/dist/ra-core/src/util/removeKey.js +22 -0
- package/dist/ra-core/src/util/shallowEqual.d.ts +1 -0
- package/dist/ra-core/src/util/shallowEqual.js +29 -0
- package/dist/ra-core/src/util/useCheckForApplicationUpdate.d.ts +21 -0
- package/dist/ra-core/src/util/useCheckForApplicationUpdate.js +84 -0
- package/dist/ra-core/src/util/useDebouncedEvent.d.ts +8 -0
- package/dist/ra-core/src/util/useDebouncedEvent.js +28 -0
- package/dist/ra-core/src/util/useEvent.d.ts +7 -0
- package/dist/ra-core/src/util/useEvent.js +19 -0
- package/dist/ra-core/src/util/useFieldValue.d.ts +21 -0
- package/dist/ra-core/src/util/useFieldValue.js +27 -0
- package/dist/ra-core/src/util/useWhyDidYouUpdate.d.ts +12 -0
- package/dist/ra-core/src/util/useWhyDidYouUpdate.js +42 -0
- package/dist/ra-core/src/util/warning.d.ts +2 -0
- package/dist/ra-core/src/util/warning.js +5 -0
- package/dist/strato-faker-ecommerce/src/dataProvider.d.ts +2 -0
- package/dist/strato-faker-ecommerce/src/dataProvider.js +6 -0
- package/dist/strato-faker-ecommerce/src/generate.d.ts +8 -0
- package/dist/strato-faker-ecommerce/src/generate.js +148 -0
- package/dist/strato-faker-ecommerce/src/index.d.ts +3 -0
- package/dist/strato-faker-ecommerce/src/index.js +3 -0
- package/dist/strato-faker-ecommerce/src/types.d.ts +69 -0
- package/dist/strato-faker-ecommerce/src/types.js +1 -0
- package/dist/types.d.ts +1 -1
- package/package.json +5 -4
- package/src/dataProvider.ts +3 -3
- package/src/generate.test.ts +12 -12
- package/src/generate.ts +21 -14
- package/src/types.ts +1 -1
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from './DataTableBase';
|
|
2
|
+
export * from './DataTableCallbacksContext';
|
|
3
|
+
export * from './DataTableColumnRankContext';
|
|
4
|
+
export * from './DataTableColumnFilterContext';
|
|
5
|
+
export * from './DataTableConfigContext';
|
|
6
|
+
export * from './DataTableDataContext';
|
|
7
|
+
export * from './DataTableRenderContext';
|
|
8
|
+
export * from './DataTableSelectedIdsContext';
|
|
9
|
+
export * from './DataTableSortContext';
|
|
10
|
+
export * from './DataTableStoreContext';
|
|
11
|
+
export * from './types';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from './DataTableBase';
|
|
2
|
+
export * from './DataTableCallbacksContext';
|
|
3
|
+
export * from './DataTableColumnRankContext';
|
|
4
|
+
export * from './DataTableColumnFilterContext';
|
|
5
|
+
export * from './DataTableConfigContext';
|
|
6
|
+
export * from './DataTableDataContext';
|
|
7
|
+
export * from './DataTableRenderContext';
|
|
8
|
+
export * from './DataTableSelectedIdsContext';
|
|
9
|
+
export * from './DataTableSortContext';
|
|
10
|
+
export * from './DataTableStoreContext';
|
|
11
|
+
export * from './types';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const downloadCSV: (csv: string, filename?: string) => void;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export const downloadCSV = (csv, filename = 'export') => {
|
|
2
|
+
const fakeLink = document.createElement('a');
|
|
3
|
+
fakeLink.style.display = 'none';
|
|
4
|
+
document.body.appendChild(fakeLink);
|
|
5
|
+
const blob = new Blob([csv], { type: 'text/csv;charset=utf-8' });
|
|
6
|
+
// @ts-ignore
|
|
7
|
+
if (window.navigator && window.navigator.msSaveOrOpenBlob) {
|
|
8
|
+
// Manage IE11+ & Edge
|
|
9
|
+
// @ts-ignore
|
|
10
|
+
window.navigator.msSaveOrOpenBlob(blob, `${filename}.csv`);
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
fakeLink.setAttribute('href', URL.createObjectURL(blob));
|
|
14
|
+
fakeLink.setAttribute('download', `${filename}.csv`);
|
|
15
|
+
fakeLink.click();
|
|
16
|
+
}
|
|
17
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { DataProvider, FetchRelatedRecords } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Helper function for calling the dataProvider.getMany() method,
|
|
4
|
+
* and getting a Promise for the records indexed by id in return.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* fetchRelatedRecords(dataProvider)(records, 'post_id', 'posts').then(posts =>
|
|
8
|
+
* posts.map(record => ({
|
|
9
|
+
* ...record,
|
|
10
|
+
* post_title: posts[record.post_id].title,
|
|
11
|
+
* }))
|
|
12
|
+
* );
|
|
13
|
+
*/
|
|
14
|
+
export declare const fetchRelatedRecords: (dataProvider: DataProvider) => FetchRelatedRecords;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { getRelatedIds } from './getRelatedIds';
|
|
2
|
+
/**
|
|
3
|
+
* Helper function for calling the dataProvider.getMany() method,
|
|
4
|
+
* and getting a Promise for the records indexed by id in return.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* fetchRelatedRecords(dataProvider)(records, 'post_id', 'posts').then(posts =>
|
|
8
|
+
* posts.map(record => ({
|
|
9
|
+
* ...record,
|
|
10
|
+
* post_title: posts[record.post_id].title,
|
|
11
|
+
* }))
|
|
12
|
+
* );
|
|
13
|
+
*/
|
|
14
|
+
export const fetchRelatedRecords = (dataProvider) => (data, field, resource) => dataProvider
|
|
15
|
+
.getMany(resource, { ids: getRelatedIds(data, field) })
|
|
16
|
+
.then(({ data }) => data.reduce((acc, post) => {
|
|
17
|
+
acc[post.id] = post;
|
|
18
|
+
return acc;
|
|
19
|
+
}, {}));
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { RaRecord, Identifier } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Extracts, aggregates and deduplicates the ids of related records
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* const books = [
|
|
7
|
+
* { id: 1, author_id: 123, title: 'Pride and Prejudice' },
|
|
8
|
+
* { id: 2, author_id: 123, title: 'Sense and Sensibility' },
|
|
9
|
+
* { id: 3, author_id: 456, title: 'War and Peace' },
|
|
10
|
+
* ];
|
|
11
|
+
* getRelatedIds(books, 'author_id'); => [123, 456]
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* const books = [
|
|
15
|
+
* { id: 1, tag_ids: [1, 2], title: 'Pride and Prejudice' },
|
|
16
|
+
* { id: 2, tag_ids: [2, 3], title: 'Sense and Sensibility' },
|
|
17
|
+
* { id: 3, tag_ids: [4], title: 'War and Peace' },
|
|
18
|
+
* ];
|
|
19
|
+
* getRelatedIds(records, 'tag_ids'); => [1, 2, 3, 4]
|
|
20
|
+
*
|
|
21
|
+
* @param {Object[]} records An array of records
|
|
22
|
+
* @param {string} field the identifier of the record field to use
|
|
23
|
+
*/
|
|
24
|
+
export declare const getRelatedIds: (records: RaRecord[], field: string) => Identifier[];
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extracts, aggregates and deduplicates the ids of related records
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* const books = [
|
|
6
|
+
* { id: 1, author_id: 123, title: 'Pride and Prejudice' },
|
|
7
|
+
* { id: 2, author_id: 123, title: 'Sense and Sensibility' },
|
|
8
|
+
* { id: 3, author_id: 456, title: 'War and Peace' },
|
|
9
|
+
* ];
|
|
10
|
+
* getRelatedIds(books, 'author_id'); => [123, 456]
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* const books = [
|
|
14
|
+
* { id: 1, tag_ids: [1, 2], title: 'Pride and Prejudice' },
|
|
15
|
+
* { id: 2, tag_ids: [2, 3], title: 'Sense and Sensibility' },
|
|
16
|
+
* { id: 3, tag_ids: [4], title: 'War and Peace' },
|
|
17
|
+
* ];
|
|
18
|
+
* getRelatedIds(records, 'tag_ids'); => [1, 2, 3, 4]
|
|
19
|
+
*
|
|
20
|
+
* @param {Object[]} records An array of records
|
|
21
|
+
* @param {string} field the identifier of the record field to use
|
|
22
|
+
*/
|
|
23
|
+
export const getRelatedIds = (records, field) => Array.from(new Set(records
|
|
24
|
+
.filter(record => record[field] != null)
|
|
25
|
+
.map(record => record[field])
|
|
26
|
+
.reduce((ids, value) => ids.concat(value), [])));
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Exporter, RaRecord } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* A hook that provides a callback to export the selected records from the nearest ListContext and call the exporter function for them.
|
|
4
|
+
*/
|
|
5
|
+
export declare function useBulkExport<RecordType extends RaRecord = any>(options?: UseBulkExportOptions<RecordType>): UseBulkExportResult;
|
|
6
|
+
export type UseBulkExportResult = () => void;
|
|
7
|
+
export interface UseBulkExportOptions<RecordType extends RaRecord = any> {
|
|
8
|
+
exporter?: Exporter<RecordType>;
|
|
9
|
+
meta?: any;
|
|
10
|
+
resource?: string;
|
|
11
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { useCallback } from 'react';
|
|
2
|
+
import { useResourceContext } from '../core/useResourceContext';
|
|
3
|
+
import { useListContext } from '../controller/list/useListContext';
|
|
4
|
+
import { useDataProvider } from '../dataProvider/useDataProvider';
|
|
5
|
+
import { useNotify } from '../notification/useNotify';
|
|
6
|
+
import { fetchRelatedRecords } from './fetchRelatedRecords';
|
|
7
|
+
/**
|
|
8
|
+
* A hook that provides a callback to export the selected records from the nearest ListContext and call the exporter function for them.
|
|
9
|
+
*/
|
|
10
|
+
export function useBulkExport(options = {}) {
|
|
11
|
+
const { exporter: customExporter, meta } = options;
|
|
12
|
+
const resource = useResourceContext(options);
|
|
13
|
+
const { exporter: exporterFromContext, selectedIds } = useListContext();
|
|
14
|
+
const exporter = customExporter || exporterFromContext;
|
|
15
|
+
const dataProvider = useDataProvider();
|
|
16
|
+
const notify = useNotify();
|
|
17
|
+
return useCallback(() => {
|
|
18
|
+
if (exporter && resource) {
|
|
19
|
+
dataProvider
|
|
20
|
+
.getMany(resource, { ids: selectedIds, meta })
|
|
21
|
+
.then(({ data }) => exporter(data, fetchRelatedRecords(dataProvider), dataProvider, resource))
|
|
22
|
+
.catch(error => {
|
|
23
|
+
console.error(error);
|
|
24
|
+
notify("strato.notification.http_error', {
|
|
25
|
+
type: 'error',
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
}, [dataProvider, exporter, notify, resource, selectedIds, meta]);
|
|
30
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { UseGetListHookValue } from '../../dataProvider/useGetList';
|
|
2
|
+
import { FilterPayload, RaRecord, SortPayload } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* Context to store choices and functions to retrieve them.
|
|
5
|
+
*
|
|
6
|
+
* Use the useChoicesContext() hook to read the context.
|
|
7
|
+
*/
|
|
8
|
+
export declare const ChoicesContext: import("react").Context<ChoicesContextValue<any> | undefined>;
|
|
9
|
+
export type ChoicesContextBaseValue<RecordType extends RaRecord = any> = {
|
|
10
|
+
displayedFilters: any;
|
|
11
|
+
filter?: FilterPayload;
|
|
12
|
+
filterValues: any;
|
|
13
|
+
hasNextPage?: boolean;
|
|
14
|
+
hasPreviousPage?: boolean;
|
|
15
|
+
hideFilter: (filterName: string) => void;
|
|
16
|
+
isFetching: boolean;
|
|
17
|
+
isLoading: boolean;
|
|
18
|
+
isPaused?: boolean;
|
|
19
|
+
isPlaceholderData?: boolean;
|
|
20
|
+
page: number;
|
|
21
|
+
perPage: number;
|
|
22
|
+
refetch: (() => void) | UseGetListHookValue<RecordType>['refetch'];
|
|
23
|
+
resource: string;
|
|
24
|
+
setFilters: (filters: any, displayedFilters?: any, debounce?: boolean) => void;
|
|
25
|
+
setPage: (page: number) => void;
|
|
26
|
+
setPerPage: (page: number) => void;
|
|
27
|
+
setSort: (sort: SortPayload) => void;
|
|
28
|
+
showFilter: (filterName: string, defaultValue: any) => void;
|
|
29
|
+
sort: SortPayload;
|
|
30
|
+
source: string;
|
|
31
|
+
isFromReference: boolean;
|
|
32
|
+
};
|
|
33
|
+
export interface ChoicesContextLoadingResult<RecordType extends RaRecord = any> extends ChoicesContextBaseValue<RecordType> {
|
|
34
|
+
allChoices: undefined;
|
|
35
|
+
availableChoices: undefined;
|
|
36
|
+
selectedChoices: undefined;
|
|
37
|
+
total: undefined;
|
|
38
|
+
error: null;
|
|
39
|
+
isPending: true;
|
|
40
|
+
}
|
|
41
|
+
export interface ChoicesContextErrorResult<RecordType extends RaRecord = any, TError = Error> extends ChoicesContextBaseValue<RecordType> {
|
|
42
|
+
allChoices: undefined;
|
|
43
|
+
availableChoices: undefined;
|
|
44
|
+
selectedChoices: undefined;
|
|
45
|
+
total: undefined;
|
|
46
|
+
error: TError;
|
|
47
|
+
isPending: false;
|
|
48
|
+
}
|
|
49
|
+
export interface ChoicesContextRefetchErrorResult<RecordType extends RaRecord = any, TError = Error> extends ChoicesContextBaseValue<RecordType> {
|
|
50
|
+
allChoices: RecordType[];
|
|
51
|
+
availableChoices: RecordType[];
|
|
52
|
+
selectedChoices: RecordType[];
|
|
53
|
+
total: number;
|
|
54
|
+
error: TError;
|
|
55
|
+
isPending: false;
|
|
56
|
+
}
|
|
57
|
+
export interface ChoicesContextSuccessResult<RecordType extends RaRecord = any> extends ChoicesContextBaseValue<RecordType> {
|
|
58
|
+
allChoices: RecordType[];
|
|
59
|
+
availableChoices: RecordType[];
|
|
60
|
+
selectedChoices: RecordType[];
|
|
61
|
+
total: number;
|
|
62
|
+
error: null;
|
|
63
|
+
isPending: false;
|
|
64
|
+
}
|
|
65
|
+
export type ChoicesContextValue<RecordType extends RaRecord = any> = ChoicesContextLoadingResult<RecordType> | ChoicesContextErrorResult<RecordType> | ChoicesContextRefetchErrorResult<RecordType> | ChoicesContextSuccessResult<RecordType>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { RaRecord } from '../../types';
|
|
2
|
+
import { ChoicesContextValue } from './ChoicesContext';
|
|
3
|
+
export declare const useChoicesContext: <ChoicesType extends RaRecord = RaRecord>(options?: Partial<ChoicesContextValue> & {
|
|
4
|
+
choices?: ChoicesType[];
|
|
5
|
+
}) => ChoicesContextValue<ChoicesType>;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { useContext, useMemo } from 'react';
|
|
2
|
+
import { useList } from '../../controller';
|
|
3
|
+
import { ChoicesContext } from './ChoicesContext';
|
|
4
|
+
export const useChoicesContext = (options = {}) => {
|
|
5
|
+
const context = useContext(ChoicesContext);
|
|
6
|
+
const choices = options.choices && isArrayOfStrings(options.choices)
|
|
7
|
+
? convertOptionsToChoices(options.choices)
|
|
8
|
+
: options.choices;
|
|
9
|
+
// @ts-ignore cannot satisfy the type of useList because of ability to pass partial options
|
|
10
|
+
const { data, ...list } = useList({
|
|
11
|
+
data: choices,
|
|
12
|
+
isLoading: options.isLoading ?? false,
|
|
13
|
+
isPending: options.isPending ?? false,
|
|
14
|
+
isFetching: options.isFetching ?? false,
|
|
15
|
+
error: options.error,
|
|
16
|
+
// When not in a ChoicesContext, paginating does not make sense (e.g. AutocompleteInput).
|
|
17
|
+
perPage: Infinity,
|
|
18
|
+
});
|
|
19
|
+
const result = useMemo(() => {
|
|
20
|
+
// Props take precedence over context.
|
|
21
|
+
if (options.choices || !context) {
|
|
22
|
+
return {
|
|
23
|
+
allChoices: data,
|
|
24
|
+
availableChoices: options.availableChoices ?? data,
|
|
25
|
+
selectedChoices: options.selectedChoices ?? data,
|
|
26
|
+
displayedFilters: options.selectedChoices ?? list.displayedFilters,
|
|
27
|
+
error: options.error,
|
|
28
|
+
filter: options.filter ?? list.filter,
|
|
29
|
+
filterValues: options.filterValues ?? list.filterValues,
|
|
30
|
+
hasNextPage: options.hasNextPage ?? list.hasNextPage,
|
|
31
|
+
hasPreviousPage: options.hasPreviousPage ?? list.hasPreviousPage,
|
|
32
|
+
hideFilter: options.hideFilter ?? list.hideFilter,
|
|
33
|
+
isFetching: list.isFetching ?? false, // we must take the one for useList, otherwise the loading state isn't synchronized with the data
|
|
34
|
+
isLoading: list.isLoading ?? false, // same
|
|
35
|
+
isPaused: list.isPaused ?? false, // same
|
|
36
|
+
isPending: list.isPending ?? false, // same
|
|
37
|
+
isPlaceholderData: list.isPlaceholderData ?? false, // same
|
|
38
|
+
page: options.page ?? list.page,
|
|
39
|
+
perPage: options.perPage ?? list.perPage,
|
|
40
|
+
refetch: options.refetch ?? list.refetch,
|
|
41
|
+
resource: options.resource ?? list.resource,
|
|
42
|
+
setFilters: options.setFilters ?? list.setFilters,
|
|
43
|
+
setPage: options.setPage ?? list.setPage,
|
|
44
|
+
setPerPage: options.setPerPage ?? list.setPerPage,
|
|
45
|
+
setSort: options.setSort ?? list.setSort,
|
|
46
|
+
showFilter: options.showFilter ?? list.showFilter,
|
|
47
|
+
sort: options.sort ?? list.sort,
|
|
48
|
+
source: options.source,
|
|
49
|
+
total: options.total ?? list.total,
|
|
50
|
+
isFromReference: false,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
return context;
|
|
54
|
+
}, [context, data, list, options]);
|
|
55
|
+
return result;
|
|
56
|
+
};
|
|
57
|
+
const isArrayOfStrings = (choices) => Array.isArray(choices) &&
|
|
58
|
+
choices.every(choice => typeof choice === 'string');
|
|
59
|
+
const convertOptionsToChoices = (options) => options.map(choice => ({
|
|
60
|
+
id: choice,
|
|
61
|
+
name: choice,
|
|
62
|
+
}));
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { RaRecord } from '../types';
|
|
2
|
+
export default function getFormInitialValues(defaultValues: DefaultValue, record?: Partial<RaRecord>): any;
|
|
3
|
+
interface DefaultValueObject {
|
|
4
|
+
[key: string]: any;
|
|
5
|
+
}
|
|
6
|
+
type DefaultValueFunction = (record: RaRecord) => DefaultValueObject;
|
|
7
|
+
type DefaultValue = DefaultValueObject | DefaultValueFunction;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import merge from 'lodash/merge.js';
|
|
2
|
+
export default function getFormInitialValues(defaultValues, record) {
|
|
3
|
+
const finalInitialValues = merge({}, getValues(defaultValues, record), record);
|
|
4
|
+
return finalInitialValues;
|
|
5
|
+
}
|
|
6
|
+
function getValues(values, record) {
|
|
7
|
+
if (typeof values === 'object') {
|
|
8
|
+
return values;
|
|
9
|
+
}
|
|
10
|
+
if (typeof values === 'function') {
|
|
11
|
+
return values(record);
|
|
12
|
+
}
|
|
13
|
+
return {};
|
|
14
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Context allowing inputs to register to a specific group.
|
|
3
|
+
* This enables other components in the group to access group properties such as its
|
|
4
|
+
* validation (valid/invalid) or whether its inputs have been updated (dirty/pristine).
|
|
5
|
+
*
|
|
6
|
+
* This should only be used through a FormGroupContextProvider.
|
|
7
|
+
*/
|
|
8
|
+
export declare const FormGroupContext: import("react").Context<string | null>;
|
|
9
|
+
export type FormGroupContextValue = string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { createContext } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Context allowing inputs to register to a specific group.
|
|
4
|
+
* This enables other components in the group to access group properties such as its
|
|
5
|
+
* validation (valid/invalid) or whether its inputs have been updated (dirty/pristine).
|
|
6
|
+
*
|
|
7
|
+
* This should only be used through a FormGroupContextProvider.
|
|
8
|
+
*/
|
|
9
|
+
export const FormGroupContext = createContext(null);
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
type FieldState = {
|
|
2
|
+
name: string;
|
|
3
|
+
error?: any;
|
|
4
|
+
isDirty: boolean;
|
|
5
|
+
isTouched: boolean;
|
|
6
|
+
isValid: boolean;
|
|
7
|
+
isValidating: boolean;
|
|
8
|
+
};
|
|
9
|
+
type FormGroupState = {
|
|
10
|
+
errors?: object;
|
|
11
|
+
isDirty: boolean;
|
|
12
|
+
isTouched: boolean;
|
|
13
|
+
isValid: boolean;
|
|
14
|
+
isValidating: boolean;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Retrieve a specific form group data such as its validation status (valid/invalid) or
|
|
18
|
+
* or whether its inputs have been updated (dirty/pristine)
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* import { Edit, SimpleForm, TextInput, FormGroupContextProvider, useFormGroup, minLength } from 'react-admin';
|
|
22
|
+
* import { Accordion, AccordionDetails, AccordionSummary, Typography } from '@mui/material';
|
|
23
|
+
* import ExpandMoreIcon from '@mui/icons-material/ExpandMoreIcon';
|
|
24
|
+
*
|
|
25
|
+
* const PostEdit = () => (
|
|
26
|
+
* <Edit>
|
|
27
|
+
* <SimpleForm>
|
|
28
|
+
* <TextInput source="title" />
|
|
29
|
+
* <FormGroupContextProvider name="options">
|
|
30
|
+
* <Accordion>
|
|
31
|
+
* <AccordionSummary
|
|
32
|
+
* expandIcon={<ExpandMoreIcon />}
|
|
33
|
+
* aria-controls="options-content"
|
|
34
|
+
* id="options-header"
|
|
35
|
+
* >
|
|
36
|
+
* <AccordionSectionTitle name="options">Options</AccordionSectionTitle>
|
|
37
|
+
* </AccordionSummary>
|
|
38
|
+
* <AccordionDetails id="options-content" aria-labelledby="options-header">
|
|
39
|
+
* <TextInput source="teaser" validate={minLength(20)} />
|
|
40
|
+
* </AccordionDetails>
|
|
41
|
+
* </Accordion>
|
|
42
|
+
* </FormGroupContextProvider>
|
|
43
|
+
* </SimpleForm>
|
|
44
|
+
* </Edit>
|
|
45
|
+
* );
|
|
46
|
+
*
|
|
47
|
+
* const AccordionSectionTitle = ({ children, name }) => {
|
|
48
|
+
* const formGroupState = useFormGroup(name);
|
|
49
|
+
* return (
|
|
50
|
+
* <Typography color={!formGroupState.isValid && formGroupState.isDirty ? 'error' : 'inherit'}>
|
|
51
|
+
* {children}
|
|
52
|
+
* </Typography>
|
|
53
|
+
* );
|
|
54
|
+
* }
|
|
55
|
+
*
|
|
56
|
+
* @param {string} name The form group name
|
|
57
|
+
* @returns {FormGroupState} The form group state
|
|
58
|
+
*/
|
|
59
|
+
export declare const useFormGroup: (name: string) => FormGroupState;
|
|
60
|
+
/**
|
|
61
|
+
* Get the state of a form group
|
|
62
|
+
*
|
|
63
|
+
* @param {FieldState[]} fieldStates A map of field states from react-hook-form where the key is the field name.
|
|
64
|
+
* @returns {FormGroupState} The state of the group.
|
|
65
|
+
*/
|
|
66
|
+
export declare const getFormGroupState: (fieldStates: FieldState[]) => FormGroupState;
|
|
67
|
+
export {};
|