@firecms/core 3.0.0-beta.10 → 3.0.0-beta.12
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/components/ArrayContainer.d.ts +22 -6
- package/dist/components/EntityCollectionTable/EntityCollectionRowActions.d.ts +2 -1
- package/dist/components/EntityCollectionTable/EntityCollectionTable.d.ts +2 -2
- package/dist/components/EntityCollectionTable/EntityCollectionTableProps.d.ts +17 -3
- 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 +4 -0
- package/dist/components/PropertyIdCopyTooltip.d.ts +1 -1
- package/dist/components/SelectableTable/SelectableTable.d.ts +12 -2
- 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 +13 -0
- 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/contexts/BreacrumbsContext.d.ts +8 -0
- package/dist/core/EntityEditView.d.ts +30 -22
- package/dist/core/EntityEditViewFormActions.d.ts +2 -0
- package/dist/core/FireCMS.d.ts +1 -1
- 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/index.d.ts +2 -1
- package/dist/form/EntityForm.d.ts +45 -0
- package/dist/form/EntityFormActions.d.ts +17 -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/index.d.ts +2 -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/MapFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/MarkdownEditorFieldBinding.d.ts +1 -1
- 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/SwitchFieldBinding.d.ts +1 -2
- package/dist/form/index.d.ts +16 -16
- 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 +7 -4
- package/dist/hooks/useFireCMSContext.d.ts +1 -1
- package/dist/hooks/useModeController.d.ts +1 -2
- package/dist/hooks/useResolvedNavigationFrom.d.ts +3 -3
- package/dist/hooks/useValidateAuthenticator.d.ts +3 -3
- package/dist/index.es.js +17032 -12909
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +17019 -12898
- package/dist/index.umd.js.map +1 -1
- package/dist/internal/useBuildSideEntityController.d.ts +2 -2
- 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/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/auth.d.ts +7 -9
- package/dist/types/collections.d.ts +44 -23
- package/dist/types/datasource.d.ts +2 -6
- package/dist/types/dialogs_controller.d.ts +7 -3
- package/dist/types/entities.d.ts +1 -1
- package/dist/types/entity_actions.d.ts +14 -4
- package/dist/types/entity_callbacks.d.ts +16 -16
- package/dist/types/export_import.d.ts +4 -4
- package/dist/types/fields.d.ts +27 -4
- package/dist/types/firecms.d.ts +2 -2
- package/dist/types/firecms_context.d.ts +1 -1
- package/dist/types/navigation.d.ts +29 -12
- package/dist/types/permissions.d.ts +4 -4
- package/dist/types/plugins.d.ts +9 -8
- package/dist/types/properties.d.ts +18 -3
- package/dist/types/property_config.d.ts +0 -2
- package/dist/types/side_entity_controller.d.ts +6 -1
- package/dist/types/user.d.ts +1 -0
- package/dist/util/builders.d.ts +3 -3
- package/dist/util/entities.d.ts +1 -1
- 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 +3 -1
- package/dist/util/index.d.ts +1 -0
- package/dist/util/navigation_from_path.d.ts +6 -1
- package/dist/util/navigation_utils.d.ts +12 -1
- package/dist/util/objects.d.ts +1 -0
- package/dist/util/permissions.d.ts +4 -4
- package/dist/util/property_utils.d.ts +2 -2
- package/dist/util/resolutions.d.ts +12 -7
- package/package.json +129 -125
- package/src/app/Scaffold.tsx +4 -4
- package/src/components/ArrayContainer.tsx +115 -34
- package/src/components/CircularProgressCenter.tsx +1 -1
- package/src/components/ConfirmationDialog.tsx +2 -2
- package/src/components/DeleteEntityDialog.tsx +10 -19
- package/src/components/EntityCollectionTable/EntityCollectionRowActions.tsx +44 -20
- package/src/components/EntityCollectionTable/EntityCollectionTable.tsx +23 -17
- package/src/components/EntityCollectionTable/EntityCollectionTableProps.tsx +20 -3
- package/src/components/EntityCollectionTable/PropertyTableCell.tsx +6 -4
- package/src/components/EntityCollectionTable/fields/TableReferenceField.tsx +8 -9
- package/src/components/EntityCollectionTable/fields/TableStorageUpload.tsx +5 -11
- package/src/components/EntityCollectionTable/index.tsx +1 -1
- package/src/components/EntityCollectionTable/internal/CollectionTableToolbar.tsx +3 -3
- package/src/components/EntityCollectionTable/internal/EntityTableCell.tsx +5 -5
- package/src/components/EntityCollectionTable/internal/EntityTableCellActions.tsx +2 -2
- package/src/components/EntityCollectionTable/internal/popup_field/PopupFormField.tsx +77 -73
- package/src/components/EntityCollectionView/EntityCollectionView.tsx +90 -49
- package/src/components/EntityCollectionView/EntityCollectionViewActions.tsx +4 -2
- package/src/components/EntityCollectionView/useSelectionController.tsx +5 -4
- package/src/components/EntityPreview.tsx +39 -30
- package/src/components/EntityView.tsx +5 -5
- package/src/components/ErrorView.tsx +3 -3
- package/src/components/HomePage/DefaultHomePage.tsx +1 -0
- package/src/components/HomePage/FavouritesView.tsx +6 -11
- package/src/components/HomePage/NavigationCard.tsx +1 -1
- package/src/components/HomePage/NavigationCardBinding.tsx +4 -9
- package/src/components/HomePage/NavigationGroup.tsx +1 -1
- package/src/components/NotFoundPage.tsx +2 -2
- package/src/components/PropertyConfigBadge.tsx +1 -1
- package/src/components/PropertyIdCopyTooltip.tsx +3 -4
- package/src/components/ReferenceTable/ReferenceSelectionTable.tsx +13 -8
- package/src/components/SelectableTable/SelectableTable.tsx +20 -5
- 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 +7 -5
- package/src/components/UnsavedChangesDialog.tsx +42 -0
- package/src/components/VirtualTable/VirtualTable.tsx +19 -2
- package/src/components/VirtualTable/VirtualTableHeader.tsx +8 -8
- package/src/components/VirtualTable/VirtualTableHeaderRow.tsx +1 -1
- package/src/components/VirtualTable/VirtualTableProps.tsx +15 -0
- package/src/components/VirtualTable/VirtualTableRow.tsx +1 -1
- package/src/components/VirtualTable/fields/VirtualTableDateField.tsx +1 -1
- package/src/components/VirtualTable/fields/VirtualTableInput.tsx +1 -1
- package/src/components/VirtualTable/fields/VirtualTableSelect.tsx +2 -0
- package/src/components/common/default_entity_actions.tsx +26 -37
- 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/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 +56 -25
- package/src/core/DefaultDrawer.tsx +11 -9
- package/src/core/DrawerNavigationItem.tsx +4 -4
- package/src/core/EntityEditView.tsx +282 -1006
- package/src/core/EntityEditViewFormActions.tsx +199 -0
- package/src/core/EntitySidePanel.tsx +85 -15
- package/src/core/FireCMS.tsx +12 -9
- package/src/core/FireCMSRouter.tsx +17 -0
- package/src/core/NavigationRoutes.tsx +23 -32
- package/src/core/SideDialogs.tsx +21 -12
- package/src/core/field_configs.tsx +4 -4
- package/src/core/index.tsx +4 -2
- package/src/form/EntityForm.tsx +774 -0
- package/src/form/EntityFormActions.tsx +169 -0
- package/src/form/PropertyFieldBinding.tsx +39 -30
- package/src/form/components/CustomIdField.tsx +2 -0
- package/src/form/components/FormEntry.tsx +22 -0
- package/src/form/components/FormLayout.tsx +16 -0
- package/src/form/components/LabelWithIcon.tsx +6 -3
- package/src/form/components/StorageItemPreview.tsx +3 -3
- package/src/form/components/StorageUploadProgress.tsx +1 -1
- package/src/form/components/index.tsx +2 -1
- package/src/form/field_bindings/ArrayCustomShapedFieldBinding.tsx +7 -6
- package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +20 -12
- package/src/form/field_bindings/BlockFieldBinding.tsx +45 -25
- package/src/form/field_bindings/DateTimeFieldBinding.tsx +2 -1
- package/src/form/field_bindings/KeyValueFieldBinding.tsx +10 -7
- package/src/form/field_bindings/MapFieldBinding.tsx +69 -52
- package/src/form/field_bindings/MarkdownEditorFieldBinding.tsx +9 -6
- package/src/form/field_bindings/MultiSelectFieldBinding.tsx +1 -1
- package/src/form/field_bindings/ReadOnlyFieldBinding.tsx +2 -2
- package/src/form/field_bindings/ReferenceFieldBinding.tsx +5 -5
- package/src/form/field_bindings/RepeatFieldBinding.tsx +30 -22
- package/src/form/field_bindings/SelectFieldBinding.tsx +6 -5
- package/src/form/field_bindings/StorageUploadFieldBinding.tsx +7 -5
- package/src/form/field_bindings/SwitchFieldBinding.tsx +26 -25
- package/src/form/field_bindings/TextFieldBinding.tsx +4 -3
- package/src/form/index.tsx +16 -32
- package/src/form/validation.ts +12 -6
- package/src/hooks/data/delete.ts +4 -4
- package/src/hooks/data/save.ts +8 -9
- package/src/hooks/data/useCollectionFetch.tsx +3 -3
- 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/useBuildModeController.tsx +15 -28
- package/src/hooks/useBuildNavigationController.tsx +74 -29
- package/src/hooks/useFireCMSContext.tsx +5 -5
- package/src/hooks/useLargeLayout.tsx +0 -35
- package/src/hooks/useModeController.tsx +1 -2
- package/src/hooks/useResolvedNavigationFrom.tsx +9 -11
- package/src/hooks/useValidateAuthenticator.tsx +3 -3
- package/src/internal/useBuildDataSource.ts +1 -1
- package/src/internal/useBuildSideDialogsController.tsx +3 -2
- package/src/internal/useBuildSideEntityController.tsx +124 -83
- package/src/internal/useUnsavedChangesDialog.tsx +127 -93
- package/src/preview/PropertyPreview.tsx +11 -11
- 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 +5 -6
- package/src/preview/components/UrlComponentPreview.tsx +20 -21
- package/src/preview/property_previews/ArrayOfMapsPreview.tsx +1 -1
- package/src/preview/property_previews/ArrayOfReferencesPreview.tsx +2 -2
- package/src/preview/property_previews/ArrayOfStorageComponentsPreview.tsx +2 -2
- package/src/preview/property_previews/ArrayOfStringsPreview.tsx +1 -1
- package/src/preview/property_previews/ArrayOneOfPreview.tsx +2 -2
- package/src/preview/property_previews/ArrayPropertyPreview.tsx +2 -2
- package/src/preview/property_previews/MapPropertyPreview.tsx +7 -6
- package/src/preview/property_previews/SkeletonPropertyComponent.tsx +12 -12
- 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 +235 -0
- package/src/routes/HomePageRoute.tsx +17 -0
- package/src/types/auth.tsx +8 -12
- package/src/types/collections.ts +52 -26
- package/src/types/datasource.ts +2 -6
- package/src/types/dialogs_controller.tsx +7 -3
- package/src/types/entities.ts +1 -1
- package/src/types/entity_actions.tsx +16 -4
- package/src/types/entity_callbacks.ts +18 -18
- package/src/types/export_import.ts +4 -4
- package/src/types/fields.tsx +33 -4
- package/src/types/firecms.tsx +2 -2
- package/src/types/firecms_context.tsx +1 -1
- package/src/types/navigation.ts +36 -16
- package/src/types/permissions.ts +5 -5
- package/src/types/plugins.tsx +9 -8
- package/src/types/properties.ts +21 -3
- package/src/types/property_config.tsx +0 -2
- package/src/types/side_dialogs_controller.tsx +2 -0
- package/src/types/side_entity_controller.tsx +6 -1
- package/src/types/user.ts +2 -0
- package/src/util/builders.ts +10 -8
- package/src/util/entities.ts +3 -1
- package/src/util/entity_actions.ts +28 -0
- package/src/util/entity_cache.ts +204 -0
- package/src/util/icon_list.ts +1 -0
- package/src/util/icon_synonyms.ts +0 -1
- package/src/util/icons.tsx +12 -8
- package/src/util/index.ts +1 -0
- package/src/util/join_collections.ts +3 -0
- package/src/util/navigation_from_path.ts +13 -6
- package/src/util/navigation_utils.ts +53 -1
- package/src/util/objects.ts +24 -1
- package/src/util/parent_references_from_path.ts +3 -3
- package/src/util/permissions.ts +8 -8
- package/src/util/property_utils.tsx +10 -3
- package/src/util/references.ts +8 -2
- package/src/util/resolutions.ts +34 -13
- package/src/util/useStorageUploadController.tsx +40 -22
- package/dist/form/components/FormikArrayContainer.d.ts +0 -19
- package/src/components/common/useDataSourceEntityCollectionTableController.tsx +0 -236
- package/src/form/components/FormikArrayContainer.tsx +0 -47
- /package/src/util/{common.tsx → common.ts} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EntityCollection, EntitySidePanelProps, NavigationController, SideDialogsController, SideEntityController } from "../types";
|
|
2
|
-
export declare function getEntityViewWidth(props: EntitySidePanelProps<any>, small: boolean): string;
|
|
1
|
+
import { CustomizationController, EntityCollection, EntitySidePanelProps, NavigationController, SideDialogsController, SideEntityController } from "../types";
|
|
2
|
+
export declare function getEntityViewWidth(props: EntitySidePanelProps<any>, small: boolean, customizationController: CustomizationController): string;
|
|
3
3
|
export declare const useBuildSideEntityController: (navigation: NavigationController, sideDialogsController: SideDialogsController) => SideEntityController;
|
|
4
4
|
export declare function buildSidePanelsFromUrl(path: string, collections: EntityCollection[], newFlag: boolean): EntitySidePanelProps<any>[];
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Custom hook to handle navigation blocking when there are unsaved changes.
|
|
3
|
+
*
|
|
4
|
+
* @param when - Indicates whether to block navigation.
|
|
5
|
+
* @param onSuccess - Callback invoked when navigation is confirmed.
|
|
6
|
+
* @returns An object containing the state of navigation blocking and handlers.
|
|
7
|
+
*/
|
|
2
8
|
export declare function useNavigationUnsavedChangesDialog(when: boolean, onSuccess: () => void): {
|
|
3
9
|
navigationWasBlocked: boolean;
|
|
4
10
|
handleCancel: () => void;
|
|
5
11
|
handleOk: () => void;
|
|
6
12
|
};
|
|
7
|
-
export interface UnsavedChangesDialogProps {
|
|
8
|
-
open: boolean;
|
|
9
|
-
body?: React.ReactNode;
|
|
10
|
-
title?: string;
|
|
11
|
-
handleOk: () => void;
|
|
12
|
-
handleCancel: () => void;
|
|
13
|
-
}
|
|
14
|
-
export declare function UnsavedChangesDialog({ open, handleOk, handleCancel, body, title }: UnsavedChangesDialogProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -3,7 +3,7 @@ import { EnumValues } from "../../types";
|
|
|
3
3
|
export interface EnumValuesChipProps {
|
|
4
4
|
enumValues?: EnumValues;
|
|
5
5
|
enumKey: string | number;
|
|
6
|
-
size: "
|
|
6
|
+
size: "small" | "medium" | "large";
|
|
7
7
|
className?: string;
|
|
8
8
|
children?: React.ReactNode;
|
|
9
9
|
}
|
package/dist/preview/util.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CollectionSize } from "../types";
|
|
2
2
|
import { PreviewSize } from "./PropertyPreviewProps";
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const
|
|
5
|
-
export declare const
|
|
3
|
+
export declare const SMALL_THUMBNAIL = 40;
|
|
4
|
+
export declare const MEDIUM_THUMBNAIL = 100;
|
|
5
|
+
export declare const LARGE_THUMBNAIL = 200;
|
|
6
6
|
export declare function getThumbnailMeasure(size: PreviewSize): number;
|
|
7
7
|
export declare function getPreviewSizeFrom(size: CollectionSize): PreviewSize;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function FireCMSRoute(): import("react/jsx-runtime").JSX.Element | null;
|
package/dist/types/auth.d.ts
CHANGED
|
@@ -8,16 +8,12 @@ import { StorageSource } from "./storage";
|
|
|
8
8
|
* to do it as the result of a hook.
|
|
9
9
|
* @group Hooks and utilities
|
|
10
10
|
*/
|
|
11
|
-
export type AuthController<
|
|
11
|
+
export type AuthController<USER extends User = any, ExtraData = any> = {
|
|
12
12
|
/**
|
|
13
13
|
* The user currently logged in
|
|
14
14
|
* The values can be: the user object, null if they skipped login
|
|
15
15
|
*/
|
|
16
|
-
user:
|
|
17
|
-
/**
|
|
18
|
-
* Roles related to the logged user
|
|
19
|
-
*/
|
|
20
|
-
roles?: Role[];
|
|
16
|
+
user: USER | null;
|
|
21
17
|
/**
|
|
22
18
|
* Initial loading flag. It is used not to display the login screen
|
|
23
19
|
* when the app first loads, and it has not been checked whether the user
|
|
@@ -51,20 +47,22 @@ export type AuthController<UserType extends User = any, ExtraData = any> = {
|
|
|
51
47
|
loginSkipped: boolean;
|
|
52
48
|
extra: ExtraData;
|
|
53
49
|
setExtra: (extra: ExtraData) => void;
|
|
50
|
+
setUser?: (user: USER | null) => void;
|
|
51
|
+
setUserRoles?: (roles: Role[]) => void;
|
|
54
52
|
};
|
|
55
53
|
/**
|
|
56
54
|
* Implement this function to allow access to specific users.
|
|
57
55
|
* @group Hooks and utilities
|
|
58
56
|
*/
|
|
59
|
-
export type Authenticator<
|
|
57
|
+
export type Authenticator<USER extends User = User> = (props: {
|
|
60
58
|
/**
|
|
61
59
|
* Logged-in user or null
|
|
62
60
|
*/
|
|
63
|
-
user:
|
|
61
|
+
user: USER | null;
|
|
64
62
|
/**
|
|
65
63
|
* AuthController
|
|
66
64
|
*/
|
|
67
|
-
authController:
|
|
65
|
+
authController: AuthController<USER>;
|
|
68
66
|
/**
|
|
69
67
|
* Connector to your database, e.g. your Firestore database
|
|
70
68
|
*/
|
|
@@ -16,7 +16,7 @@ import { EntityOverrides } from "./entity_overrides";
|
|
|
16
16
|
*
|
|
17
17
|
* @group Models
|
|
18
18
|
*/
|
|
19
|
-
export interface EntityCollection<M extends Record<string, any> = any,
|
|
19
|
+
export interface EntityCollection<M extends Record<string, any> = any, USER extends User = any> {
|
|
20
20
|
/**
|
|
21
21
|
* You can set an alias that will be used internally instead of the `path`.
|
|
22
22
|
* The `alias` value will be used to determine the URL of the collection,
|
|
@@ -72,6 +72,10 @@ export interface EntityCollection<M extends Record<string, any> = any, UserType
|
|
|
72
72
|
* Set of properties that compose an entity
|
|
73
73
|
*/
|
|
74
74
|
properties: PropertiesOrBuilders<M>;
|
|
75
|
+
/**
|
|
76
|
+
* Default preview properties displayed when this collection is referenced to.
|
|
77
|
+
*/
|
|
78
|
+
previewProperties?: string[];
|
|
75
79
|
/**
|
|
76
80
|
* Title property of the entity. This is the property that will be used
|
|
77
81
|
* as the title in entity related views and references.
|
|
@@ -79,11 +83,10 @@ export interface EntityCollection<M extends Record<string, any> = any, UserType
|
|
|
79
83
|
*/
|
|
80
84
|
titleProperty?: keyof M;
|
|
81
85
|
/**
|
|
82
|
-
*
|
|
83
|
-
* Defaults to `
|
|
84
|
-
* Keep in mind that you can also set this prop to individual properties.
|
|
86
|
+
* When editing an entity, you can choose to open the entity in a side dialog
|
|
87
|
+
* or in a full screen dialog. Defaults to `full_screen`.
|
|
85
88
|
*/
|
|
86
|
-
|
|
89
|
+
openEntityMode?: "side_panel" | "full_screen";
|
|
87
90
|
/**
|
|
88
91
|
* Order in which the properties are displayed.
|
|
89
92
|
* If you are specifying your collection as code, the order is the same as the
|
|
@@ -105,7 +108,7 @@ export interface EntityCollection<M extends Record<string, any> = any, UserType
|
|
|
105
108
|
* `hidden` in the property definition,will be ignored.
|
|
106
109
|
* `propertiesOrder` has precedence over `hidden`.
|
|
107
110
|
*/
|
|
108
|
-
propertiesOrder?: (Extract<keyof M, string> | `subcollection:${string}`)[];
|
|
111
|
+
propertiesOrder?: (Extract<keyof M, string> | string | `subcollection:${string}` | "collectionGroupParent")[];
|
|
109
112
|
/**
|
|
110
113
|
* If enabled, content is loaded in batches. If `false` all entities in the
|
|
111
114
|
* collection are loaded.
|
|
@@ -122,7 +125,7 @@ export interface EntityCollection<M extends Record<string, any> = any, UserType
|
|
|
122
125
|
* Permissions the logged-in user can perform on this collection.
|
|
123
126
|
* If not specified everything defaults to `true`.
|
|
124
127
|
*/
|
|
125
|
-
permissions?: Permissions | PermissionsBuilder<EntityCollection,
|
|
128
|
+
permissions?: Permissions | PermissionsBuilder<EntityCollection, USER, M>;
|
|
126
129
|
/**
|
|
127
130
|
* Are the entities in this collection selectable. Defaults to `true`
|
|
128
131
|
*/
|
|
@@ -138,7 +141,7 @@ export interface EntityCollection<M extends Record<string, any> = any, UserType
|
|
|
138
141
|
* is being created, updated or deleted.
|
|
139
142
|
* Useful for adding your own logic or blocking the execution of the operation.
|
|
140
143
|
*/
|
|
141
|
-
callbacks?: EntityCallbacks<M,
|
|
144
|
+
callbacks?: EntityCallbacks<M, USER>;
|
|
142
145
|
/**
|
|
143
146
|
* Builder for rendering additional components such as buttons in the
|
|
144
147
|
* collection toolbar
|
|
@@ -167,7 +170,7 @@ export interface EntityCollection<M extends Record<string, any> = any, UserType
|
|
|
167
170
|
* }
|
|
168
171
|
* ```
|
|
169
172
|
*/
|
|
170
|
-
entityActions?: EntityAction<M,
|
|
173
|
+
entityActions?: EntityAction<M, USER>[];
|
|
171
174
|
/**
|
|
172
175
|
* Pass your own selection controller if you want to control selected
|
|
173
176
|
* entities externally.
|
|
@@ -212,7 +215,7 @@ export interface EntityCollection<M extends Record<string, any> = any, UserType
|
|
|
212
215
|
* You can add additional fields to the collection view by implementing
|
|
213
216
|
* an additional field delegate.
|
|
214
217
|
*/
|
|
215
|
-
additionalFields?: AdditionalFieldDelegate<M,
|
|
218
|
+
additionalFields?: AdditionalFieldDelegate<M, USER>[];
|
|
216
219
|
/**
|
|
217
220
|
* Default size of the rendered collection
|
|
218
221
|
*/
|
|
@@ -257,7 +260,7 @@ export interface EntityCollection<M extends Record<string, any> = any, UserType
|
|
|
257
260
|
/**
|
|
258
261
|
*
|
|
259
262
|
*/
|
|
260
|
-
exportable?: boolean | ExportConfig<
|
|
263
|
+
exportable?: boolean | ExportConfig<USER>;
|
|
261
264
|
/**
|
|
262
265
|
* User id of the owner of this collection. This is used only by plugins, or if you
|
|
263
266
|
* are writing custom code
|
|
@@ -272,9 +275,18 @@ export interface EntityCollection<M extends Record<string, any> = any, UserType
|
|
|
272
275
|
*/
|
|
273
276
|
sideDialogWidth?: number | string;
|
|
274
277
|
/**
|
|
275
|
-
*
|
|
278
|
+
* Can this collection configuration be edited by the end user.
|
|
279
|
+
* Defaults to `true`.
|
|
280
|
+
* Keep in mind that you can also set this prop to individual properties.
|
|
281
|
+
* This prop has only effect if you are using the collection editor.
|
|
276
282
|
*/
|
|
277
|
-
|
|
283
|
+
editable?: boolean;
|
|
284
|
+
/**
|
|
285
|
+
* If set to true, the default values of the properties will be applied
|
|
286
|
+
* to the entity every time the entity is updated (not only when created).
|
|
287
|
+
* Defaults to false.
|
|
288
|
+
*/
|
|
289
|
+
alwaysApplyDefaultValues?: boolean;
|
|
278
290
|
}
|
|
279
291
|
/**
|
|
280
292
|
* Parameter passed to the `Actions` prop in the collection configuration.
|
|
@@ -283,7 +295,7 @@ export interface EntityCollection<M extends Record<string, any> = any, UserType
|
|
|
283
295
|
*
|
|
284
296
|
* @group Models
|
|
285
297
|
*/
|
|
286
|
-
export interface CollectionActionsProps<M extends Record<string, any> = any,
|
|
298
|
+
export interface CollectionActionsProps<M extends Record<string, any> = any, USER extends User = User, EC extends EntityCollection<M> = EntityCollection<M>> {
|
|
287
299
|
/**
|
|
288
300
|
* Full collection path of this entity. This is the full path, like
|
|
289
301
|
* `users/1234/addresses`
|
|
@@ -314,7 +326,7 @@ export interface CollectionActionsProps<M extends Record<string, any> = any, Use
|
|
|
314
326
|
/**
|
|
315
327
|
* Context of the app status
|
|
316
328
|
*/
|
|
317
|
-
context: FireCMSContext<
|
|
329
|
+
context: FireCMSContext<USER>;
|
|
318
330
|
/**
|
|
319
331
|
* Count of the entities in this collection
|
|
320
332
|
*/
|
|
@@ -357,16 +369,16 @@ export type FilterCombination<Key extends string> = Partial<Record<Key, "asc" |
|
|
|
357
369
|
* @group Models
|
|
358
370
|
*/
|
|
359
371
|
export type CollectionSize = "xs" | "s" | "m" | "l" | "xl";
|
|
360
|
-
export type AdditionalFieldDelegateProps<M extends Record<string, any> = any,
|
|
372
|
+
export type AdditionalFieldDelegateProps<M extends Record<string, any> = any, USER extends User = User> = {
|
|
361
373
|
entity: Entity<M>;
|
|
362
|
-
context: FireCMSContext<
|
|
374
|
+
context: FireCMSContext<USER>;
|
|
363
375
|
};
|
|
364
376
|
/**
|
|
365
377
|
* Use this interface for adding additional fields to entity collection views.
|
|
366
378
|
* If you need to do some async loading you can use {@link AsyncPreviewComponent}
|
|
367
379
|
* @group Models
|
|
368
380
|
*/
|
|
369
|
-
export interface AdditionalFieldDelegate<M extends Record<string, any> = any,
|
|
381
|
+
export interface AdditionalFieldDelegate<M extends Record<string, any> = any, USER extends User = User> {
|
|
370
382
|
/**
|
|
371
383
|
* ID of this column. You can use this id in the `properties` field of the
|
|
372
384
|
* collection in any order you want
|
|
@@ -383,7 +395,7 @@ export interface AdditionalFieldDelegate<M extends Record<string, any> = any, Us
|
|
|
383
395
|
/**
|
|
384
396
|
* Builder for the content of the cell for this column
|
|
385
397
|
*/
|
|
386
|
-
Builder?: React.ComponentType<AdditionalFieldDelegateProps<M,
|
|
398
|
+
Builder?: React.ComponentType<AdditionalFieldDelegateProps<M, USER>>;
|
|
387
399
|
/**
|
|
388
400
|
* If this column needs to update dynamically based on other properties,
|
|
389
401
|
* you can define an array of keys as strings with the
|
|
@@ -420,10 +432,12 @@ export type EntityCustomView<M extends Record<string, any> = any> = {
|
|
|
420
432
|
*/
|
|
421
433
|
name: string;
|
|
422
434
|
/**
|
|
423
|
-
* If set to true, the actions of the entity will be
|
|
424
|
-
*
|
|
435
|
+
* If set to true, the actions of the entity (save, discard,delete) will be
|
|
436
|
+
* included in the view. By default the actions are located in the right or bottom,
|
|
437
|
+
* based on the screen size. You can force the actions to be located at the bottom
|
|
438
|
+
* by setting this prop to "bottom".
|
|
425
439
|
*/
|
|
426
|
-
includeActions?: boolean;
|
|
440
|
+
includeActions?: boolean | "bottom";
|
|
427
441
|
/**
|
|
428
442
|
* Builder for rendering the custom view
|
|
429
443
|
*/
|
|
@@ -485,6 +499,12 @@ export type EntityTableController<M extends Record<string, any> = any> = {
|
|
|
485
499
|
clearFilter?: () => void;
|
|
486
500
|
itemCount?: number;
|
|
487
501
|
setItemCount?: (itemCount: number) => void;
|
|
502
|
+
initialScroll?: number;
|
|
503
|
+
onScroll?: (props: {
|
|
504
|
+
scrollDirection: "forward" | "backward";
|
|
505
|
+
scrollOffset: number;
|
|
506
|
+
scrollUpdateWasRequested: boolean;
|
|
507
|
+
}) => void;
|
|
488
508
|
paginationEnabled?: boolean;
|
|
489
509
|
pageSize?: number;
|
|
490
510
|
checkFilterCombination?: (filterValues: FilterValues<any>, sortBy?: [string, "asc" | "desc"]) => boolean;
|
|
@@ -497,5 +517,6 @@ export type SelectedCellProps<M extends Record<string, any>> = {
|
|
|
497
517
|
cellRect: DOMRect;
|
|
498
518
|
width: number;
|
|
499
519
|
height: number;
|
|
500
|
-
|
|
520
|
+
entityPath: string;
|
|
521
|
+
entityId: string;
|
|
501
522
|
};
|
|
@@ -8,13 +8,13 @@ import { FireCMSContext } from "./firecms_context";
|
|
|
8
8
|
export interface FetchEntityProps<M extends Record<string, any> = any> {
|
|
9
9
|
path: string;
|
|
10
10
|
entityId: string;
|
|
11
|
+
databaseId?: string;
|
|
11
12
|
collection?: EntityCollection<M, any>;
|
|
12
13
|
}
|
|
13
14
|
/**
|
|
14
15
|
* @group Datasource
|
|
15
16
|
*/
|
|
16
17
|
export type ListenEntityProps<M extends Record<string, any> = any> = FetchEntityProps<M> & {
|
|
17
|
-
databaseId?: string;
|
|
18
18
|
onUpdate: (entity: Entity<M>) => void;
|
|
19
19
|
onError?: (error: Error) => void;
|
|
20
20
|
};
|
|
@@ -99,7 +99,7 @@ export interface DataSource {
|
|
|
99
99
|
* @param entityId
|
|
100
100
|
* @param collection
|
|
101
101
|
*/
|
|
102
|
-
fetchEntity<M extends Record<string, any> = any>({ path, entityId, collection }: FetchEntityProps<M>): Promise<Entity<M> | undefined>;
|
|
102
|
+
fetchEntity<M extends Record<string, any> = any>({ path, entityId, databaseId, collection }: FetchEntityProps<M>): Promise<Entity<M> | undefined>;
|
|
103
103
|
/**
|
|
104
104
|
* Get realtime updates on one entity.
|
|
105
105
|
* @param path
|
|
@@ -177,10 +177,6 @@ export interface DataSourceDelegate {
|
|
|
177
177
|
* If the data source has been initialised
|
|
178
178
|
*/
|
|
179
179
|
initialised?: boolean;
|
|
180
|
-
/**
|
|
181
|
-
* If the user is authenticated to use the data source
|
|
182
|
-
*/
|
|
183
|
-
authenticated?: boolean;
|
|
184
180
|
/**
|
|
185
181
|
* Fetch data from a collection
|
|
186
182
|
* @param path
|
|
@@ -12,7 +12,7 @@ export interface DialogsController {
|
|
|
12
12
|
* Open a dialog
|
|
13
13
|
* @param props
|
|
14
14
|
*/
|
|
15
|
-
open: (props: DialogControllerEntryProps) => {
|
|
15
|
+
open: <T extends object = object>(props: DialogControllerEntryProps<T>) => {
|
|
16
16
|
closeDialog: () => void;
|
|
17
17
|
};
|
|
18
18
|
}
|
|
@@ -20,7 +20,7 @@ export interface DialogsController {
|
|
|
20
20
|
* Props used to open a side dialog
|
|
21
21
|
* @group Hooks and utilities
|
|
22
22
|
*/
|
|
23
|
-
export interface DialogControllerEntryProps {
|
|
23
|
+
export interface DialogControllerEntryProps<T extends object = object> {
|
|
24
24
|
key: string;
|
|
25
25
|
/**
|
|
26
26
|
* The component type that will be rendered
|
|
@@ -28,5 +28,9 @@ export interface DialogControllerEntryProps {
|
|
|
28
28
|
Component: React.ComponentType<{
|
|
29
29
|
open: boolean;
|
|
30
30
|
closeDialog: () => void;
|
|
31
|
-
}>;
|
|
31
|
+
} & T>;
|
|
32
|
+
/**
|
|
33
|
+
* Props to pass to the dialog component
|
|
34
|
+
*/
|
|
35
|
+
props?: T;
|
|
32
36
|
}
|
package/dist/types/entities.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export type EntityStatus = "new" | "existing" | "copy";
|
|
|
7
7
|
* Representation of an entity fetched from the datasource
|
|
8
8
|
* @group Models
|
|
9
9
|
*/
|
|
10
|
-
export interface Entity<M extends object> {
|
|
10
|
+
export interface Entity<M extends object = any> {
|
|
11
11
|
/**
|
|
12
12
|
* ID of the entity
|
|
13
13
|
*/
|
|
@@ -8,11 +8,20 @@ import { SideEntityController } from "./side_entity_controller";
|
|
|
8
8
|
* An entity action is a custom action that can be performed on an entity.
|
|
9
9
|
* They are displayed in the entity view and in the collection view.
|
|
10
10
|
*/
|
|
11
|
-
export type EntityAction<M extends object = any,
|
|
11
|
+
export type EntityAction<M extends object = any, USER extends User = User> = {
|
|
12
12
|
/**
|
|
13
13
|
* Title of the action
|
|
14
14
|
*/
|
|
15
15
|
name: string;
|
|
16
|
+
/**
|
|
17
|
+
* Key of the action. You only need to provide this if you want to
|
|
18
|
+
* override the default actions.
|
|
19
|
+
* The default actions are:
|
|
20
|
+
* - edit
|
|
21
|
+
* - delete
|
|
22
|
+
* - copy
|
|
23
|
+
*/
|
|
24
|
+
key?: string;
|
|
16
25
|
/**
|
|
17
26
|
* Icon of the action
|
|
18
27
|
*/
|
|
@@ -21,7 +30,7 @@ export type EntityAction<M extends object = any, UserType extends User = User> =
|
|
|
21
30
|
* Callback when the action is clicked
|
|
22
31
|
* @param props
|
|
23
32
|
*/
|
|
24
|
-
onClick: (props: EntityActionClickProps<M,
|
|
33
|
+
onClick: (props: EntityActionClickProps<M, USER>) => Promise<void> | void;
|
|
25
34
|
/**
|
|
26
35
|
* Show this action collapsed in the menu of the collection view.
|
|
27
36
|
* Defaults to true
|
|
@@ -33,9 +42,9 @@ export type EntityAction<M extends object = any, UserType extends User = User> =
|
|
|
33
42
|
*/
|
|
34
43
|
includeInForm?: boolean;
|
|
35
44
|
};
|
|
36
|
-
export type EntityActionClickProps<M extends object,
|
|
45
|
+
export type EntityActionClickProps<M extends object, USER extends User = User> = {
|
|
37
46
|
entity: Entity<M>;
|
|
38
|
-
context: FireCMSContext<
|
|
47
|
+
context: FireCMSContext<USER>;
|
|
39
48
|
fullPath?: string;
|
|
40
49
|
collection?: EntityCollection<M>;
|
|
41
50
|
selectionController?: SelectionController;
|
|
@@ -46,4 +55,5 @@ export type EntityActionClickProps<M extends object, UserType extends User = Use
|
|
|
46
55
|
* If this actions is being called from a side dialog
|
|
47
56
|
*/
|
|
48
57
|
sideEntityController?: SideEntityController;
|
|
58
|
+
openEntityMode: "side_panel" | "full_screen";
|
|
49
59
|
};
|
|
@@ -9,29 +9,29 @@ import { User } from "./user";
|
|
|
9
9
|
* Useful for adding your own logic or blocking the execution of the operation.
|
|
10
10
|
* @group Models
|
|
11
11
|
*/
|
|
12
|
-
export type EntityCallbacks<M extends Record<string, any> = any,
|
|
12
|
+
export type EntityCallbacks<M extends Record<string, any> = any, USER extends User = User> = {
|
|
13
13
|
/**
|
|
14
14
|
* Callback used after fetching data
|
|
15
15
|
* @param entityFetchProps
|
|
16
16
|
*/
|
|
17
|
-
onFetch?(entityFetchProps: EntityOnFetchProps<M,
|
|
17
|
+
onFetch?(entityFetchProps: EntityOnFetchProps<M, USER>): Promise<Entity<M>> | Entity<M>;
|
|
18
18
|
/**
|
|
19
19
|
* Callback used when save is successful
|
|
20
20
|
* @param entitySaveProps
|
|
21
21
|
*/
|
|
22
|
-
onSaveSuccess?(entitySaveProps: EntityOnSaveProps<M,
|
|
22
|
+
onSaveSuccess?(entitySaveProps: EntityOnSaveProps<M, USER>): Promise<void> | void;
|
|
23
23
|
/**
|
|
24
24
|
* Callback used when saving fails
|
|
25
25
|
* @param entitySaveProps
|
|
26
26
|
*/
|
|
27
|
-
onSaveFailure?(entitySaveProps: EntityOnSaveFailureProps<M,
|
|
27
|
+
onSaveFailure?(entitySaveProps: EntityOnSaveFailureProps<M, USER>): Promise<void> | void;
|
|
28
28
|
/**
|
|
29
29
|
* Callback used before saving, you need to return the values that will get
|
|
30
30
|
* saved. If you throw an error in this method the process stops, and an
|
|
31
31
|
* error snackbar gets displayed.
|
|
32
32
|
* @param entitySaveProps
|
|
33
33
|
*/
|
|
34
|
-
onPreSave?(entitySaveProps: EntityOnPreSaveProps<M,
|
|
34
|
+
onPreSave?(entitySaveProps: EntityOnPreSaveProps<M, USER>): Promise<Partial<EntityValues<M>>> | Partial<EntityValues<M>>;
|
|
35
35
|
/**
|
|
36
36
|
* Callback used after the entity is deleted.
|
|
37
37
|
* If you throw an error in this method the process stops, and an
|
|
@@ -39,13 +39,13 @@ export type EntityCallbacks<M extends Record<string, any> = any, UserType extend
|
|
|
39
39
|
*
|
|
40
40
|
* @param entityDeleteProps
|
|
41
41
|
*/
|
|
42
|
-
onPreDelete?(entityDeleteProps: EntityOnDeleteProps<M,
|
|
42
|
+
onPreDelete?(entityDeleteProps: EntityOnDeleteProps<M, USER>): void;
|
|
43
43
|
/**
|
|
44
44
|
* Callback used after the entity is deleted.
|
|
45
45
|
*
|
|
46
46
|
* @param entityDeleteProps
|
|
47
47
|
*/
|
|
48
|
-
onDelete?(entityDeleteProps: EntityOnDeleteProps<M,
|
|
48
|
+
onDelete?(entityDeleteProps: EntityOnDeleteProps<M, USER>): void;
|
|
49
49
|
/**
|
|
50
50
|
* Callback fired when any value in the form changes. You can use it
|
|
51
51
|
* to define the ID of a `new` entity based on the current values.
|
|
@@ -59,11 +59,11 @@ export type EntityCallbacks<M extends Record<string, any> = any, UserType extend
|
|
|
59
59
|
* Parameters passed to hooks when an entity is fetched
|
|
60
60
|
* @group Models
|
|
61
61
|
*/
|
|
62
|
-
export interface EntityOnFetchProps<M extends Record<string, any> = any,
|
|
62
|
+
export interface EntityOnFetchProps<M extends Record<string, any> = any, USER extends User = User> {
|
|
63
63
|
/**
|
|
64
64
|
* Collection of the entity
|
|
65
65
|
*/
|
|
66
|
-
collection: EntityCollection<M,
|
|
66
|
+
collection: EntityCollection<M, USER>;
|
|
67
67
|
/**
|
|
68
68
|
* Full path of the CMS where this collection is being fetched.
|
|
69
69
|
* Might contain unresolved aliases.
|
|
@@ -76,27 +76,27 @@ export interface EntityOnFetchProps<M extends Record<string, any> = any, UserTyp
|
|
|
76
76
|
/**
|
|
77
77
|
* Context of the app status
|
|
78
78
|
*/
|
|
79
|
-
context: FireCMSContext<
|
|
79
|
+
context: FireCMSContext<USER>;
|
|
80
80
|
}
|
|
81
81
|
/**
|
|
82
82
|
* Parameters passed to hooks before an entity is saved
|
|
83
83
|
* @group Models
|
|
84
84
|
*/
|
|
85
|
-
export type EntityOnPreSaveProps<M extends Record<string, any> = any,
|
|
85
|
+
export type EntityOnPreSaveProps<M extends Record<string, any> = any, USER extends User = User> = Omit<EntityOnSaveProps<M, USER>, "entityId"> & {
|
|
86
86
|
entityId?: string;
|
|
87
87
|
};
|
|
88
88
|
/**
|
|
89
89
|
* Parameters passed to hooks before an entity is saved
|
|
90
90
|
* @group Models
|
|
91
91
|
*/
|
|
92
|
-
export type EntityOnSaveFailureProps<M extends Record<string, any> = any,
|
|
92
|
+
export type EntityOnSaveFailureProps<M extends Record<string, any> = any, USER extends User = User> = Omit<EntityOnSaveProps<M, USER>, "entityId"> & {
|
|
93
93
|
entityId?: string;
|
|
94
94
|
};
|
|
95
95
|
/**
|
|
96
96
|
* Parameters passed to hooks when an entity is saved
|
|
97
97
|
* @group Models
|
|
98
98
|
*/
|
|
99
|
-
export interface EntityOnSaveProps<M extends Record<string, any> = any,
|
|
99
|
+
export interface EntityOnSaveProps<M extends Record<string, any> = any, USER extends User = User> {
|
|
100
100
|
/**
|
|
101
101
|
* Resolved collection of the entity
|
|
102
102
|
*/
|
|
@@ -129,13 +129,13 @@ export interface EntityOnSaveProps<M extends Record<string, any> = any, UserType
|
|
|
129
129
|
/**
|
|
130
130
|
* Context of the app status
|
|
131
131
|
*/
|
|
132
|
-
context: FireCMSContext<
|
|
132
|
+
context: FireCMSContext<USER>;
|
|
133
133
|
}
|
|
134
134
|
/**
|
|
135
135
|
* Parameters passed to hooks when an entity is deleted
|
|
136
136
|
* @group Models
|
|
137
137
|
*/
|
|
138
|
-
export interface EntityOnDeleteProps<M extends Record<string, any> = any,
|
|
138
|
+
export interface EntityOnDeleteProps<M extends Record<string, any> = any, USER extends User = User> {
|
|
139
139
|
/**
|
|
140
140
|
* collection of the entity being deleted
|
|
141
141
|
*/
|
|
@@ -155,7 +155,7 @@ export interface EntityOnDeleteProps<M extends Record<string, any> = any, UserTy
|
|
|
155
155
|
/**
|
|
156
156
|
* Context of the app status
|
|
157
157
|
*/
|
|
158
|
-
context: FireCMSContext<
|
|
158
|
+
context: FireCMSContext<USER>;
|
|
159
159
|
}
|
|
160
160
|
/**
|
|
161
161
|
* Parameters passed to hooks when an entity is deleted
|
|
@@ -6,16 +6,16 @@ import { FireCMSContext } from "./firecms_context";
|
|
|
6
6
|
* exports
|
|
7
7
|
* @group Models
|
|
8
8
|
*/
|
|
9
|
-
export interface ExportConfig<
|
|
10
|
-
additionalFields: ExportMappingFunction<
|
|
9
|
+
export interface ExportConfig<USER extends User = User> {
|
|
10
|
+
additionalFields: ExportMappingFunction<USER>[];
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
13
|
* @group Models
|
|
14
14
|
*/
|
|
15
|
-
export interface ExportMappingFunction<
|
|
15
|
+
export interface ExportMappingFunction<USER extends User = User> {
|
|
16
16
|
key: string;
|
|
17
17
|
builder: ({ entity, context }: {
|
|
18
18
|
entity: Entity<any>;
|
|
19
|
-
context: FireCMSContext<
|
|
19
|
+
context: FireCMSContext<USER>;
|
|
20
20
|
}) => Promise<string> | string;
|
|
21
21
|
}
|
package/dist/types/fields.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { CMSType, Property, PropertyOrBuilder } from "./properties";
|
|
2
2
|
import { ResolvedEntityCollection, ResolvedProperty } from "./resolved_entities";
|
|
3
3
|
import { FormexController } from "@firecms/formex";
|
|
4
|
+
import { Entity } from "./entities";
|
|
4
5
|
/**
|
|
5
6
|
* When building a custom field you need to create a React component that takes
|
|
6
7
|
* this interface as props.
|
|
@@ -67,7 +68,8 @@ export interface FieldProps<T extends CMSType = any, CustomProps = any, M extend
|
|
|
67
68
|
*/
|
|
68
69
|
partOfArray?: boolean;
|
|
69
70
|
/**
|
|
70
|
-
*
|
|
71
|
+
* Display the child properties directly, without being wrapped in an
|
|
72
|
+
* extendable panel. Note that this will also hide the title of this property.
|
|
71
73
|
*/
|
|
72
74
|
minimalistView?: boolean;
|
|
73
75
|
/**
|
|
@@ -89,7 +91,15 @@ export interface FieldProps<T extends CMSType = any, CustomProps = any, M extend
|
|
|
89
91
|
/**
|
|
90
92
|
* Size of the field
|
|
91
93
|
*/
|
|
92
|
-
size?: "
|
|
94
|
+
size?: "small" | "medium" | "large";
|
|
95
|
+
/**
|
|
96
|
+
* Some properties might change internal state (like expanding a panel).
|
|
97
|
+
* This function should be called when the internal state changes.
|
|
98
|
+
* This is used to preserve state in array containers.
|
|
99
|
+
*
|
|
100
|
+
* @param property
|
|
101
|
+
*/
|
|
102
|
+
onPropertyChange?: (property: Partial<Property<any>>) => void;
|
|
93
103
|
}
|
|
94
104
|
/**
|
|
95
105
|
* Context passed to custom fields
|
|
@@ -123,6 +133,10 @@ export interface FormContext<M extends Record<string, any> = any> {
|
|
|
123
133
|
* Path this entity is located at
|
|
124
134
|
*/
|
|
125
135
|
path?: string;
|
|
136
|
+
status: "new" | "existing" | "copy";
|
|
137
|
+
entity?: Entity<M>;
|
|
138
|
+
savingError?: Error;
|
|
139
|
+
openEntityMode: "side_panel" | "full_screen";
|
|
126
140
|
/**
|
|
127
141
|
* This is the underlying formex controller that powers the form
|
|
128
142
|
*/
|
|
@@ -162,7 +176,8 @@ export interface PropertyFieldBindingProps<T extends CMSType, M extends Record<s
|
|
|
162
176
|
*/
|
|
163
177
|
partOfArray?: boolean;
|
|
164
178
|
/**
|
|
165
|
-
*
|
|
179
|
+
* Display the child properties directly, without being wrapped in an
|
|
180
|
+
* extendable panel. Note that this will also hide the title of this property.
|
|
166
181
|
*/
|
|
167
182
|
minimalistView?: boolean;
|
|
168
183
|
/**
|
|
@@ -182,5 +197,13 @@ export interface PropertyFieldBindingProps<T extends CMSType, M extends Record<s
|
|
|
182
197
|
/**
|
|
183
198
|
* The size of the field
|
|
184
199
|
*/
|
|
185
|
-
size?: "
|
|
200
|
+
size?: "small" | "medium" | "large";
|
|
201
|
+
/**
|
|
202
|
+
* Some properties might change internal state (like expanding a panel).
|
|
203
|
+
* This function should be called when the internal state changes.
|
|
204
|
+
* This is used to preserve state in array containers.
|
|
205
|
+
*
|
|
206
|
+
* @param property
|
|
207
|
+
*/
|
|
208
|
+
onPropertyChange?: (property: Partial<Property<any>>) => void;
|
|
186
209
|
}
|