@strato-admin/faker-ecommerce 0.1.0 → 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 +6 -5
- 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,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read and write a value from the Store
|
|
3
|
+
*
|
|
4
|
+
* useState-like hook using the global Store for persistence.
|
|
5
|
+
* Each time a store value is changed, all components using this value will be re-rendered.
|
|
6
|
+
*
|
|
7
|
+
* @param {string} key Name of the store key. Separate with dots to namespace, e.g. 'posts.list.columns'.
|
|
8
|
+
* @param {any} defaultValue Default value
|
|
9
|
+
*
|
|
10
|
+
* @return {Object} A value and a setter for the value, in an array - just like for useState()
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* import { useStore } from 'react-admin';
|
|
14
|
+
*
|
|
15
|
+
* const PostList = () => {
|
|
16
|
+
* const [density] = useStore('posts.list.density', 'small');
|
|
17
|
+
*
|
|
18
|
+
* return (
|
|
19
|
+
* <List>
|
|
20
|
+
* <Datagrid size={density}>
|
|
21
|
+
* ...
|
|
22
|
+
* </Datagrid>
|
|
23
|
+
* </List>
|
|
24
|
+
* );
|
|
25
|
+
* }
|
|
26
|
+
*
|
|
27
|
+
* // Clicking on this button will trigger a rerender of the PostList!
|
|
28
|
+
* const ChangeDensity: FC<any> = () => {
|
|
29
|
+
* const [density, setDensity] = useStore('posts.list.density', 'small');
|
|
30
|
+
*
|
|
31
|
+
* const changeDensity = (): void => {
|
|
32
|
+
* setDensity(density === 'small' ? 'medium' : 'small');
|
|
33
|
+
* };
|
|
34
|
+
*
|
|
35
|
+
* return (
|
|
36
|
+
* <Button onClick={changeDensity}>
|
|
37
|
+
* {`Change density (current ${density})`}
|
|
38
|
+
* </Button>
|
|
39
|
+
* );
|
|
40
|
+
* };
|
|
41
|
+
*/
|
|
42
|
+
declare function useStore<T>(key: string, defaultValue: T): [T, (value: T | ((value: T) => void), defaultValue?: T) => void];
|
|
43
|
+
declare function useStore<T = undefined>(key: string, defaultValue?: T | undefined): [T | undefined, (value: T | ((value: T) => void), defaultValue?: T) => void];
|
|
44
|
+
export type useStoreResult<T = any> = [
|
|
45
|
+
T,
|
|
46
|
+
(value: T | ((value: T) => void), defaultValue?: T) => void
|
|
47
|
+
];
|
|
48
|
+
export { useStore };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { useState, useEffect } from 'react';
|
|
2
|
+
import isEqual from 'lodash/isEqual.js';
|
|
3
|
+
import { useEvent } from '../util';
|
|
4
|
+
import { useStoreContext } from './useStoreContext';
|
|
5
|
+
function useStore(key, defaultValue) {
|
|
6
|
+
const { getItem, setItem, subscribe } = useStoreContext();
|
|
7
|
+
const [value, setValue] = useState(() => getItem(key, defaultValue));
|
|
8
|
+
// subscribe to changes on this key, and change the state when they happen
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
const storedValue = getItem(key, defaultValue);
|
|
11
|
+
if (!isEqual(value, storedValue)) {
|
|
12
|
+
setValue(storedValue);
|
|
13
|
+
}
|
|
14
|
+
const unsubscribe = subscribe(key, newValue => {
|
|
15
|
+
setValue(typeof newValue === 'undefined' ? defaultValue : newValue);
|
|
16
|
+
});
|
|
17
|
+
return () => unsubscribe();
|
|
18
|
+
}, [key, subscribe, defaultValue, getItem, value]);
|
|
19
|
+
const set = useEvent((valueParam, runtimeDefaultValue) => {
|
|
20
|
+
const newValue = typeof valueParam === 'function' ? valueParam(value) : valueParam;
|
|
21
|
+
// we only set the value in the Store;
|
|
22
|
+
// the value in the local state will be updated
|
|
23
|
+
// by the useEffect during the next render
|
|
24
|
+
setItem(key, typeof newValue === 'undefined'
|
|
25
|
+
? typeof runtimeDefaultValue === 'undefined'
|
|
26
|
+
? defaultValue
|
|
27
|
+
: runtimeDefaultValue
|
|
28
|
+
: newValue);
|
|
29
|
+
});
|
|
30
|
+
return [value, set];
|
|
31
|
+
}
|
|
32
|
+
export { useStore };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export * from './Admin';
|
|
2
|
+
export * from './ArrayInput';
|
|
3
|
+
export * from './AutocompleteArrayInput';
|
|
4
|
+
export * from './AutocompleteInput';
|
|
5
|
+
export * from './BooleanInput';
|
|
6
|
+
export * from './Confirm';
|
|
7
|
+
export * from './CreateButton';
|
|
8
|
+
export * from './DataTable';
|
|
9
|
+
export * from './defaultI18nProvider';
|
|
10
|
+
export * from './DeleteButton';
|
|
11
|
+
export * from './EditButton';
|
|
12
|
+
export * from './Layout';
|
|
13
|
+
export * from './Notification';
|
|
14
|
+
export * from './Pagination';
|
|
15
|
+
export * from './PrevNextButtons';
|
|
16
|
+
export * from './ShowButton';
|
|
17
|
+
export * from './SimpleForm';
|
|
18
|
+
export * from './SimpleFormIterator';
|
|
19
|
+
export * from './SimpleList';
|
|
20
|
+
export * from './SimpleShowLayout';
|
|
21
|
+
export * from './TextInput';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export * from './Admin';
|
|
2
|
+
export * from './ArrayInput';
|
|
3
|
+
export * from './AutocompleteArrayInput';
|
|
4
|
+
export * from './AutocompleteInput';
|
|
5
|
+
export * from './BooleanInput';
|
|
6
|
+
export * from './Confirm';
|
|
7
|
+
export * from './CreateButton';
|
|
8
|
+
export * from './DataTable';
|
|
9
|
+
export * from './defaultI18nProvider';
|
|
10
|
+
export * from './DeleteButton';
|
|
11
|
+
export * from './EditButton';
|
|
12
|
+
export * from './Layout';
|
|
13
|
+
export * from './Notification';
|
|
14
|
+
export * from './Pagination';
|
|
15
|
+
export * from './PrevNextButtons';
|
|
16
|
+
export * from './ShowButton';
|
|
17
|
+
export * from './SimpleForm';
|
|
18
|
+
export * from './SimpleFormIterator';
|
|
19
|
+
export * from './SimpleList';
|
|
20
|
+
export * from './SimpleShowLayout';
|
|
21
|
+
export * from './TextInput';
|
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
import { ComponentType, ReactElement, ReactNode } from 'react';
|
|
2
|
+
import { FieldPath } from 'react-hook-form';
|
|
3
|
+
import { WithPermissionsChildrenParams } from './auth/WithPermissions';
|
|
4
|
+
import { AuthActionType } from './auth/types';
|
|
5
|
+
/**
|
|
6
|
+
* data types
|
|
7
|
+
*/
|
|
8
|
+
export type Identifier = string | number;
|
|
9
|
+
export interface RaRecord<IdentifierType extends Identifier = Identifier> extends Record<string, any> {
|
|
10
|
+
id: IdentifierType;
|
|
11
|
+
}
|
|
12
|
+
export interface SortPayload {
|
|
13
|
+
field: string;
|
|
14
|
+
order: 'ASC' | 'DESC';
|
|
15
|
+
}
|
|
16
|
+
export interface FilterPayload {
|
|
17
|
+
[k: string]: any;
|
|
18
|
+
}
|
|
19
|
+
export interface PaginationPayload {
|
|
20
|
+
page: number;
|
|
21
|
+
perPage: number;
|
|
22
|
+
}
|
|
23
|
+
export type ValidUntil = Date;
|
|
24
|
+
/**
|
|
25
|
+
* i18nProvider types
|
|
26
|
+
*/
|
|
27
|
+
export declare const I18N_TRANSLATE = "I18N_TRANSLATE";
|
|
28
|
+
export declare const I18N_CHANGE_LOCALE = "I18N_CHANGE_LOCALE";
|
|
29
|
+
export type TranslateFunction = (key: string, options?: any) => string;
|
|
30
|
+
export type Locale = {
|
|
31
|
+
locale: string;
|
|
32
|
+
name: string;
|
|
33
|
+
};
|
|
34
|
+
export type I18nProvider = {
|
|
35
|
+
translate: TranslateFunction;
|
|
36
|
+
changeLocale: (locale: string, options?: any) => Promise<void>;
|
|
37
|
+
getLocale: () => string;
|
|
38
|
+
getLocales?: () => Locale[];
|
|
39
|
+
[key: string]: any;
|
|
40
|
+
};
|
|
41
|
+
export interface UserIdentity {
|
|
42
|
+
id: Identifier;
|
|
43
|
+
fullName?: string;
|
|
44
|
+
avatar?: string;
|
|
45
|
+
[key: string]: any;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* authProvider types
|
|
49
|
+
*/
|
|
50
|
+
export type AuthProvider = {
|
|
51
|
+
login: (params: any) => Promise<{
|
|
52
|
+
redirectTo?: string | boolean;
|
|
53
|
+
} | void | any>;
|
|
54
|
+
logout: (params: any) => Promise<void | false | string>;
|
|
55
|
+
checkAuth: (params: any & QueryFunctionContext) => Promise<void>;
|
|
56
|
+
checkError: (error: any) => Promise<void>;
|
|
57
|
+
getIdentity?: (params?: QueryFunctionContext) => Promise<UserIdentity>;
|
|
58
|
+
getPermissions?: (params: any & QueryFunctionContext) => Promise<any>;
|
|
59
|
+
handleCallback?: (params?: QueryFunctionContext) => Promise<AuthRedirectResult | void | any>;
|
|
60
|
+
canAccess?: <RecordType extends Record<string, any> = Record<string, any>>(params: QueryFunctionContext & {
|
|
61
|
+
action: string;
|
|
62
|
+
resource: string;
|
|
63
|
+
record?: RecordType;
|
|
64
|
+
}) => Promise<boolean>;
|
|
65
|
+
[key: string]: any;
|
|
66
|
+
supportAbortSignal?: boolean;
|
|
67
|
+
};
|
|
68
|
+
export type AuthRedirectResult = {
|
|
69
|
+
redirectTo?: string | false;
|
|
70
|
+
logoutOnFailure?: boolean;
|
|
71
|
+
};
|
|
72
|
+
export type LegacyAuthProvider = (type: AuthActionType, params?: any) => Promise<any>;
|
|
73
|
+
/**
|
|
74
|
+
* dataProvider types
|
|
75
|
+
*/
|
|
76
|
+
export type DataProvider<ResourceType extends string = string> = {
|
|
77
|
+
getList: <RecordType extends RaRecord = any>(resource: ResourceType, params: GetListParams & QueryFunctionContext) => Promise<GetListResult<RecordType>>;
|
|
78
|
+
getOne: <RecordType extends RaRecord = any>(resource: ResourceType, params: GetOneParams<RecordType> & QueryFunctionContext) => Promise<GetOneResult<RecordType>>;
|
|
79
|
+
getMany: <RecordType extends RaRecord = any>(resource: ResourceType, params: GetManyParams<RecordType> & QueryFunctionContext) => Promise<GetManyResult<RecordType>>;
|
|
80
|
+
getManyReference: <RecordType extends RaRecord = any>(resource: ResourceType, params: GetManyReferenceParams & QueryFunctionContext) => Promise<GetManyReferenceResult<RecordType>>;
|
|
81
|
+
update: <RecordType extends RaRecord = any>(resource: ResourceType, params: UpdateParams) => Promise<UpdateResult<RecordType>>;
|
|
82
|
+
updateMany: <RecordType extends RaRecord = any>(resource: ResourceType, params: UpdateManyParams) => Promise<UpdateManyResult<RecordType>>;
|
|
83
|
+
create: <RecordType extends Omit<RaRecord, 'id'> = any, ResultRecordType extends RaRecord = RecordType & {
|
|
84
|
+
id: Identifier;
|
|
85
|
+
}>(resource: ResourceType, params: CreateParams) => Promise<CreateResult<ResultRecordType>>;
|
|
86
|
+
delete: <RecordType extends RaRecord = any>(resource: ResourceType, params: DeleteParams<RecordType>) => Promise<DeleteResult<RecordType>>;
|
|
87
|
+
deleteMany: <RecordType extends RaRecord = any>(resource: ResourceType, params: DeleteManyParams<RecordType>) => Promise<DeleteManyResult<RecordType>>;
|
|
88
|
+
[key: string]: any;
|
|
89
|
+
supportAbortSignal?: boolean;
|
|
90
|
+
};
|
|
91
|
+
export interface QueryFunctionContext {
|
|
92
|
+
signal?: AbortSignal;
|
|
93
|
+
}
|
|
94
|
+
export interface GetListParams {
|
|
95
|
+
pagination?: PaginationPayload;
|
|
96
|
+
sort?: SortPayload;
|
|
97
|
+
filter?: any;
|
|
98
|
+
meta?: any;
|
|
99
|
+
signal?: AbortSignal;
|
|
100
|
+
}
|
|
101
|
+
export interface GetListResult<RecordType extends RaRecord = any> {
|
|
102
|
+
data: RecordType[];
|
|
103
|
+
total?: number;
|
|
104
|
+
pageInfo?: {
|
|
105
|
+
hasNextPage?: boolean;
|
|
106
|
+
hasPreviousPage?: boolean;
|
|
107
|
+
};
|
|
108
|
+
meta?: any;
|
|
109
|
+
}
|
|
110
|
+
export interface GetInfiniteListResult<RecordType extends RaRecord = any> extends GetListResult<RecordType> {
|
|
111
|
+
pageParam: number;
|
|
112
|
+
}
|
|
113
|
+
export interface GetOneParams<RecordType extends RaRecord = any> {
|
|
114
|
+
id: RecordType['id'];
|
|
115
|
+
meta?: any;
|
|
116
|
+
signal?: AbortSignal;
|
|
117
|
+
}
|
|
118
|
+
export interface GetOneResult<RecordType extends RaRecord = any> {
|
|
119
|
+
data: RecordType;
|
|
120
|
+
meta?: any;
|
|
121
|
+
}
|
|
122
|
+
export interface GetManyParams<RecordType extends RaRecord = any> {
|
|
123
|
+
ids: RecordType['id'][];
|
|
124
|
+
meta?: any;
|
|
125
|
+
signal?: AbortSignal;
|
|
126
|
+
}
|
|
127
|
+
export interface GetManyResult<RecordType extends RaRecord = any> {
|
|
128
|
+
data: RecordType[];
|
|
129
|
+
meta?: any;
|
|
130
|
+
}
|
|
131
|
+
export interface GetManyReferenceParams {
|
|
132
|
+
target: string;
|
|
133
|
+
id: Identifier;
|
|
134
|
+
pagination: PaginationPayload;
|
|
135
|
+
sort: SortPayload;
|
|
136
|
+
filter: any;
|
|
137
|
+
meta?: any;
|
|
138
|
+
signal?: AbortSignal;
|
|
139
|
+
}
|
|
140
|
+
export interface GetManyReferenceResult<RecordType extends RaRecord = any> {
|
|
141
|
+
data: RecordType[];
|
|
142
|
+
total?: number;
|
|
143
|
+
pageInfo?: {
|
|
144
|
+
hasNextPage?: boolean;
|
|
145
|
+
hasPreviousPage?: boolean;
|
|
146
|
+
};
|
|
147
|
+
meta?: any;
|
|
148
|
+
}
|
|
149
|
+
export interface UpdateParams<RecordType extends RaRecord = any> {
|
|
150
|
+
id: RecordType['id'];
|
|
151
|
+
data: Partial<RecordType>;
|
|
152
|
+
previousData: RecordType;
|
|
153
|
+
meta?: any;
|
|
154
|
+
}
|
|
155
|
+
export interface UpdateResult<RecordType extends RaRecord = any> {
|
|
156
|
+
data: RecordType;
|
|
157
|
+
meta?: any;
|
|
158
|
+
}
|
|
159
|
+
export interface UpdateManyParams<T = any> {
|
|
160
|
+
ids: Identifier[];
|
|
161
|
+
data: Partial<T>;
|
|
162
|
+
meta?: any;
|
|
163
|
+
}
|
|
164
|
+
export interface UpdateManyResult<RecordType extends RaRecord = any> {
|
|
165
|
+
data?: RecordType['id'][];
|
|
166
|
+
meta?: any;
|
|
167
|
+
}
|
|
168
|
+
export interface CreateParams<T = any> {
|
|
169
|
+
data: Partial<T>;
|
|
170
|
+
meta?: any;
|
|
171
|
+
}
|
|
172
|
+
export interface CreateResult<RecordType extends RaRecord = any> {
|
|
173
|
+
data: RecordType;
|
|
174
|
+
meta?: any;
|
|
175
|
+
}
|
|
176
|
+
export interface DeleteParams<RecordType extends RaRecord = any> {
|
|
177
|
+
id: RecordType['id'];
|
|
178
|
+
previousData?: RecordType;
|
|
179
|
+
meta?: any;
|
|
180
|
+
}
|
|
181
|
+
export interface DeleteResult<RecordType extends RaRecord = any> {
|
|
182
|
+
data: RecordType;
|
|
183
|
+
meta?: any;
|
|
184
|
+
}
|
|
185
|
+
export interface DeleteManyParams<RecordType extends RaRecord = any> {
|
|
186
|
+
ids: RecordType['id'][];
|
|
187
|
+
meta?: any;
|
|
188
|
+
}
|
|
189
|
+
export interface DeleteManyResult<RecordType extends RaRecord = any> {
|
|
190
|
+
data?: RecordType['id'][];
|
|
191
|
+
meta?: any;
|
|
192
|
+
}
|
|
193
|
+
export type DataProviderResult<RecordType extends RaRecord = any> = CreateResult<RecordType> | DeleteResult<RecordType> | DeleteManyResult | GetListResult<RecordType> | GetManyResult<RecordType> | GetManyReferenceResult<RecordType> | GetOneResult<RecordType> | UpdateResult<RecordType> | UpdateManyResult;
|
|
194
|
+
export type MutationMode = 'pessimistic' | 'optimistic' | 'undoable';
|
|
195
|
+
export type OnSuccess = (response?: any, variables?: any, onMutateResult?: any, context?: any) => void;
|
|
196
|
+
export type OnError = (error?: any, variables?: any, onMutateResult?: any, context?: any) => void;
|
|
197
|
+
export type TransformData = (data: any, options?: {
|
|
198
|
+
previousData: any;
|
|
199
|
+
}) => any | Promise<any>;
|
|
200
|
+
export interface UseDataProviderOptions {
|
|
201
|
+
action?: string;
|
|
202
|
+
fetch?: string;
|
|
203
|
+
meta?: object;
|
|
204
|
+
mutationMode?: MutationMode;
|
|
205
|
+
onSuccess?: OnSuccess;
|
|
206
|
+
onError?: OnError;
|
|
207
|
+
enabled?: boolean;
|
|
208
|
+
}
|
|
209
|
+
export type LegacyDataProvider = (type: string, resource: string, params: any) => Promise<any>;
|
|
210
|
+
export type RecordToStringFunction = (record: any) => string;
|
|
211
|
+
export interface ResourceDefinition<OptionsType extends ResourceOptions = any> {
|
|
212
|
+
readonly name: string;
|
|
213
|
+
readonly options?: OptionsType;
|
|
214
|
+
readonly hasList?: boolean;
|
|
215
|
+
readonly hasEdit?: boolean;
|
|
216
|
+
readonly hasShow?: boolean;
|
|
217
|
+
readonly hasCreate?: boolean;
|
|
218
|
+
readonly icon?: any;
|
|
219
|
+
readonly recordRepresentation?: React.ReactNode | RecordToStringFunction;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Misc types
|
|
223
|
+
*/
|
|
224
|
+
export type Dispatch<T> = T extends (...args: infer A) => any ? (...args: A) => void : never;
|
|
225
|
+
export type ResourceElement = ReactElement<ResourceProps>;
|
|
226
|
+
export type RenderResourcesFunction = (permissions: any) => ReactNode | Promise<ReactNode> | ResourceElement[] | Promise<ResourceElement[]>;
|
|
227
|
+
export type AdminChildren = RenderResourcesFunction | Iterable<ReactNode | RenderResourcesFunction> | ReactNode;
|
|
228
|
+
export type TitleComponent = string | ReactElement<any>;
|
|
229
|
+
export type CatchAllComponent = ComponentType<{
|
|
230
|
+
title?: TitleComponent;
|
|
231
|
+
}>;
|
|
232
|
+
export type LoginComponent = ComponentType<{}> | ReactElement<any>;
|
|
233
|
+
export type DashboardComponent = ComponentType<WithPermissionsChildrenParams>;
|
|
234
|
+
export interface CoreLayoutProps {
|
|
235
|
+
children: ReactNode;
|
|
236
|
+
}
|
|
237
|
+
export type LayoutComponent = ComponentType<CoreLayoutProps>;
|
|
238
|
+
export type LoadingComponent = ComponentType<{
|
|
239
|
+
loadingPrimary?: string;
|
|
240
|
+
loadingSecondary?: string;
|
|
241
|
+
}>;
|
|
242
|
+
export interface ResourceComponentInjectedProps {
|
|
243
|
+
permissions?: any;
|
|
244
|
+
resource?: string;
|
|
245
|
+
options?: any;
|
|
246
|
+
hasList?: boolean;
|
|
247
|
+
hasEdit?: boolean;
|
|
248
|
+
hasShow?: boolean;
|
|
249
|
+
hasCreate?: boolean;
|
|
250
|
+
}
|
|
251
|
+
export interface ResourceOptions {
|
|
252
|
+
label?: string;
|
|
253
|
+
[key: string]: any;
|
|
254
|
+
}
|
|
255
|
+
export interface ResourceProps {
|
|
256
|
+
intent?: 'route' | 'registration';
|
|
257
|
+
name: string;
|
|
258
|
+
list?: ComponentType<any> | ReactElement;
|
|
259
|
+
create?: ComponentType<any> | ReactElement;
|
|
260
|
+
edit?: ComponentType<any> | ReactElement;
|
|
261
|
+
show?: ComponentType<any> | ReactElement;
|
|
262
|
+
hasCreate?: boolean;
|
|
263
|
+
hasEdit?: boolean;
|
|
264
|
+
hasShow?: boolean;
|
|
265
|
+
icon?: ComponentType<any>;
|
|
266
|
+
recordRepresentation?: React.ReactNode | RecordToStringFunction;
|
|
267
|
+
options?: ResourceOptions;
|
|
268
|
+
children?: ReactNode;
|
|
269
|
+
}
|
|
270
|
+
export type Exporter<RecordType extends RaRecord = any> = (data: RecordType[], fetchRelatedRecords: FetchRelatedRecords, dataProvider: DataProvider, resource?: string) => void | Promise<void>;
|
|
271
|
+
export type FetchRelatedRecords = <RecordType = any>(data: any[], field: string, resource: string) => Promise<{
|
|
272
|
+
[key: Identifier]: RecordType;
|
|
273
|
+
}>;
|
|
274
|
+
export type SetOnSave = (onSave?: (values: object, redirect: any) => void) => void;
|
|
275
|
+
export type FormFunctions = {
|
|
276
|
+
setOnSave?: SetOnSave;
|
|
277
|
+
};
|
|
278
|
+
export type HintedString<KnownValues extends string> = AnyString | KnownValues;
|
|
279
|
+
export type RecordValues = Record<string, any>;
|
|
280
|
+
export type RecordPath<TRecordValues extends RecordValues> = FieldPath<TRecordValues>;
|
|
281
|
+
export type ExtractRecordPaths<T extends RecordValues> = [
|
|
282
|
+
T
|
|
283
|
+
] extends [never] ? string : RecordPath<T>;
|
|
284
|
+
export type AnyString = string & {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A version of lodash/debounce that always returns a promise but wait for the debounced function to return to resolve it.
|
|
3
|
+
* @param func The function to debounce
|
|
4
|
+
* @param wait The debounce delay
|
|
5
|
+
* @returns A debounced function that returns a promise
|
|
6
|
+
*/
|
|
7
|
+
export declare function asyncDebounce<FunctionType extends (...args: any[]) => Promise<any>>(func: FunctionType, wait?: number): (...args: Parameters<FunctionType>) => ReturnType<FunctionType>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import debounce from 'lodash/debounce.js';
|
|
2
|
+
/**
|
|
3
|
+
* A version of lodash/debounce that always returns a promise but wait for the debounced function to return to resolve it.
|
|
4
|
+
* @param func The function to debounce
|
|
5
|
+
* @param wait The debounce delay
|
|
6
|
+
* @returns A debounced function that returns a promise
|
|
7
|
+
*/
|
|
8
|
+
export function asyncDebounce(func, wait) {
|
|
9
|
+
const resolveSet = new Set();
|
|
10
|
+
const rejectSet = new Set();
|
|
11
|
+
const debounced = debounce((args) => {
|
|
12
|
+
func(...args)
|
|
13
|
+
.then((...res) => {
|
|
14
|
+
resolveSet.forEach(resolve => resolve(...res));
|
|
15
|
+
})
|
|
16
|
+
.catch((...res) => {
|
|
17
|
+
rejectSet.forEach(reject => reject(...res));
|
|
18
|
+
})
|
|
19
|
+
.finally(() => {
|
|
20
|
+
resolveSet.clear();
|
|
21
|
+
rejectSet.clear();
|
|
22
|
+
});
|
|
23
|
+
}, wait);
|
|
24
|
+
return (...args) => new Promise((resolve, reject) => {
|
|
25
|
+
resolveSet.add(resolve);
|
|
26
|
+
rejectSet.add(reject);
|
|
27
|
+
debounced(args);
|
|
28
|
+
});
|
|
29
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Escape special characters in path so that react-router Route does not do any special treatment
|
|
3
|
+
*
|
|
4
|
+
* @see https://github.com/ReactTraining/react-router/blob/v3/docs/guides/RouteMatching.md#path-syntax
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
*
|
|
8
|
+
* escapePath('/foo(bar)') => 'foo\(bar\)'
|
|
9
|
+
*/
|
|
10
|
+
declare const _default: (url: any) => any;
|
|
11
|
+
export default _default;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Escape special characters in path so that react-router Route does not do any special treatment
|
|
3
|
+
*
|
|
4
|
+
* @see https://github.com/ReactTraining/react-router/blob/v3/docs/guides/RouteMatching.md#path-syntax
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
*
|
|
8
|
+
* escapePath('/foo(bar)') => 'foo\(bar\)'
|
|
9
|
+
*/
|
|
10
|
+
export default url => url.replace(/(\(|\))/g, '\\$1');
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { memo } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* A version of React.memo that preserves the original component type allowing it to accept generics.
|
|
4
|
+
* See {@link https://stackoverflow.com/a/70890101}
|
|
5
|
+
*/
|
|
6
|
+
export const genericMemo = (component) => {
|
|
7
|
+
const result = memo(component);
|
|
8
|
+
// We have to set the displayName on both the field implementation and the memoized version.
|
|
9
|
+
// On the implementation so that the memoized version can pick them up and users may reference the defaultProps in their components.
|
|
10
|
+
// On the memoized version so that components that inspect their children props may read them.
|
|
11
|
+
// @ts-ignore
|
|
12
|
+
result.displayName = component.displayName?.replace('Impl', '');
|
|
13
|
+
return result;
|
|
14
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
interface Args {
|
|
2
|
+
label?: string;
|
|
3
|
+
defaultLabel?: string;
|
|
4
|
+
resource?: string;
|
|
5
|
+
resourceFromContext?: string;
|
|
6
|
+
source?: string;
|
|
7
|
+
}
|
|
8
|
+
type TranslationArguments = [string, any?];
|
|
9
|
+
/**
|
|
10
|
+
* Returns an array of arguments to use with the translate function for the label of a field.
|
|
11
|
+
* The label will be computed from the resource and source props.
|
|
12
|
+
*
|
|
13
|
+
* Usage:
|
|
14
|
+
* <span>
|
|
15
|
+
* {translate(...getFieldLabelTranslationArgs({ label, resource, source }))}
|
|
16
|
+
* </span>
|
|
17
|
+
*
|
|
18
|
+
* @see useTranslateLabel for a ready-to-use hook
|
|
19
|
+
*/
|
|
20
|
+
export declare const getFieldLabelTranslationArgs: (options?: Args) => TranslationArguments;
|
|
21
|
+
export default getFieldLabelTranslationArgs;
|
|
22
|
+
export declare const getResourceFieldLabelKey: (resource: string, source: string) => string;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { transform } from 'inflection';
|
|
2
|
+
/**
|
|
3
|
+
* Returns an array of arguments to use with the translate function for the label of a field.
|
|
4
|
+
* The label will be computed from the resource and source props.
|
|
5
|
+
*
|
|
6
|
+
* Usage:
|
|
7
|
+
* <span>
|
|
8
|
+
* {translate(...getFieldLabelTranslationArgs({ label, resource, source }))}
|
|
9
|
+
* </span>
|
|
10
|
+
*
|
|
11
|
+
* @see useTranslateLabel for a ready-to-use hook
|
|
12
|
+
*/
|
|
13
|
+
export const getFieldLabelTranslationArgs = (options) => {
|
|
14
|
+
if (!options)
|
|
15
|
+
return [''];
|
|
16
|
+
const { label, defaultLabel, resource, resourceFromContext, source } = options;
|
|
17
|
+
if (typeof label !== 'undefined')
|
|
18
|
+
return [label, { _: label }];
|
|
19
|
+
if (typeof source === 'undefined')
|
|
20
|
+
return [''];
|
|
21
|
+
const { sourceWithoutDigits, sourceSuffix } = getSourceParts(source);
|
|
22
|
+
const defaultLabelTranslation = transform(sourceSuffix.replace(/\./g, ' '), ['underscore', 'humanize']);
|
|
23
|
+
if (resource) {
|
|
24
|
+
return [
|
|
25
|
+
getResourceFieldLabelKey(resource, sourceWithoutDigits),
|
|
26
|
+
{ _: defaultLabelTranslation },
|
|
27
|
+
];
|
|
28
|
+
}
|
|
29
|
+
if (defaultLabel) {
|
|
30
|
+
return [defaultLabel, { _: defaultLabelTranslation }];
|
|
31
|
+
}
|
|
32
|
+
return [
|
|
33
|
+
getResourceFieldLabelKey(resourceFromContext || 'undefined', sourceWithoutDigits),
|
|
34
|
+
{ _: defaultLabelTranslation },
|
|
35
|
+
];
|
|
36
|
+
};
|
|
37
|
+
export default getFieldLabelTranslationArgs;
|
|
38
|
+
export const getResourceFieldLabelKey = (resource, source) => `resources.${resource}.fields.${source}`;
|
|
39
|
+
/**
|
|
40
|
+
* Uses the source string to guess a translation message and a default label.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* getSourceParts('pictures') // { sourceWithoutDigits: 'pictures', sourceSuffix: 'pictures' }
|
|
44
|
+
* getSourceParts('pictures.url') // { sourceWithoutDigits: 'pictures.url', sourceSuffix: 'pictures.url' }
|
|
45
|
+
* getSourceParts('pictures.0.url') // { sourceWithoutDigits: 'pictures.url', sourceSuffix: 'url' }
|
|
46
|
+
* getSourceParts('pictures.12.urls.5.protocol') // { sourceWithoutDigits: 'pictures.urls.protocol', sourceSuffix: 'protocol' }
|
|
47
|
+
*/
|
|
48
|
+
const getSourceParts = (source) => {
|
|
49
|
+
// remove digits, e.g. 'book.authors.2.categories.3.identifier.name' => 'book.authors.categories.identifier.name'
|
|
50
|
+
const sourceWithoutDigits = source.replace(/\.\d+\./g, '.');
|
|
51
|
+
// get final part, e.g. 'book.authors.2.categories.3.identifier.name' => 'identifier.name'
|
|
52
|
+
// we're not using a regexp here to avoid code scanning alert "Polynomial regular expression used on uncontrolled data"
|
|
53
|
+
const parts = source.split('.');
|
|
54
|
+
let lastPartWithDigits;
|
|
55
|
+
parts.forEach((part, index) => {
|
|
56
|
+
if (onlyDigits(part)) {
|
|
57
|
+
lastPartWithDigits = index;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
const sourceSuffix = lastPartWithDigits != null
|
|
61
|
+
? parts.slice(lastPartWithDigits + 1).join('.')
|
|
62
|
+
: source;
|
|
63
|
+
return { sourceWithoutDigits, sourceSuffix };
|
|
64
|
+
};
|
|
65
|
+
// 48 and 57 are the char codes for "0" and "9", respectively
|
|
66
|
+
const onlyDigits = s => {
|
|
67
|
+
for (let i = s.length - 1; i >= 0; i--) {
|
|
68
|
+
const d = s.charCodeAt(i);
|
|
69
|
+
if (d < 48 || d > 57)
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
return true;
|
|
73
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getMutationMode: (mutationMode: any, undoable: any) => any;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated use `useState` instead, since React no longer
|
|
3
|
+
* issues warnings when calling setState on unmounted components.
|
|
4
|
+
*/
|
|
5
|
+
export declare function useSafeSetState<T>(initialState?: T | (() => T)): [T | undefined, React.Dispatch<React.SetStateAction<T>>];
|
|
6
|
+
export declare function usePrevious<T>(value: T): T;
|
|
7
|
+
export declare function useDeepCompareEffect(callback: any, inputs: any): void;
|
|
8
|
+
/**
|
|
9
|
+
* A hook that returns true once a delay has expired.
|
|
10
|
+
* @param ms The delay in milliseconds
|
|
11
|
+
* @param key A key that can be used to reset the timer
|
|
12
|
+
* @returns true if the delay has expired, false otherwise
|
|
13
|
+
*/
|
|
14
|
+
export declare function useTimeout(ms?: number, key?: string): boolean;
|
|
15
|
+
export declare function useIsMounted(): import("react").RefObject<boolean>;
|