@firecms/core 3.0.0-canary.98 → 3.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/app/Drawer.d.ts +0 -1
- package/dist/app/Scaffold.d.ts +4 -0
- package/dist/components/ArrayContainer.d.ts +31 -12
- package/dist/components/{DeleteConfirmationDialog.d.ts → ConfirmationDialog.d.ts} +1 -1
- package/dist/components/EntityCollectionTable/EntityCollectionRowActions.d.ts +3 -1
- package/dist/components/EntityCollectionTable/EntityCollectionTable.d.ts +2 -2
- package/dist/components/EntityCollectionTable/EntityCollectionTableProps.d.ts +17 -3
- package/dist/components/EntityCollectionTable/fields/TableReferenceField.d.ts +1 -1
- package/dist/components/EntityCollectionTable/index.d.ts +1 -1
- package/dist/components/EntityCollectionTable/internal/popup_field/PopupFormField.d.ts +6 -3
- package/dist/components/EntityCollectionView/EntityCollectionView.d.ts +8 -0
- package/dist/components/EntityCollectionView/utils.d.ts +3 -0
- package/dist/components/EntityJsonPreview.d.ts +3 -0
- package/dist/components/EntityPreview.d.ts +8 -6
- package/dist/components/HomePage/DefaultHomePage.d.ts +2 -15
- package/dist/components/HomePage/HomePageDnD.d.ts +76 -0
- package/dist/components/HomePage/NavigationCard.d.ts +3 -1
- package/dist/components/HomePage/NavigationCardBinding.d.ts +3 -2
- package/dist/components/HomePage/NavigationGroup.d.ts +8 -1
- package/dist/components/HomePage/RenameGroupDialog.d.ts +9 -0
- package/dist/components/PropertyConfigBadge.d.ts +2 -1
- package/dist/components/PropertyIdCopyTooltip.d.ts +8 -0
- package/dist/components/SelectableTable/SelectableTable.d.ts +13 -3
- package/dist/components/SelectableTable/filters/ReferenceFilterField.d.ts +1 -1
- package/dist/components/UnsavedChangesDialog.d.ts +8 -0
- package/dist/components/VirtualTable/VirtualTableProps.d.ts +11 -2
- package/dist/components/common/default_entity_actions.d.ts +0 -2
- package/dist/components/common/index.d.ts +1 -1
- package/dist/components/common/useColumnsIds.d.ts +1 -0
- package/dist/components/common/{useDataSourceEntityCollectionTableController.d.ts → useDataSourceTableController.d.ts} +10 -2
- package/dist/components/common/useDebouncedCallback.d.ts +1 -0
- package/dist/components/common/useScrollRestoration.d.ts +14 -0
- package/dist/components/index.d.ts +3 -1
- package/dist/contexts/BreacrumbsContext.d.ts +8 -0
- package/dist/core/DefaultAppBar.d.ts +8 -2
- package/dist/core/DrawerNavigationItem.d.ts +2 -1
- package/dist/core/EntityEditView.d.ts +40 -22
- package/dist/core/EntityEditViewFormActions.d.ts +2 -0
- package/dist/core/FireCMS.d.ts +2 -2
- package/dist/core/FireCMSRouter.d.ts +4 -0
- package/dist/core/NavigationRoutes.d.ts +0 -1
- package/dist/core/SideDialogs.d.ts +4 -2
- package/dist/core/field_configs.d.ts +1 -1
- package/dist/core/index.d.ts +2 -1
- package/dist/form/EntityForm.d.ts +50 -0
- package/dist/form/EntityFormActions.d.ts +21 -0
- package/dist/form/PropertyFieldBinding.d.ts +1 -1
- package/dist/form/components/FormEntry.d.ts +6 -0
- package/dist/form/components/FormLayout.d.ts +5 -0
- package/dist/form/components/LabelWithIcon.d.ts +1 -1
- package/dist/form/components/LabelWithIconAndTooltip.d.ts +15 -0
- package/dist/form/components/index.d.ts +3 -1
- package/dist/form/field_bindings/ArrayCustomShapedFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/ArrayOfReferencesFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/BlockFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/KeyValueFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/MapFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/MarkdownEditorFieldBinding.d.ts +11 -0
- package/dist/form/field_bindings/{MultiSelectBinding.d.ts → MultiSelectFieldBinding.d.ts} +1 -1
- package/dist/form/field_bindings/ReadOnlyFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/ReferenceAsStringFieldBinding.d.ts +9 -0
- package/dist/form/field_bindings/ReferenceFieldBinding.d.ts +2 -2
- package/dist/form/field_bindings/RepeatFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/SelectFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/StorageUploadFieldBinding.d.ts +4 -10
- package/dist/form/field_bindings/SwitchFieldBinding.d.ts +1 -2
- package/dist/form/field_bindings/TextFieldBinding.d.ts +1 -1
- package/dist/form/index.d.ts +17 -16
- package/dist/form/useClearRestoreValue.d.ts +2 -2
- package/dist/hooks/data/delete.d.ts +4 -4
- package/dist/hooks/data/save.d.ts +3 -3
- package/dist/hooks/data/useCollectionFetch.d.ts +1 -1
- package/dist/hooks/data/useEntityFetch.d.ts +4 -3
- package/dist/hooks/useAuthController.d.ts +1 -1
- package/dist/hooks/useBreadcrumbsController.d.ts +26 -0
- package/dist/hooks/useBuildNavigationController.d.ts +57 -12
- package/dist/hooks/useFireCMSContext.d.ts +1 -1
- package/dist/hooks/useModeController.d.ts +1 -2
- package/dist/hooks/useProjectLog.d.ts +7 -1
- package/dist/hooks/useResolvedNavigationFrom.d.ts +3 -3
- package/dist/hooks/useValidateAuthenticator.d.ts +3 -3
- package/dist/index.es.js +20108 -14471
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +20039 -14407
- package/dist/index.umd.js.map +1 -1
- package/dist/internal/useBuildDataSource.d.ts +3 -2
- package/dist/internal/useBuildSideEntityController.d.ts +3 -3
- package/dist/internal/useUnsavedChangesDialog.d.ts +7 -9
- package/dist/preview/PropertyPreviewProps.d.ts +1 -1
- package/dist/preview/components/EnumValuesChip.d.ts +1 -1
- package/dist/preview/components/ReferencePreview.d.ts +2 -2
- package/dist/preview/util.d.ts +3 -3
- package/dist/routes/CustomCMSRoute.d.ts +4 -0
- package/dist/routes/FireCMSRoute.d.ts +1 -0
- package/dist/routes/HomePageRoute.d.ts +3 -0
- package/dist/types/analytics.d.ts +1 -1
- package/dist/types/auth.d.ts +7 -9
- package/dist/types/collections.d.ts +86 -25
- package/dist/types/customization_controller.d.ts +8 -0
- package/dist/types/datasource.d.ts +19 -17
- package/dist/types/dialogs_controller.d.ts +7 -3
- package/dist/types/entities.d.ts +2 -1
- package/dist/types/entity_actions.d.ts +58 -8
- package/dist/types/entity_callbacks.d.ts +16 -16
- package/dist/types/entity_overrides.d.ts +2 -2
- package/dist/types/export_import.d.ts +4 -4
- package/dist/types/fields.d.ts +43 -17
- package/dist/types/firecms.d.ts +16 -3
- package/dist/types/firecms_context.d.ts +1 -1
- package/dist/types/navigation.d.ts +60 -17
- package/dist/types/permissions.d.ts +4 -4
- package/dist/types/plugins.d.ts +42 -9
- package/dist/types/properties.d.ts +65 -22
- package/dist/types/property_config.d.ts +1 -3
- package/dist/types/roles.d.ts +3 -0
- package/dist/types/side_dialogs_controller.d.ts +10 -0
- package/dist/types/side_entity_controller.d.ts +14 -1
- package/dist/types/storage.d.ts +75 -0
- package/dist/types/user.d.ts +1 -0
- package/dist/util/builders.d.ts +3 -3
- package/dist/util/callbacks.d.ts +2 -0
- package/dist/util/createFormexStub.d.ts +2 -0
- package/dist/util/entities.d.ts +2 -2
- package/dist/util/entity_actions.d.ts +2 -0
- package/dist/util/entity_cache.d.ts +23 -0
- package/dist/util/icon_synonyms.d.ts +0 -1
- package/dist/util/icons.d.ts +5 -2
- package/dist/util/index.d.ts +3 -0
- package/dist/util/navigation_from_path.d.ts +10 -1
- package/dist/util/navigation_utils.d.ts +13 -1
- package/dist/util/objects.d.ts +2 -1
- package/dist/util/permissions.d.ts +4 -4
- package/dist/util/property_utils.d.ts +4 -4
- package/dist/util/references.d.ts +2 -2
- package/dist/util/resolutions.d.ts +30 -6
- package/dist/util/storage.d.ts +1 -1
- package/dist/util/useStorageUploadController.d.ts +2 -2
- package/package.json +133 -125
- package/src/app/Drawer.tsx +0 -1
- package/src/app/Scaffold.tsx +33 -29
- package/src/components/ArrayContainer.tsx +447 -229
- package/src/components/CircularProgressCenter.tsx +1 -1
- package/src/components/ClearFilterSortButton.tsx +1 -1
- package/src/components/{DeleteConfirmationDialog.tsx → ConfirmationDialog.tsx} +12 -11
- package/src/components/DeleteEntityDialog.tsx +13 -20
- package/src/components/EntityCollectionTable/EntityCollectionRowActions.tsx +59 -25
- package/src/components/EntityCollectionTable/EntityCollectionTable.tsx +23 -17
- package/src/components/EntityCollectionTable/EntityCollectionTableProps.tsx +20 -3
- package/src/components/EntityCollectionTable/PropertyTableCell.tsx +35 -9
- package/src/components/EntityCollectionTable/fields/TableReferenceField.tsx +21 -16
- package/src/components/EntityCollectionTable/fields/TableStorageUpload.tsx +6 -12
- package/src/components/EntityCollectionTable/index.tsx +1 -1
- package/src/components/EntityCollectionTable/internal/CollectionTableToolbar.tsx +6 -6
- package/src/components/EntityCollectionTable/internal/EntityTableCell.tsx +35 -26
- package/src/components/EntityCollectionTable/internal/EntityTableCellActions.tsx +20 -8
- package/src/components/EntityCollectionTable/internal/popup_field/PopupFormField.tsx +132 -101
- package/src/components/EntityCollectionTable/internal/popup_field/useDraggable.tsx +9 -9
- package/src/components/EntityCollectionView/EntityCollectionView.tsx +178 -85
- package/src/components/EntityCollectionView/EntityCollectionViewActions.tsx +7 -4
- package/src/components/EntityCollectionView/useSelectionController.tsx +5 -4
- package/src/components/EntityCollectionView/utils.ts +19 -0
- package/src/components/EntityJsonPreview.tsx +66 -0
- package/src/components/EntityPreview.tsx +75 -57
- package/src/components/EntityView.tsx +8 -5
- package/src/components/ErrorView.tsx +3 -3
- package/src/components/FireCMSLogo.tsx +7 -51
- package/src/components/HomePage/DefaultHomePage.tsx +522 -160
- package/src/components/HomePage/FavouritesView.tsx +9 -14
- package/src/components/HomePage/HomePageDnD.tsx +642 -0
- package/src/components/HomePage/NavigationCard.tsx +47 -38
- package/src/components/HomePage/NavigationCardBinding.tsx +16 -15
- package/src/components/HomePage/NavigationGroup.tsx +144 -30
- package/src/components/HomePage/RenameGroupDialog.tsx +117 -0
- package/src/components/HomePage/SmallNavigationCard.tsx +1 -2
- package/src/components/NotFoundPage.tsx +2 -2
- package/src/components/PropertyConfigBadge.tsx +9 -3
- package/src/components/PropertyIdCopyTooltip.tsx +47 -0
- package/src/components/ReferenceTable/ReferenceSelectionTable.tsx +22 -13
- package/src/components/SearchIconsView.tsx +2 -2
- package/src/components/SelectableTable/SelectableTable.tsx +154 -142
- package/src/components/SelectableTable/filters/DateTimeFilterField.tsx +4 -2
- package/src/components/SelectableTable/filters/ReferenceFilterField.tsx +10 -8
- package/src/components/SelectableTable/filters/StringNumberFilterField.tsx +59 -10
- package/src/components/UnsavedChangesDialog.tsx +46 -0
- package/src/components/VirtualTable/VirtualTable.tsx +65 -44
- package/src/components/VirtualTable/VirtualTableCell.tsx +0 -8
- package/src/components/VirtualTable/VirtualTableHeader.tsx +8 -8
- package/src/components/VirtualTable/VirtualTableHeaderRow.tsx +1 -1
- package/src/components/VirtualTable/VirtualTableProps.tsx +12 -2
- package/src/components/VirtualTable/VirtualTableRow.tsx +1 -1
- package/src/components/VirtualTable/fields/VirtualTableDateField.tsx +4 -4
- package/src/components/VirtualTable/fields/VirtualTableInput.tsx +2 -2
- package/src/components/VirtualTable/fields/VirtualTableNumberInput.tsx +2 -1
- package/src/components/VirtualTable/fields/VirtualTableSelect.tsx +16 -28
- package/src/components/common/default_entity_actions.tsx +62 -42
- package/src/components/common/index.ts +1 -1
- package/src/components/common/useColumnsIds.tsx +1 -1
- package/src/components/common/useDataSourceTableController.tsx +420 -0
- package/src/components/common/useDebouncedCallback.tsx +20 -0
- package/src/components/common/useScrollRestoration.tsx +68 -0
- package/src/components/common/useTableSearchHelper.ts +1 -0
- package/src/components/index.tsx +4 -1
- package/src/contexts/BreacrumbsContext.tsx +38 -0
- package/src/contexts/DialogsProvider.tsx +3 -2
- package/src/contexts/ModeController.tsx +1 -3
- package/src/contexts/SnackbarProvider.tsx +2 -0
- package/src/core/DefaultAppBar.tsx +124 -85
- package/src/core/DefaultDrawer.tsx +30 -22
- package/src/core/DrawerNavigationItem.tsx +32 -28
- package/src/core/EntityEditView.tsx +388 -995
- package/src/core/EntityEditViewFormActions.tsx +329 -0
- package/src/core/EntitySidePanel.tsx +88 -20
- package/src/core/FireCMS.tsx +46 -25
- package/src/core/FireCMSRouter.tsx +17 -0
- package/src/core/NavigationRoutes.tsx +23 -32
- package/src/core/SideDialogs.tsx +22 -12
- package/src/core/field_configs.tsx +24 -10
- package/src/core/index.tsx +4 -2
- package/src/form/EntityForm.tsx +814 -0
- package/src/form/EntityFormActions.tsx +211 -0
- package/src/form/PropertyFieldBinding.tsx +55 -41
- package/src/form/components/CustomIdField.tsx +9 -3
- package/src/form/components/FieldHelperText.tsx +1 -1
- package/src/form/components/FormEntry.tsx +22 -0
- package/src/form/components/FormLayout.tsx +16 -0
- package/src/form/components/LabelWithIcon.tsx +30 -19
- package/src/form/components/LabelWithIconAndTooltip.tsx +28 -0
- package/src/form/components/StorageItemPreview.tsx +5 -4
- package/src/form/components/StorageUploadProgress.tsx +2 -3
- package/src/form/components/index.tsx +3 -1
- package/src/form/field_bindings/ArrayCustomShapedFieldBinding.tsx +30 -18
- package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +47 -36
- package/src/form/field_bindings/BlockFieldBinding.tsx +55 -33
- package/src/form/field_bindings/DateTimeFieldBinding.tsx +18 -14
- package/src/form/field_bindings/KeyValueFieldBinding.tsx +19 -15
- package/src/form/field_bindings/MapFieldBinding.tsx +72 -62
- package/src/form/field_bindings/MarkdownEditorFieldBinding.tsx +159 -0
- package/src/form/field_bindings/{MultiSelectBinding.tsx → MultiSelectFieldBinding.tsx} +26 -21
- package/src/form/field_bindings/ReadOnlyFieldBinding.tsx +10 -8
- package/src/form/field_bindings/ReferenceAsStringFieldBinding.tsx +135 -0
- package/src/form/field_bindings/ReferenceFieldBinding.tsx +28 -19
- package/src/form/field_bindings/RepeatFieldBinding.tsx +56 -32
- package/src/form/field_bindings/SelectFieldBinding.tsx +22 -13
- package/src/form/field_bindings/StorageUploadFieldBinding.tsx +247 -168
- package/src/form/field_bindings/SwitchFieldBinding.tsx +29 -24
- package/src/form/field_bindings/TextFieldBinding.tsx +28 -24
- package/src/form/index.tsx +17 -37
- package/src/form/useClearRestoreValue.tsx +2 -2
- package/src/form/validation.ts +12 -6
- package/src/hooks/data/delete.ts +6 -5
- package/src/hooks/data/save.ts +26 -35
- package/src/hooks/data/useCollectionFetch.tsx +3 -3
- package/src/hooks/data/useDataSource.tsx +10 -2
- package/src/hooks/data/useEntityFetch.tsx +10 -6
- package/src/hooks/useAuthController.tsx +1 -1
- package/src/hooks/useBreadcrumbsController.tsx +31 -0
- package/src/hooks/useBrowserTitleAndIcon.tsx +1 -1
- package/src/hooks/useBuildModeController.tsx +15 -28
- package/src/hooks/useBuildNavigationController.tsx +386 -124
- package/src/hooks/useFireCMSContext.tsx +3 -33
- package/src/hooks/useLargeLayout.tsx +0 -35
- package/src/hooks/useModeController.tsx +1 -2
- package/src/hooks/useProjectLog.tsx +16 -5
- package/src/hooks/useResolvedNavigationFrom.tsx +9 -11
- package/src/hooks/useValidateAuthenticator.tsx +3 -3
- package/src/internal/useBuildDataSource.ts +67 -80
- package/src/internal/useBuildSideDialogsController.tsx +4 -2
- package/src/internal/useBuildSideEntityController.tsx +149 -86
- package/src/internal/useUnsavedChangesDialog.tsx +127 -91
- package/src/preview/PropertyPreview.tsx +28 -12
- package/src/preview/PropertyPreviewProps.tsx +1 -1
- package/src/preview/components/BooleanPreview.tsx +1 -1
- package/src/preview/components/EmptyValue.tsx +1 -1
- package/src/preview/components/EnumValuesChip.tsx +1 -1
- package/src/preview/components/ImagePreview.tsx +10 -9
- package/src/preview/components/ReferencePreview.tsx +6 -16
- package/src/preview/components/UrlComponentPreview.tsx +20 -21
- package/src/preview/property_previews/ArrayOfMapsPreview.tsx +6 -5
- package/src/preview/property_previews/ArrayOfReferencesPreview.tsx +5 -4
- package/src/preview/property_previews/ArrayOfStorageComponentsPreview.tsx +5 -3
- package/src/preview/property_previews/ArrayOfStringsPreview.tsx +4 -3
- package/src/preview/property_previews/ArrayOneOfPreview.tsx +6 -4
- package/src/preview/property_previews/ArrayPropertyPreview.tsx +5 -3
- package/src/preview/property_previews/MapPropertyPreview.tsx +7 -6
- package/src/preview/property_previews/SkeletonPropertyComponent.tsx +13 -13
- package/src/preview/property_previews/StringPropertyPreview.tsx +2 -2
- package/src/preview/util.ts +10 -10
- package/src/routes/CustomCMSRoute.tsx +21 -0
- package/src/routes/FireCMSRoute.tsx +246 -0
- package/src/routes/HomePageRoute.tsx +17 -0
- package/src/types/analytics.ts +3 -0
- package/src/types/auth.tsx +8 -12
- package/src/types/collections.ts +101 -28
- package/src/types/customization_controller.tsx +9 -0
- package/src/types/datasource.ts +21 -20
- package/src/types/dialogs_controller.tsx +7 -3
- package/src/types/entities.ts +3 -1
- package/src/types/entity_actions.tsx +71 -8
- package/src/types/entity_callbacks.ts +18 -18
- package/src/types/entity_overrides.tsx +2 -2
- package/src/types/export_import.ts +4 -4
- package/src/types/fields.tsx +52 -19
- package/src/types/firecms.tsx +18 -4
- package/src/types/firecms_context.tsx +1 -1
- package/src/types/navigation.ts +76 -22
- package/src/types/permissions.ts +5 -5
- package/src/types/plugins.tsx +50 -9
- package/src/types/properties.ts +74 -22
- package/src/types/property_config.tsx +1 -2
- package/src/types/roles.ts +3 -0
- package/src/types/side_dialogs_controller.tsx +15 -0
- package/src/types/side_entity_controller.tsx +16 -1
- package/src/types/storage.ts +82 -0
- package/src/types/user.ts +2 -0
- package/src/util/builders.ts +10 -8
- package/src/util/callbacks.ts +119 -0
- package/src/util/createFormexStub.tsx +62 -0
- package/src/util/entities.ts +5 -3
- package/src/util/entity_actions.ts +28 -0
- package/src/util/entity_cache.ts +204 -0
- package/src/util/icon_list.ts +1 -1
- package/src/util/icon_synonyms.ts +0 -1
- package/src/util/icons.tsx +36 -11
- package/src/util/index.ts +3 -0
- package/src/util/join_collections.ts +9 -2
- package/src/util/make_properties_editable.ts +13 -5
- package/src/util/navigation_from_path.ts +33 -12
- package/src/util/navigation_utils.ts +135 -19
- package/src/util/objects.ts +74 -14
- package/src/util/parent_references_from_path.ts +3 -3
- package/src/util/permissions.ts +8 -8
- package/src/util/property_utils.tsx +17 -6
- package/src/util/references.ts +19 -8
- package/src/util/resolutions.ts +93 -24
- package/src/util/storage.ts +6 -2
- package/src/util/useStorageUploadController.tsx +74 -29
- package/dist/components/EntityCollectionTable/internal/popup_field/ElementResizeListener.d.ts +0 -5
- package/dist/components/PropertyIdCopyTooltipContent.d.ts +0 -3
- package/dist/form/PropertiesForm.d.ts +0 -8
- package/dist/form/components/FormikArrayContainer.d.ts +0 -18
- package/dist/form/field_bindings/MarkdownFieldBinding.d.ts +0 -9
- package/src/components/EntityCollectionTable/internal/popup_field/ElementResizeListener.tsx +0 -59
- package/src/components/PropertyIdCopyTooltipContent.tsx +0 -27
- package/src/components/common/useDataSourceEntityCollectionTableController.tsx +0 -236
- package/src/form/PropertiesForm.tsx +0 -81
- package/src/form/components/FormikArrayContainer.tsx +0 -44
- package/src/form/field_bindings/MarkdownFieldBinding.tsx +0 -695
- /package/src/util/{common.tsx → common.ts} +0 -0
|
@@ -21,9 +21,9 @@ import React, { useEffect } from "react";
|
|
|
21
21
|
* @see FireCMSContext
|
|
22
22
|
* @group Hooks and utilities
|
|
23
23
|
*/
|
|
24
|
-
export const useFireCMSContext = <
|
|
24
|
+
export const useFireCMSContext = <USER extends User = User, AuthControllerType extends AuthController<USER> = AuthController<USER>>(): FireCMSContext<USER, AuthControllerType> => {
|
|
25
25
|
|
|
26
|
-
const authController = useAuthController<
|
|
26
|
+
const authController = useAuthController<USER, AuthControllerType>();
|
|
27
27
|
const sideDialogsController = useSideDialogsController();
|
|
28
28
|
const sideEntityController = useSideEntityController();
|
|
29
29
|
const navigation = useNavigationController();
|
|
@@ -35,7 +35,7 @@ export const useFireCMSContext = <UserType extends User = User, AuthControllerTy
|
|
|
35
35
|
const customizationController = useCustomizationController();
|
|
36
36
|
const analyticsController = useAnalyticsController();
|
|
37
37
|
|
|
38
|
-
const fireCMSContextRef = React.useRef<FireCMSContext<
|
|
38
|
+
const fireCMSContextRef = React.useRef<FireCMSContext<USER, AuthControllerType>>({
|
|
39
39
|
authController,
|
|
40
40
|
sideDialogsController,
|
|
41
41
|
sideEntityController,
|
|
@@ -67,33 +67,3 @@ export const useFireCMSContext = <UserType extends User = User, AuthControllerTy
|
|
|
67
67
|
|
|
68
68
|
return fireCMSContextRef.current;
|
|
69
69
|
}
|
|
70
|
-
|
|
71
|
-
// export const useFireCMSContext = <UserType extends User = User, AuthControllerType extends AuthController<UserType> = AuthController<UserType>>(): FireCMSContext<UserType, AuthControllerType> => {
|
|
72
|
-
//
|
|
73
|
-
// const authController = useAuthController<UserType, AuthControllerType>();
|
|
74
|
-
// const sideDialogsController = useSideDialogsController();
|
|
75
|
-
// const sideEntityController = useSideEntityController();
|
|
76
|
-
// const navigation = useNavigationController();
|
|
77
|
-
// const dataSource = useDataSource();
|
|
78
|
-
// const storageSource = useStorageSource();
|
|
79
|
-
// const snackbarController = useSnackbarController();
|
|
80
|
-
// const userConfigPersistence = useUserConfigurationPersistence();
|
|
81
|
-
// const dialogsController = useDialogsController();
|
|
82
|
-
// const customizationController = useCustomizationController();
|
|
83
|
-
// const analyticsController = useAnalyticsController();
|
|
84
|
-
//
|
|
85
|
-
// return {
|
|
86
|
-
// authController,
|
|
87
|
-
// sideDialogsController,
|
|
88
|
-
// sideEntityController,
|
|
89
|
-
// navigation,
|
|
90
|
-
// dataSource,
|
|
91
|
-
// storageSource,
|
|
92
|
-
// snackbarController,
|
|
93
|
-
// userConfigPersistence,
|
|
94
|
-
// dialogsController,
|
|
95
|
-
// customizationController,
|
|
96
|
-
// analyticsController
|
|
97
|
-
// };
|
|
98
|
-
//
|
|
99
|
-
// };
|
|
@@ -63,38 +63,3 @@ function checkLargeLayout(breakpoint: "xs" | "sm" | "md" | "lg" | "xl" | "2xl" |
|
|
|
63
63
|
return false;
|
|
64
64
|
return window.matchMedia(`(min-width: ${breakpoints[breakpoint] + 1}px)`).matches;
|
|
65
65
|
}
|
|
66
|
-
|
|
67
|
-
// import { useEffect, useState } from "react";
|
|
68
|
-
//
|
|
69
|
-
// const breakpoints = {
|
|
70
|
-
// xs: 0,
|
|
71
|
-
// sm: 640,
|
|
72
|
-
// md: 768,
|
|
73
|
-
// lg: 1024,
|
|
74
|
-
// xl: 1280,
|
|
75
|
-
// "2xl": 1536,
|
|
76
|
-
// "3xl": 1920
|
|
77
|
-
// }
|
|
78
|
-
// export const useLargeLayout = (breakpoint: "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" = "lg"): boolean => {
|
|
79
|
-
// const [isLargeLayout, setIsLargeLayout] = useState<boolean>(false);
|
|
80
|
-
//
|
|
81
|
-
// useEffect(() => {
|
|
82
|
-
// const handleResize = () => {
|
|
83
|
-
// const matched = window.matchMedia(`(min-width: ${breakpoints[breakpoint] + 1}px)`).matches;
|
|
84
|
-
// setIsLargeLayout(matched);
|
|
85
|
-
// };
|
|
86
|
-
//
|
|
87
|
-
// // Set initial state
|
|
88
|
-
// handleResize();
|
|
89
|
-
//
|
|
90
|
-
// // Set up event listener for resize events
|
|
91
|
-
// window.addEventListener("resize", handleResize);
|
|
92
|
-
//
|
|
93
|
-
// // Clean up event listener when component unmounts
|
|
94
|
-
// return () => {
|
|
95
|
-
// window.removeEventListener("resize", handleResize);
|
|
96
|
-
// };
|
|
97
|
-
// }, []);
|
|
98
|
-
//
|
|
99
|
-
// return isLargeLayout;
|
|
100
|
-
// };
|
|
@@ -9,7 +9,7 @@ export type AccessResponse = {
|
|
|
9
9
|
message?: string;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
async function makeRequest(authController: AuthController, dataSourceKey: string, pluginKeys: string[] | undefined) {
|
|
12
|
+
async function makeRequest(authController: AuthController, dataSourceKey: string, pluginKeys: string[] | undefined, apiKey?: string): Promise<AccessResponse> {
|
|
13
13
|
let idToken: string | null;
|
|
14
14
|
try {
|
|
15
15
|
idToken = await authController.getAuthToken();
|
|
@@ -25,6 +25,7 @@ async function makeRequest(authController: AuthController, dataSourceKey: string
|
|
|
25
25
|
Authorization: `Basic ${idToken}`
|
|
26
26
|
},
|
|
27
27
|
body: JSON.stringify({
|
|
28
|
+
apiKey,
|
|
28
29
|
email: authController.user?.email ?? null,
|
|
29
30
|
datasource: dataSourceKey,
|
|
30
31
|
plugins: pluginKeys
|
|
@@ -35,16 +36,26 @@ async function makeRequest(authController: AuthController, dataSourceKey: string
|
|
|
35
36
|
});
|
|
36
37
|
}
|
|
37
38
|
|
|
38
|
-
export
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
export interface UseProjectLogParams {
|
|
40
|
+
apiKey?: string;
|
|
41
|
+
authController: AuthController;
|
|
42
|
+
dataSourceDelegate: DataSourceDelegate;
|
|
43
|
+
plugins?: FireCMSPlugin<any, any, any>[];
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function useProjectLog({
|
|
47
|
+
authController,
|
|
48
|
+
dataSourceDelegate,
|
|
49
|
+
plugins,
|
|
50
|
+
apiKey
|
|
51
|
+
}: UseProjectLogParams): AccessResponse | null {
|
|
41
52
|
const [accessResponse, setAccessResponse] = useState<AccessResponse | null>(null);
|
|
42
53
|
const accessedUserRef = useRef<string | null>(null);
|
|
43
54
|
const dataSourceKey = dataSourceDelegate.key;
|
|
44
55
|
const pluginKeys = plugins?.map(plugin => plugin.key);
|
|
45
56
|
useEffect(() => {
|
|
46
57
|
if (authController.user && authController.user.uid !== accessedUserRef.current && !authController.initialLoading) {
|
|
47
|
-
makeRequest(authController, dataSourceKey, pluginKeys).then(setAccessResponse);
|
|
58
|
+
makeRequest(authController, dataSourceKey, pluginKeys, apiKey).then(setAccessResponse);
|
|
48
59
|
accessedUserRef.current = authController.user.uid;
|
|
49
60
|
}
|
|
50
61
|
}, [authController, dataSourceKey, pluginKeys]);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Entity, EntityCollection, EntityCustomView, FireCMSContext, User } from "../types";
|
|
2
2
|
import { useEffect, useState } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { getNavigationEntriesFromPath } from "../util/navigation_from_path";
|
|
4
4
|
import { useFireCMSContext } from "./useFireCMSContext";
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -55,22 +55,22 @@ interface ResolvedNavigationEntityCustom<M extends Record<string, any>> {
|
|
|
55
55
|
* @param context
|
|
56
56
|
* @group Hooks and utilities
|
|
57
57
|
*/
|
|
58
|
-
export function resolveNavigationFrom<M extends Record<string, any>,
|
|
58
|
+
export function resolveNavigationFrom<M extends Record<string, any>, USER extends User>({
|
|
59
59
|
path,
|
|
60
60
|
context
|
|
61
61
|
}: {
|
|
62
62
|
path: string,
|
|
63
|
-
context: FireCMSContext<
|
|
63
|
+
context: FireCMSContext<USER>
|
|
64
64
|
}): Promise<ResolvedNavigationEntry<M>[]> {
|
|
65
65
|
|
|
66
66
|
const dataSource = context.dataSource;
|
|
67
67
|
const navigation = context.navigation;
|
|
68
68
|
|
|
69
69
|
if (!navigation) {
|
|
70
|
-
throw Error("Calling
|
|
70
|
+
throw Error("Calling resolveNavigationFrom, but main navigation has not yet been initialised");
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
const navigationEntries =
|
|
73
|
+
const navigationEntries = getNavigationEntriesFromPath({
|
|
74
74
|
path,
|
|
75
75
|
collections: navigation.collections ?? []
|
|
76
76
|
});
|
|
@@ -126,12 +126,12 @@ export interface NavigationFrom<M extends Record<string, any>> {
|
|
|
126
126
|
* in any React component that lives under `FireCMS`
|
|
127
127
|
* @group Hooks and utilities
|
|
128
128
|
*/
|
|
129
|
-
export function useResolvedNavigationFrom<M extends Record<string, any>,
|
|
129
|
+
export function useResolvedNavigationFrom<M extends Record<string, any>, USER extends User>(
|
|
130
130
|
{
|
|
131
131
|
path
|
|
132
132
|
}: NavigationFromProps): NavigationFrom<M> {
|
|
133
133
|
|
|
134
|
-
const context: FireCMSContext<
|
|
134
|
+
const context: FireCMSContext<USER> = useFireCMSContext();
|
|
135
135
|
|
|
136
136
|
const [data, setData] = useState<ResolvedNavigationEntry<M>[] | undefined>();
|
|
137
137
|
const [dataLoading, setDataLoading] = useState<boolean>(false);
|
|
@@ -142,10 +142,8 @@ export function useResolvedNavigationFrom<M extends Record<string, any>, UserTyp
|
|
|
142
142
|
if (navigation) {
|
|
143
143
|
setDataLoading(true);
|
|
144
144
|
setDataLoadingError(undefined);
|
|
145
|
-
resolveNavigationFrom<M,
|
|
146
|
-
.then(
|
|
147
|
-
setData(res);
|
|
148
|
-
})
|
|
145
|
+
resolveNavigationFrom<M, USER>({ path, context })
|
|
146
|
+
.then(setData)
|
|
149
147
|
.catch((e) => setDataLoadingError(e))
|
|
150
148
|
.finally(() => setDataLoading(false));
|
|
151
149
|
}
|
|
@@ -11,7 +11,7 @@ import { AuthController, Authenticator, DataSourceDelegate, StorageSource, User
|
|
|
11
11
|
* @param storageSource
|
|
12
12
|
* @param dataSourceDelegate
|
|
13
13
|
*/
|
|
14
|
-
export function useValidateAuthenticator<
|
|
14
|
+
export function useValidateAuthenticator<USER extends User = any>
|
|
15
15
|
({
|
|
16
16
|
disabled,
|
|
17
17
|
authController,
|
|
@@ -21,8 +21,8 @@ export function useValidateAuthenticator<UserType extends User = User, Controlle
|
|
|
21
21
|
}:
|
|
22
22
|
{
|
|
23
23
|
disabled?: boolean,
|
|
24
|
-
authController:
|
|
25
|
-
authenticator?: boolean | Authenticator<
|
|
24
|
+
authController: AuthController<USER>,
|
|
25
|
+
authenticator?: boolean | Authenticator<USER>,
|
|
26
26
|
dataSourceDelegate: DataSourceDelegate;
|
|
27
27
|
storageSource: StorageSource;
|
|
28
28
|
}): {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useCallback } from "react";
|
|
2
2
|
import {
|
|
3
|
+
AuthController,
|
|
3
4
|
DataSource,
|
|
4
5
|
DataSourceDelegate,
|
|
5
6
|
DeleteEntityProps,
|
|
@@ -27,11 +28,13 @@ import { resolveCollection, updateDateAutoValues } from "../util";
|
|
|
27
28
|
export function useBuildDataSource({
|
|
28
29
|
delegate,
|
|
29
30
|
propertyConfigs,
|
|
30
|
-
navigationController
|
|
31
|
+
navigationController,
|
|
32
|
+
authController
|
|
31
33
|
}: {
|
|
32
34
|
delegate: DataSourceDelegate,
|
|
33
35
|
propertyConfigs?: Record<string, PropertyConfig>;
|
|
34
36
|
navigationController: NavigationController;
|
|
37
|
+
authController: AuthController;
|
|
35
38
|
}): DataSource {
|
|
36
39
|
|
|
37
40
|
return {
|
|
@@ -52,23 +55,25 @@ export function useBuildDataSource({
|
|
|
52
55
|
*/
|
|
53
56
|
fetchCollection: useCallback(<M extends Record<string, any>>({
|
|
54
57
|
path,
|
|
55
|
-
collection
|
|
58
|
+
collection,
|
|
56
59
|
filter,
|
|
57
60
|
limit,
|
|
58
61
|
startAfter,
|
|
59
62
|
searchString,
|
|
60
63
|
orderBy,
|
|
61
|
-
order
|
|
64
|
+
order,
|
|
62
65
|
}: FetchCollectionProps<M>
|
|
63
66
|
): Promise<Entity<M>[]> => {
|
|
64
|
-
|
|
67
|
+
const usedDelegate = collection?.overrides?.dataSourceDelegate ?? delegate;
|
|
68
|
+
return usedDelegate.fetchCollection<M>({
|
|
65
69
|
path,
|
|
66
70
|
filter,
|
|
67
71
|
limit,
|
|
68
72
|
startAfter,
|
|
69
73
|
searchString,
|
|
70
74
|
orderBy,
|
|
71
|
-
order
|
|
75
|
+
order,
|
|
76
|
+
collection
|
|
72
77
|
});
|
|
73
78
|
}, [delegate]),
|
|
74
79
|
|
|
@@ -89,7 +94,6 @@ export function useBuildDataSource({
|
|
|
89
94
|
* @group Firestore
|
|
90
95
|
*/
|
|
91
96
|
listenCollection: delegate.listenCollection
|
|
92
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
93
97
|
? useCallback(<M extends Record<string, any>>(
|
|
94
98
|
{
|
|
95
99
|
path,
|
|
@@ -106,11 +110,12 @@ export function useBuildDataSource({
|
|
|
106
110
|
): () => void => {
|
|
107
111
|
|
|
108
112
|
const collection = collectionProp ?? navigationController.getCollection(path);
|
|
109
|
-
const
|
|
110
|
-
|
|
113
|
+
const usedDelegate = collection?.overrides?.dataSourceDelegate ?? delegate;
|
|
114
|
+
|
|
115
|
+
if (!usedDelegate.listenCollection)
|
|
111
116
|
throw Error("useBuildDataSource delegate not initialised");
|
|
112
117
|
|
|
113
|
-
return
|
|
118
|
+
return usedDelegate.listenCollection<M>({
|
|
114
119
|
path,
|
|
115
120
|
filter,
|
|
116
121
|
limit,
|
|
@@ -120,8 +125,7 @@ export function useBuildDataSource({
|
|
|
120
125
|
order,
|
|
121
126
|
onUpdate,
|
|
122
127
|
onError,
|
|
123
|
-
|
|
124
|
-
collection
|
|
128
|
+
collection,
|
|
125
129
|
});
|
|
126
130
|
}, [delegate, navigationController.getCollection])
|
|
127
131
|
: undefined,
|
|
@@ -135,12 +139,17 @@ export function useBuildDataSource({
|
|
|
135
139
|
*/
|
|
136
140
|
fetchEntity: useCallback(<M extends Record<string, any>>({
|
|
137
141
|
path,
|
|
138
|
-
entityId
|
|
142
|
+
entityId,
|
|
143
|
+
collection
|
|
139
144
|
}: FetchEntityProps<M>
|
|
140
|
-
): Promise<Entity<M> | undefined> =>
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
145
|
+
): Promise<Entity<M> | undefined> => {
|
|
146
|
+
const usedDelegate = collection?.overrides?.dataSourceDelegate ?? delegate;
|
|
147
|
+
return usedDelegate.fetchEntity({
|
|
148
|
+
path,
|
|
149
|
+
entityId,
|
|
150
|
+
collection
|
|
151
|
+
});
|
|
152
|
+
}, [delegate.fetchEntity]),
|
|
144
153
|
|
|
145
154
|
/**
|
|
146
155
|
*
|
|
@@ -153,7 +162,6 @@ export function useBuildDataSource({
|
|
|
153
162
|
* @group Firestore
|
|
154
163
|
*/
|
|
155
164
|
listenEntity: delegate.listenEntity
|
|
156
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
157
165
|
? useCallback(<M extends Record<string, any>>(
|
|
158
166
|
{
|
|
159
167
|
path,
|
|
@@ -162,14 +170,17 @@ export function useBuildDataSource({
|
|
|
162
170
|
onUpdate,
|
|
163
171
|
onError
|
|
164
172
|
}: ListenEntityProps<M>): () => void => {
|
|
165
|
-
|
|
173
|
+
const usedDelegate = collection?.overrides?.dataSourceDelegate ?? delegate;
|
|
174
|
+
|
|
175
|
+
if (!usedDelegate.listenEntity)
|
|
166
176
|
throw Error("useBuildDataSource delegate not initialised");
|
|
167
177
|
|
|
168
|
-
return
|
|
178
|
+
return usedDelegate.listenEntity<M>({
|
|
169
179
|
path,
|
|
170
180
|
entityId,
|
|
171
181
|
onUpdate,
|
|
172
|
-
onError
|
|
182
|
+
onError,
|
|
183
|
+
collection
|
|
173
184
|
})
|
|
174
185
|
}, [delegate.listenEntity]) : undefined,
|
|
175
186
|
|
|
@@ -194,43 +205,46 @@ export function useBuildDataSource({
|
|
|
194
205
|
}: SaveEntityProps<M>): Promise<Entity<M>> => {
|
|
195
206
|
|
|
196
207
|
const collection = collectionProp ?? navigationController.getCollection(path);
|
|
208
|
+
const usedDelegate = collection?.overrides?.dataSourceDelegate ?? delegate;
|
|
197
209
|
|
|
198
210
|
const resolvedCollection = collection
|
|
199
211
|
? resolveCollection<M>({
|
|
200
212
|
collection,
|
|
201
213
|
path,
|
|
202
214
|
entityId,
|
|
203
|
-
|
|
215
|
+
propertyConfigs: propertyConfigs,
|
|
216
|
+
authController
|
|
204
217
|
})
|
|
205
218
|
: undefined;
|
|
206
219
|
|
|
207
220
|
const properties: ResolvedProperties<M> | undefined = resolvedCollection?.properties;
|
|
208
221
|
|
|
209
|
-
const
|
|
222
|
+
const delegateValues = usedDelegate.cmsToDelegateModel(
|
|
210
223
|
values,
|
|
211
224
|
);
|
|
212
225
|
|
|
213
|
-
const
|
|
226
|
+
const updatedValues: EntityValues<M> = properties
|
|
214
227
|
? updateDateAutoValues(
|
|
215
228
|
{
|
|
216
|
-
inputValues:
|
|
229
|
+
inputValues: delegateValues,
|
|
217
230
|
properties,
|
|
218
231
|
status,
|
|
219
|
-
timestampNowValue:
|
|
220
|
-
setDateToMidnight:
|
|
232
|
+
timestampNowValue: usedDelegate.currentTime?.() ?? new Date(),
|
|
233
|
+
setDateToMidnight: usedDelegate.setDateToMidnight
|
|
221
234
|
})
|
|
222
|
-
:
|
|
235
|
+
: delegateValues;
|
|
223
236
|
|
|
224
|
-
return
|
|
237
|
+
return usedDelegate.saveEntity({
|
|
225
238
|
path,
|
|
239
|
+
collection,
|
|
226
240
|
entityId,
|
|
227
|
-
values:
|
|
241
|
+
values: updatedValues,
|
|
228
242
|
status
|
|
229
243
|
}).then((res) => {
|
|
230
244
|
return {
|
|
231
245
|
id: res.id,
|
|
232
246
|
path: res.path,
|
|
233
|
-
values:
|
|
247
|
+
values: usedDelegate.delegateToCMSModel(updatedValues)
|
|
234
248
|
} as Entity<M>;
|
|
235
249
|
});
|
|
236
250
|
}, [delegate.saveEntity, navigationController.getCollection]),
|
|
@@ -243,10 +257,15 @@ export function useBuildDataSource({
|
|
|
243
257
|
*/
|
|
244
258
|
deleteEntity: useCallback(<M extends Record<string, any>>(
|
|
245
259
|
{
|
|
246
|
-
entity
|
|
260
|
+
entity,
|
|
261
|
+
collection
|
|
247
262
|
}: DeleteEntityProps<M>
|
|
248
263
|
): Promise<void> => {
|
|
249
|
-
|
|
264
|
+
const usedDelegate = collection?.overrides?.dataSourceDelegate ?? delegate;
|
|
265
|
+
return usedDelegate.deleteEntity({
|
|
266
|
+
entity,
|
|
267
|
+
collection
|
|
268
|
+
});
|
|
250
269
|
}, [delegate.deleteEntity]),
|
|
251
270
|
|
|
252
271
|
/**
|
|
@@ -263,13 +282,16 @@ export function useBuildDataSource({
|
|
|
263
282
|
path: string,
|
|
264
283
|
name: string,
|
|
265
284
|
value: any,
|
|
266
|
-
entityId?: string
|
|
285
|
+
entityId?: string,
|
|
286
|
+
collection?: EntityCollection
|
|
267
287
|
): Promise<boolean> => {
|
|
268
|
-
|
|
288
|
+
const usedDelegate = collection?.overrides?.dataSourceDelegate ?? delegate;
|
|
289
|
+
return usedDelegate.checkUniqueField(path, name, value, entityId, collection);
|
|
269
290
|
}, [delegate.checkUniqueField]),
|
|
270
291
|
|
|
271
|
-
generateEntityId: useCallback((path: string): string => {
|
|
272
|
-
|
|
292
|
+
generateEntityId: useCallback((path: string, collection: EntityCollection): string => {
|
|
293
|
+
const usedDelegate = collection?.overrides?.dataSourceDelegate ?? delegate;
|
|
294
|
+
return usedDelegate.generateEntityId(path, collection);
|
|
273
295
|
}, [delegate.generateEntityId]),
|
|
274
296
|
|
|
275
297
|
countEntities: delegate.countEntities ? async ({
|
|
@@ -285,21 +307,24 @@ export function useBuildDataSource({
|
|
|
285
307
|
orderBy?: string,
|
|
286
308
|
order?: "desc" | "asc",
|
|
287
309
|
}): Promise<number> => {
|
|
288
|
-
|
|
310
|
+
const usedDelegate = collection?.overrides?.dataSourceDelegate ?? delegate;
|
|
311
|
+
return usedDelegate.countEntities!({
|
|
289
312
|
path,
|
|
290
313
|
filter,
|
|
291
314
|
orderBy,
|
|
292
315
|
order,
|
|
293
|
-
|
|
316
|
+
collection
|
|
294
317
|
});
|
|
295
318
|
} : undefined,
|
|
296
319
|
|
|
297
320
|
isFilterCombinationValid: useCallback(({
|
|
298
321
|
path,
|
|
322
|
+
databaseId,
|
|
299
323
|
filterValues,
|
|
300
324
|
sortBy
|
|
301
325
|
}: {
|
|
302
326
|
path: string,
|
|
327
|
+
databaseId?: string,
|
|
303
328
|
filterValues: FilterValues<any>,
|
|
304
329
|
sortBy?: [string, "asc" | "desc"]
|
|
305
330
|
}): boolean => {
|
|
@@ -308,6 +333,7 @@ export function useBuildDataSource({
|
|
|
308
333
|
return delegate.isFilterCombinationValid(
|
|
309
334
|
{
|
|
310
335
|
path,
|
|
336
|
+
databaseId,
|
|
311
337
|
filterValues,
|
|
312
338
|
sortBy
|
|
313
339
|
}
|
|
@@ -320,51 +346,12 @@ export function useBuildDataSource({
|
|
|
320
346
|
collection: EntityCollection,
|
|
321
347
|
parentCollectionIds?: string[]
|
|
322
348
|
}): Promise<boolean> => {
|
|
323
|
-
|
|
349
|
+
const usedDelegate = props.collection?.overrides?.dataSourceDelegate ?? delegate;
|
|
350
|
+
if (!usedDelegate.initTextSearch)
|
|
324
351
|
return false;
|
|
325
|
-
return
|
|
352
|
+
return usedDelegate.initTextSearch(props)
|
|
326
353
|
}, [delegate.initTextSearch]),
|
|
327
354
|
|
|
328
355
|
};
|
|
329
356
|
|
|
330
357
|
}
|
|
331
|
-
|
|
332
|
-
// /**
|
|
333
|
-
// * Recursive function that converts Firestore data types into CMS or plain
|
|
334
|
-
// * JS types.
|
|
335
|
-
// * FireCMS uses Javascript dates internally instead of Firestore timestamps.
|
|
336
|
-
// * This makes it easier to interact with the rest of the libraries and
|
|
337
|
-
// * bindings.
|
|
338
|
-
// * Also, Firestore references are replaced with {@link EntityReference}
|
|
339
|
-
// * @param data
|
|
340
|
-
// * @param buildReference
|
|
341
|
-
// * @param buildGeoPoint
|
|
342
|
-
// * @param buildDate
|
|
343
|
-
// * @param buildDelete
|
|
344
|
-
// * @group Firestore
|
|
345
|
-
// */
|
|
346
|
-
// export function cmsToDelegateModel(data: any,
|
|
347
|
-
// buildReference: (reference: EntityReference) => any,
|
|
348
|
-
// buildGeoPoint: (geoPoint: GeoPoint) => any,
|
|
349
|
-
// buildDate: (date: Date) => any,
|
|
350
|
-
// buildDelete: () => any
|
|
351
|
-
// ): any {
|
|
352
|
-
// if (data === undefined) {
|
|
353
|
-
// return buildDelete();
|
|
354
|
-
// } else if (data === null) {
|
|
355
|
-
// return null;
|
|
356
|
-
// } else if (Array.isArray(data)) {
|
|
357
|
-
// return data.map(v => cmsToDelegateModel(v, buildReference, buildGeoPoint, buildDate, buildDelete));
|
|
358
|
-
// } else if (data.isEntityReference && data.isEntityReference()) {
|
|
359
|
-
// return buildReference(data);
|
|
360
|
-
// } else if (data instanceof GeoPoint) {
|
|
361
|
-
// return buildGeoPoint(data);
|
|
362
|
-
// } else if (data instanceof Date) {
|
|
363
|
-
// return buildDate(data);
|
|
364
|
-
// } else if (data && typeof data === "object") {
|
|
365
|
-
// return Object.entries(data)
|
|
366
|
-
// .map(([key, v]) => ({ [key]: cmsToDelegateModel(v, buildReference, buildGeoPoint, buildDate, buildDelete) }))
|
|
367
|
-
// .reduce((a, b) => ({ ...a, ...b }), {});
|
|
368
|
-
// }
|
|
369
|
-
// return data;
|
|
370
|
-
// }
|
|
@@ -25,8 +25,9 @@ export function useBuildSideDialogsController(): SideDialogsController {
|
|
|
25
25
|
const newPanels = panelKeys
|
|
26
26
|
.map(key => routesStore.current[key])
|
|
27
27
|
.filter(p => Boolean(p)) as SideDialogPanelProps[];
|
|
28
|
-
if (!equal(sidePanelsRef.current.map(p => p.key), newPanels.map(p => p.key)))
|
|
28
|
+
if (!equal(sidePanelsRef.current.map(p => p.key), newPanels.map(p => p.key))) {
|
|
29
29
|
updateSidePanels(newPanels);
|
|
30
|
+
}
|
|
30
31
|
}, [location]);
|
|
31
32
|
|
|
32
33
|
const close = useCallback(() => {
|
|
@@ -39,7 +40,7 @@ export function useBuildSideDialogsController(): SideDialogsController {
|
|
|
39
40
|
updateSidePanels(updatedPanels);
|
|
40
41
|
|
|
41
42
|
if (routesCount.current > 0) {
|
|
42
|
-
if (lastSidePanel.urlPath)
|
|
43
|
+
if (lastSidePanel.urlPath) // if it has a url path, we need to navigate back, don't remove this code
|
|
43
44
|
navigate(-1);
|
|
44
45
|
routesCount.current--;
|
|
45
46
|
} else if (lastSidePanel.parentUrlPath) {
|
|
@@ -118,6 +119,7 @@ export function useBuildSideDialogsController(): SideDialogsController {
|
|
|
118
119
|
|
|
119
120
|
return {
|
|
120
121
|
sidePanels,
|
|
122
|
+
setSidePanels: updateSidePanels,
|
|
121
123
|
close,
|
|
122
124
|
open,
|
|
123
125
|
replace
|