@firecms/core 3.0.0-canary.9 → 3.0.0-canary.90
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 +1 -1
- package/dist/app/AppBar.d.ts +12 -0
- package/dist/app/Drawer.d.ts +17 -0
- package/dist/app/Scaffold.d.ts +30 -0
- package/dist/app/index.d.ts +4 -0
- package/dist/app/useApp.d.ts +16 -0
- package/dist/components/CircularProgressCenter.d.ts +1 -1
- package/dist/components/ClearFilterSortButton.d.ts +5 -0
- package/dist/components/EntityCollectionTable/EntityCollectionRowActions.d.ts +11 -12
- package/dist/components/EntityCollectionTable/EntityCollectionTable.d.ts +1 -1
- package/dist/components/EntityCollectionTable/EntityCollectionTableProps.d.ts +5 -3
- package/dist/components/EntityCollectionTable/PropertyTableCell.d.ts +1 -0
- package/dist/components/EntityCollectionTable/column_utils.d.ts +1 -2
- package/dist/components/EntityCollectionTable/fields/TableReferenceField.d.ts +2 -0
- package/dist/components/EntityCollectionTable/internal/CollectionTableToolbar.d.ts +1 -4
- package/dist/components/EntityCollectionTable/internal/EntityTableCell.d.ts +2 -2
- package/dist/components/EntityCollectionTable/internal/popup_field/PopupFormField.d.ts +1 -1
- package/dist/components/EntityCollectionView/EntityCollectionView.d.ts +12 -2
- package/dist/components/EntityCollectionView/EntityCollectionViewStartActions.d.ts +11 -0
- package/dist/components/EntityPreview.d.ts +5 -4
- package/dist/components/ErrorView.d.ts +1 -1
- package/dist/components/HomePage/DefaultHomePage.d.ts +1 -1
- package/dist/components/HomePage/NavigationCardBinding.d.ts +1 -1
- package/dist/components/ReferenceWidget.d.ts +3 -1
- package/dist/components/SelectableTable/SelectableTable.d.ts +1 -1
- package/dist/components/SelectableTable/filters/ReferenceFilterField.d.ts +2 -1
- package/dist/components/VirtualTable/VirtualTableProps.d.ts +15 -12
- package/dist/components/VirtualTable/types.d.ts +3 -3
- package/dist/components/{EntityCollectionTable/internal → common}/default_entity_actions.d.ts +1 -1
- package/dist/components/common/index.d.ts +1 -0
- package/dist/components/common/table_height.d.ts +5 -0
- package/dist/components/common/types.d.ts +4 -6
- package/dist/components/common/useDataSourceEntityCollectionTableController.d.ts +3 -0
- package/dist/components/index.d.ts +2 -1
- package/dist/contexts/AuthControllerContext.d.ts +1 -1
- package/dist/{components/FireCMSAppBar.d.ts → core/DefaultAppBar.d.ts} +6 -9
- package/dist/core/DefaultDrawer.d.ts +19 -0
- package/dist/core/DrawerNavigationItem.d.ts +9 -0
- package/dist/core/EntityEditView.d.ts +17 -3
- package/dist/core/FireCMS.d.ts +1 -1
- package/dist/core/NavigationRoutes.d.ts +3 -3
- package/dist/core/index.d.ts +3 -4
- package/dist/form/PropertiesForm.d.ts +8 -0
- package/dist/form/components/ErrorFocus.d.ts +1 -1
- package/dist/form/components/FieldHelperText.d.ts +3 -3
- package/dist/form/components/StorageItemPreview.d.ts +4 -4
- package/dist/form/field_bindings/MapFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/StorageUploadFieldBinding.d.ts +2 -4
- package/dist/form/index.d.ts +0 -2
- package/dist/hooks/data/delete.d.ts +2 -2
- package/dist/hooks/data/save.d.ts +2 -3
- package/dist/hooks/data/useDataSource.d.ts +1 -1
- package/dist/hooks/data/useEntityFetch.d.ts +3 -3
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/useBuildNavigationController.d.ts +1 -2
- package/dist/hooks/useProjectLog.d.ts +2 -2
- package/dist/hooks/useValidateAuthenticator.d.ts +21 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +15552 -11933
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +19643 -7
- package/dist/index.umd.js.map +1 -1
- package/dist/internal/useBuildDataSource.d.ts +1 -16
- package/dist/internal/useRestoreScroll.d.ts +1 -1
- package/dist/preview/PropertyPreviewProps.d.ts +6 -4
- package/dist/preview/components/ReferencePreview.d.ts +2 -1
- package/dist/preview/components/StorageThumbnail.d.ts +2 -1
- package/dist/preview/components/UrlComponentPreview.d.ts +2 -1
- package/dist/types/auth.d.ts +26 -2
- package/dist/types/collections.d.ts +31 -7
- package/dist/types/datasource.d.ts +34 -20
- package/dist/types/entities.d.ts +5 -1
- package/dist/types/entity_actions.d.ts +14 -0
- package/dist/types/entity_callbacks.d.ts +2 -2
- package/dist/types/fields.d.ts +31 -30
- package/dist/types/index.d.ts +0 -1
- package/dist/types/navigation.d.ts +5 -5
- package/dist/types/plugins.d.ts +16 -6
- package/dist/types/properties.d.ts +17 -4
- package/dist/types/storage.d.ts +11 -3
- package/dist/util/collections.d.ts +1 -1
- package/dist/util/entities.d.ts +1 -1
- package/dist/util/icon_synonyms.d.ts +1 -97
- package/dist/util/icons.d.ts +2 -2
- package/dist/util/navigation_utils.d.ts +2 -2
- package/dist/util/objects.d.ts +1 -1
- package/dist/util/plurals.d.ts +0 -2
- package/dist/util/resolutions.d.ts +13 -13
- package/dist/util/storage.d.ts +23 -2
- package/dist/util/useStorageUploadController.d.ts +1 -1
- package/dist/util/useTraceUpdate.d.ts +1 -0
- package/package.json +130 -119
- package/src/app/AppBar.tsx +18 -0
- package/src/app/Drawer.tsx +25 -0
- package/src/app/Scaffold.tsx +249 -0
- package/src/app/index.ts +4 -0
- package/src/app/useApp.tsx +32 -0
- package/src/components/CircularProgressCenter.tsx +1 -1
- package/src/components/ClearFilterSortButton.tsx +41 -0
- package/src/components/EntityCollectionTable/EntityCollectionRowActions.tsx +9 -18
- package/src/components/EntityCollectionTable/EntityCollectionTable.tsx +21 -20
- package/src/components/EntityCollectionTable/EntityCollectionTableProps.tsx +10 -6
- package/src/components/EntityCollectionTable/PropertyTableCell.tsx +38 -34
- package/src/components/EntityCollectionTable/column_utils.tsx +3 -3
- package/src/components/EntityCollectionTable/fields/TableReferenceField.tsx +11 -2
- package/src/components/EntityCollectionTable/fields/TableStorageUpload.tsx +14 -6
- package/src/components/EntityCollectionTable/internal/CollectionTableToolbar.tsx +29 -34
- package/src/components/EntityCollectionTable/internal/EntityTableCell.tsx +16 -12
- package/src/components/EntityCollectionTable/internal/popup_field/PopupFormField.tsx +4 -5
- package/src/components/EntityCollectionView/EntityCollectionView.tsx +69 -45
- package/src/components/EntityCollectionView/EntityCollectionViewStartActions.tsx +68 -0
- package/src/components/EntityCollectionView/useSelectionController.tsx +19 -7
- package/src/components/EntityPreview.tsx +15 -9
- package/src/components/EntityView.tsx +5 -5
- package/src/components/ErrorView.tsx +1 -1
- package/src/components/HomePage/DefaultHomePage.tsx +3 -3
- package/src/components/HomePage/NavigationCard.tsx +3 -3
- package/src/components/HomePage/NavigationCardBinding.tsx +1 -1
- package/src/components/HomePage/SmallNavigationCard.tsx +5 -5
- package/src/components/PropertyIdCopyTooltipContent.tsx +2 -3
- package/src/components/ReferenceTable/ReferenceSelectionTable.tsx +1 -0
- package/src/components/ReferenceWidget.tsx +22 -12
- package/src/components/SearchIconsView.tsx +5 -5
- package/src/components/SelectableTable/SelectableTable.tsx +7 -7
- package/src/components/SelectableTable/filters/BooleanFilterField.tsx +2 -3
- package/src/components/SelectableTable/filters/DateTimeFilterField.tsx +22 -7
- package/src/components/SelectableTable/filters/ReferenceFilterField.tsx +28 -6
- package/src/components/SelectableTable/filters/StringNumberFilterField.tsx +35 -15
- package/src/components/VirtualTable/VirtualTable.tsx +70 -37
- package/src/components/VirtualTable/VirtualTableCell.tsx +1 -1
- package/src/components/VirtualTable/VirtualTableHeader.tsx +4 -4
- package/src/components/VirtualTable/VirtualTableHeaderRow.tsx +2 -2
- package/src/components/VirtualTable/VirtualTableProps.tsx +18 -14
- package/src/components/VirtualTable/VirtualTableRow.tsx +4 -5
- package/src/components/VirtualTable/fields/VirtualTableDateField.tsx +1 -1
- package/src/components/VirtualTable/types.tsx +2 -3
- package/src/components/{EntityCollectionTable/internal → common}/default_entity_actions.tsx +2 -2
- package/src/components/common/index.ts +1 -0
- package/src/components/{VirtualTable/common.tsx → common/table_height.tsx} +5 -2
- package/src/components/common/types.tsx +4 -6
- package/src/components/common/useColumnsIds.tsx +10 -2
- package/src/components/common/useDataSourceEntityCollectionTableController.tsx +11 -0
- package/src/components/common/useTableSearchHelper.ts +52 -12
- package/src/components/index.tsx +2 -1
- package/src/contexts/AuthControllerContext.tsx +1 -1
- package/src/contexts/DialogsProvider.tsx +2 -2
- package/src/{components/FireCMSAppBar.tsx → core/DefaultAppBar.tsx} +52 -37
- package/src/core/DefaultDrawer.tsx +177 -0
- package/src/core/DrawerNavigationItem.tsx +62 -0
- package/src/core/EntityEditView.tsx +676 -133
- package/src/core/EntitySidePanel.tsx +1 -2
- package/src/core/FireCMS.tsx +39 -44
- package/src/core/NavigationRoutes.tsx +7 -8
- package/src/core/field_configs.tsx +2 -3
- package/src/core/index.tsx +3 -4
- package/src/form/PropertiesForm.tsx +81 -0
- package/src/form/PropertyFieldBinding.tsx +29 -7
- package/src/form/components/FieldHelperText.tsx +3 -3
- package/src/form/components/StorageItemPreview.tsx +20 -11
- package/src/form/components/StorageUploadProgress.tsx +3 -3
- package/src/form/field_bindings/ArrayCustomShapedFieldBinding.tsx +8 -5
- package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +8 -5
- package/src/form/field_bindings/BlockFieldBinding.tsx +2 -2
- package/src/form/field_bindings/KeyValueFieldBinding.tsx +44 -39
- package/src/form/field_bindings/MapFieldBinding.tsx +11 -3
- package/src/form/field_bindings/MarkdownFieldBinding.tsx +2 -2
- package/src/form/field_bindings/ReadOnlyFieldBinding.tsx +2 -9
- package/src/form/field_bindings/ReferenceFieldBinding.tsx +15 -13
- package/src/form/field_bindings/RepeatFieldBinding.tsx +10 -7
- package/src/form/field_bindings/SelectFieldBinding.tsx +3 -3
- package/src/form/field_bindings/StorageUploadFieldBinding.tsx +22 -43
- package/src/form/field_bindings/SwitchFieldBinding.tsx +1 -1
- package/src/form/index.tsx +4 -4
- package/src/form/validation.ts +1 -17
- package/src/hooks/data/delete.ts +3 -3
- package/src/hooks/data/save.ts +4 -2
- package/src/hooks/data/useDataSource.tsx +2 -2
- package/src/hooks/data/useEntityFetch.tsx +3 -3
- package/src/hooks/index.tsx +3 -0
- package/src/hooks/useBuildLocalConfigurationPersistence.tsx +8 -10
- package/src/hooks/useBuildModeController.tsx +11 -5
- package/src/hooks/useBuildNavigationController.tsx +137 -61
- package/src/hooks/useProjectLog.tsx +21 -8
- package/src/hooks/useResolvedNavigationFrom.tsx +1 -1
- package/src/hooks/useValidateAuthenticator.tsx +115 -0
- package/src/index.ts +1 -0
- package/src/internal/useBuildDataSource.ts +56 -49
- package/src/internal/useBuildSideEntityController.tsx +88 -21
- package/src/preview/PropertyPreview.tsx +9 -16
- package/src/preview/PropertyPreviewProps.tsx +4 -8
- package/src/preview/components/BooleanPreview.tsx +4 -2
- package/src/preview/components/EnumValuesChip.tsx +1 -1
- package/src/preview/components/ImagePreview.tsx +21 -33
- package/src/preview/components/ReferencePreview.tsx +23 -23
- package/src/preview/components/StorageThumbnail.tsx +5 -1
- package/src/preview/components/UrlComponentPreview.tsx +44 -11
- package/src/preview/property_previews/ArrayOfMapsPreview.tsx +0 -1
- package/src/preview/property_previews/ArrayOfReferencesPreview.tsx +2 -1
- package/src/preview/property_previews/ArrayOfStorageComponentsPreview.tsx +0 -1
- package/src/preview/property_previews/ArrayOfStringsPreview.tsx +0 -1
- package/src/preview/property_previews/ArrayOneOfPreview.tsx +2 -3
- package/src/preview/property_previews/ArrayPropertyPreview.tsx +2 -3
- package/src/preview/property_previews/MapPropertyPreview.tsx +5 -5
- package/src/preview/property_previews/StringPropertyPreview.tsx +2 -2
- package/src/types/auth.tsx +35 -2
- package/src/types/collections.ts +37 -8
- package/src/types/customization_controller.tsx +0 -1
- package/src/types/datasource.ts +41 -24
- package/src/types/entities.ts +9 -1
- package/src/types/entity_actions.tsx +16 -3
- package/src/types/entity_callbacks.ts +2 -2
- package/src/types/fields.tsx +33 -33
- package/src/types/index.ts +0 -1
- package/src/types/navigation.ts +6 -7
- package/src/types/plugins.tsx +18 -8
- package/src/types/properties.ts +22 -6
- package/src/types/storage.ts +12 -3
- package/src/util/collections.ts +1 -1
- package/src/util/entities.ts +5 -4
- package/src/util/enums.ts +1 -1
- package/src/util/icon_list.ts +2 -2
- package/src/util/icon_synonyms.ts +3 -99
- package/src/util/navigation_utils.ts +6 -6
- package/src/util/objects.ts +25 -28
- package/src/util/permissions.ts +1 -0
- package/src/util/plurals.ts +0 -2
- package/src/util/resolutions.ts +32 -31
- package/src/util/storage.ts +75 -21
- package/src/util/strings.ts +2 -2
- package/src/util/useStorageUploadController.tsx +21 -3
- package/src/util/useTraceUpdate.tsx +2 -1
- package/dist/components/VirtualTable/common.d.ts +0 -2
- package/dist/core/Drawer.d.ts +0 -23
- package/dist/core/Scaffold.d.ts +0 -55
- package/dist/core/SideEntityView.d.ts +0 -7
- package/dist/form/EntityForm.d.ts +0 -77
- package/dist/internal/useBuildCustomizationController.d.ts +0 -2
- package/dist/internal/useLocaleConfig.d.ts +0 -1
- package/dist/types/appcheck.d.ts +0 -26
- package/src/core/Drawer.tsx +0 -191
- package/src/core/Scaffold.tsx +0 -281
- package/src/core/SideEntityView.tsx +0 -38
- package/src/form/EntityForm.tsx +0 -728
- package/src/internal/useBuildCustomizationController.tsx +0 -5
- package/src/internal/useLocaleConfig.tsx +0 -18
- package/src/types/appcheck.ts +0 -29
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DataSource, DataSourceDelegate,
|
|
1
|
+
import { DataSource, DataSourceDelegate, NavigationController, PropertyConfig } from "../types";
|
|
2
2
|
/**
|
|
3
3
|
* Use this hook to build a {@link DataSource} based on Firestore
|
|
4
4
|
* @param firebaseApp
|
|
@@ -9,18 +9,3 @@ export declare function useBuildDataSource({ delegate, propertyConfigs, navigati
|
|
|
9
9
|
propertyConfigs?: Record<string, PropertyConfig>;
|
|
10
10
|
navigationController: NavigationController;
|
|
11
11
|
}): DataSource;
|
|
12
|
-
/**
|
|
13
|
-
* Recursive function that converts Firestore data types into CMS or plain
|
|
14
|
-
* JS types.
|
|
15
|
-
* FireCMS uses Javascript dates internally instead of Firestore timestamps.
|
|
16
|
-
* This makes it easier to interact with the rest of the libraries and
|
|
17
|
-
* bindings.
|
|
18
|
-
* Also, Firestore references are replaced with {@link EntityReference}
|
|
19
|
-
* @param data
|
|
20
|
-
* @param buildReference
|
|
21
|
-
* @param buildGeoPoint
|
|
22
|
-
* @param buildDate
|
|
23
|
-
* @param buildDelete
|
|
24
|
-
* @group Firestore
|
|
25
|
-
*/
|
|
26
|
-
export declare function cmsToDelegateModel(data: any, buildReference: (reference: EntityReference) => any, buildGeoPoint: (geoPoint: GeoPoint) => any, buildDate: (date: Date) => any, buildDelete: () => any): any;
|
|
@@ -6,7 +6,7 @@ export type PreviewSize = "medium" | "small" | "tiny";
|
|
|
6
6
|
/**
|
|
7
7
|
* @group Preview components
|
|
8
8
|
*/
|
|
9
|
-
export interface PropertyPreviewProps<T extends CMSType = any, CustomProps = any
|
|
9
|
+
export interface PropertyPreviewProps<T extends CMSType = any, CustomProps = any> {
|
|
10
10
|
/**
|
|
11
11
|
* Name of the property
|
|
12
12
|
*/
|
|
@@ -19,9 +19,6 @@ export interface PropertyPreviewProps<T extends CMSType = any, CustomProps = any
|
|
|
19
19
|
* Property this display is related to
|
|
20
20
|
*/
|
|
21
21
|
property: Property<T> | ResolvedProperty<T>;
|
|
22
|
-
/**
|
|
23
|
-
* Click handler
|
|
24
|
-
*/
|
|
25
22
|
/**
|
|
26
23
|
* Desired size of the preview, depending on the context.
|
|
27
24
|
*/
|
|
@@ -40,4 +37,9 @@ export interface PropertyPreviewProps<T extends CMSType = any, CustomProps = any
|
|
|
40
37
|
* Additional properties set by the developer
|
|
41
38
|
*/
|
|
42
39
|
customProps?: CustomProps;
|
|
40
|
+
/**
|
|
41
|
+
* If the preview should be interactive or not.
|
|
42
|
+
* This applies only to videos.
|
|
43
|
+
*/
|
|
44
|
+
interactive?: boolean;
|
|
43
45
|
}
|
|
@@ -8,7 +8,8 @@ export type ReferencePreviewProps = {
|
|
|
8
8
|
previewProperties?: string[];
|
|
9
9
|
onClick?: (e: React.SyntheticEvent) => void;
|
|
10
10
|
hover?: boolean;
|
|
11
|
-
|
|
11
|
+
includeEntityLink?: boolean;
|
|
12
|
+
includeId?: boolean;
|
|
12
13
|
};
|
|
13
14
|
/**
|
|
14
15
|
* @group Preview components
|
|
@@ -4,10 +4,11 @@ type StorageThumbnailProps = {
|
|
|
4
4
|
storagePathOrDownloadUrl: string;
|
|
5
5
|
storeUrl: boolean;
|
|
6
6
|
size: PreviewSize;
|
|
7
|
+
interactive?: boolean;
|
|
7
8
|
};
|
|
8
9
|
/**
|
|
9
10
|
* @group Preview components
|
|
10
11
|
*/
|
|
11
12
|
export declare const StorageThumbnail: React.FunctionComponent<StorageThumbnailProps>;
|
|
12
|
-
export declare function StorageThumbnailInternal({ storeUrl, storagePathOrDownloadUrl, size }: StorageThumbnailProps): import("react/jsx-runtime").JSX.Element | null;
|
|
13
|
+
export declare function StorageThumbnailInternal({ storeUrl, interactive, storagePathOrDownloadUrl, size }: StorageThumbnailProps): import("react/jsx-runtime").JSX.Element | null;
|
|
13
14
|
export {};
|
|
@@ -4,9 +4,10 @@ import { PreviewSize } from "../PropertyPreviewProps";
|
|
|
4
4
|
/**
|
|
5
5
|
* @group Preview components
|
|
6
6
|
*/
|
|
7
|
-
export declare function UrlComponentPreview({ url, previewType, size, hint }: {
|
|
7
|
+
export declare function UrlComponentPreview({ url, previewType, size, hint, interactive }: {
|
|
8
8
|
url: string;
|
|
9
9
|
previewType?: PreviewType;
|
|
10
10
|
size: PreviewSize;
|
|
11
11
|
hint?: string;
|
|
12
|
+
interactive?: boolean;
|
|
12
13
|
}): React.ReactElement;
|
package/dist/types/auth.d.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { User } from "./user";
|
|
2
2
|
import { Role } from "./roles";
|
|
3
|
+
import { DataSourceDelegate } from "./datasource";
|
|
4
|
+
import { StorageSource } from "./storage";
|
|
3
5
|
/**
|
|
4
6
|
* Controller for retrieving the logged user or performing auth related operations.
|
|
5
7
|
* Note that if you are implementing your AuthController, you probably will want
|
|
6
8
|
* to do it as the result of a hook.
|
|
7
9
|
* @group Hooks and utilities
|
|
8
10
|
*/
|
|
9
|
-
export type AuthController<UserType extends User =
|
|
11
|
+
export type AuthController<UserType extends User = any, ExtraData = any> = {
|
|
10
12
|
/**
|
|
11
13
|
* The user currently logged in
|
|
12
14
|
* The values can be: the user object, null if they skipped login
|
|
@@ -30,7 +32,7 @@ export type AuthController<UserType extends User = User, ExtraData extends any =
|
|
|
30
32
|
/**
|
|
31
33
|
* Sign out
|
|
32
34
|
*/
|
|
33
|
-
signOut: () => void
|
|
35
|
+
signOut: () => Promise<void>;
|
|
34
36
|
/**
|
|
35
37
|
* Error initializing the authentication
|
|
36
38
|
*/
|
|
@@ -50,3 +52,25 @@ export type AuthController<UserType extends User = User, ExtraData extends any =
|
|
|
50
52
|
extra: ExtraData;
|
|
51
53
|
setExtra: (extra: ExtraData) => void;
|
|
52
54
|
};
|
|
55
|
+
/**
|
|
56
|
+
* Implement this function to allow access to specific users.
|
|
57
|
+
* @group Hooks and utilities
|
|
58
|
+
*/
|
|
59
|
+
export type Authenticator<UserType extends User = User, Controller extends AuthController<UserType> = AuthController<UserType>> = (props: {
|
|
60
|
+
/**
|
|
61
|
+
* Logged-in user or null
|
|
62
|
+
*/
|
|
63
|
+
user: UserType | null;
|
|
64
|
+
/**
|
|
65
|
+
* AuthController
|
|
66
|
+
*/
|
|
67
|
+
authController: Controller;
|
|
68
|
+
/**
|
|
69
|
+
* Connector to your database, e.g. your Firestore database
|
|
70
|
+
*/
|
|
71
|
+
dataSourceDelegate: DataSourceDelegate;
|
|
72
|
+
/**
|
|
73
|
+
* Used storage implementation
|
|
74
|
+
*/
|
|
75
|
+
storageSource: StorageSource;
|
|
76
|
+
}) => boolean | Promise<boolean>;
|
|
@@ -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, UserType extends User =
|
|
19
|
+
export interface EntityCollection<M extends Record<string, any> = any, UserType 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,
|
|
@@ -94,8 +94,12 @@ export interface EntityCollection<M extends Record<string, any> = any, UserType
|
|
|
94
94
|
* `subcollection:`. e.g. `subcollection:orders`.
|
|
95
95
|
* - If you are using a collection group, you will also have an
|
|
96
96
|
* additional `collectionGroupParent` column.
|
|
97
|
+
* You can use this prop to hide some properties from the table view.
|
|
98
|
+
* Note that if you set this prop, other ways to hide fields, like
|
|
99
|
+
* `hidden` in the property definition,will be ignored.
|
|
100
|
+
* `propertiesOrder` has precedence over `hidden`.
|
|
97
101
|
*/
|
|
98
|
-
propertiesOrder?: Extract<keyof M, string>[];
|
|
102
|
+
propertiesOrder?: (Extract<keyof M, string> | `subcollection:${string}`)[];
|
|
99
103
|
/**
|
|
100
104
|
* If enabled, content is loaded in batches. If `false` all entities in the
|
|
101
105
|
* collection are loaded.
|
|
@@ -128,7 +132,7 @@ export interface EntityCollection<M extends Record<string, any> = any, UserType
|
|
|
128
132
|
* is being created, updated or deleted.
|
|
129
133
|
* Useful for adding your own logic or blocking the execution of the operation.
|
|
130
134
|
*/
|
|
131
|
-
callbacks?: EntityCallbacks<M>;
|
|
135
|
+
callbacks?: EntityCallbacks<M, UserType>;
|
|
132
136
|
/**
|
|
133
137
|
* Builder for rendering additional components such as buttons in the
|
|
134
138
|
* collection toolbar
|
|
@@ -253,7 +257,14 @@ export interface EntityCollection<M extends Record<string, any> = any, UserType
|
|
|
253
257
|
* are writing custom code
|
|
254
258
|
*/
|
|
255
259
|
ownerId?: string;
|
|
260
|
+
/**
|
|
261
|
+
* Overrides for the entity view, like the data source or the storage source.
|
|
262
|
+
*/
|
|
256
263
|
overrides?: EntityOverrides;
|
|
264
|
+
/**
|
|
265
|
+
* Width of the side dialog (in pixels) when opening an entity in this collection.
|
|
266
|
+
*/
|
|
267
|
+
sideDialogWidth?: number | string;
|
|
257
268
|
}
|
|
258
269
|
/**
|
|
259
270
|
* Parameter passed to the `Actions` prop in the collection configuration.
|
|
@@ -302,14 +313,13 @@ export interface CollectionActionsProps<M extends Record<string, any> = any, Use
|
|
|
302
313
|
/**
|
|
303
314
|
* Use this controller to retrieve the selected entities or modify them in
|
|
304
315
|
* an {@link EntityCollection}
|
|
305
|
-
* If you want to pass a `SelectionController` to
|
|
306
316
|
* @group Models
|
|
307
317
|
*/
|
|
308
318
|
export type SelectionController<M extends Record<string, any> = any> = {
|
|
309
319
|
selectedEntities: Entity<M>[];
|
|
310
320
|
setSelectedEntities: Dispatch<SetStateAction<Entity<M>[]>>;
|
|
311
321
|
isEntitySelected: (entity: Entity<M>) => boolean;
|
|
312
|
-
toggleEntitySelection: (entity: Entity<M
|
|
322
|
+
toggleEntitySelection: (entity: Entity<M>, newSelectedState?: boolean) => void;
|
|
313
323
|
};
|
|
314
324
|
/**
|
|
315
325
|
* Filter conditions in a `Query.where()` clause are specified using the
|
|
@@ -382,7 +392,7 @@ export interface AdditionalFieldDelegate<M extends Record<string, any> = any, Us
|
|
|
382
392
|
*/
|
|
383
393
|
value?: (props: {
|
|
384
394
|
entity: Entity<M>;
|
|
385
|
-
context: FireCMSContext
|
|
395
|
+
context: FireCMSContext<any>;
|
|
386
396
|
}) => string | number | Promise<string | number> | undefined;
|
|
387
397
|
}
|
|
388
398
|
/**
|
|
@@ -391,8 +401,22 @@ export interface AdditionalFieldDelegate<M extends Record<string, any> = any, Us
|
|
|
391
401
|
* @group Models
|
|
392
402
|
*/
|
|
393
403
|
export type EntityCustomView<M extends Record<string, any> = any> = {
|
|
404
|
+
/**
|
|
405
|
+
* Key of this custom view.
|
|
406
|
+
*/
|
|
394
407
|
key: string;
|
|
408
|
+
/**
|
|
409
|
+
* Name of this custom view.
|
|
410
|
+
*/
|
|
395
411
|
name: string;
|
|
412
|
+
/**
|
|
413
|
+
* If set to true, the actions of the entity will be included in the
|
|
414
|
+
* bottom of the panel (save buttons, delete buttons, etc.)
|
|
415
|
+
*/
|
|
416
|
+
includeActions?: boolean;
|
|
417
|
+
/**
|
|
418
|
+
* Builder for rendering the custom view
|
|
419
|
+
*/
|
|
396
420
|
Builder?: React.ComponentType<EntityCustomViewParams<M>>;
|
|
397
421
|
};
|
|
398
422
|
/**
|
|
@@ -445,7 +469,7 @@ export type EntityTableController<M extends Record<string, any> = any> = {
|
|
|
445
469
|
filterValues?: FilterValues<Extract<keyof M, string>>;
|
|
446
470
|
setFilterValues?: (filterValues: FilterValues<Extract<keyof M, string>>) => void;
|
|
447
471
|
sortBy?: [Extract<keyof M, string>, "asc" | "desc"];
|
|
448
|
-
setSortBy?: (sortBy
|
|
472
|
+
setSortBy?: (sortBy?: [Extract<keyof M, string>, "asc" | "desc"]) => void;
|
|
449
473
|
searchString?: string;
|
|
450
474
|
setSearchString?: (searchString?: string) => void;
|
|
451
475
|
clearFilter?: () => void;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { Entity,
|
|
1
|
+
import { Entity, EntityStatus, EntityValues } from "./entities";
|
|
2
2
|
import { EntityCollection, FilterValues } from "./collections";
|
|
3
3
|
import { ResolvedEntityCollection } from "./resolved_entities";
|
|
4
|
+
import { FireCMSContext } from "./firecms_context";
|
|
4
5
|
/**
|
|
5
6
|
* @group Datasource
|
|
6
7
|
*/
|
|
7
8
|
export interface FetchEntityProps<M extends Record<string, any> = any> {
|
|
8
9
|
path: string;
|
|
9
10
|
entityId: string;
|
|
10
|
-
collection?: EntityCollection<M>;
|
|
11
|
+
collection?: EntityCollection<M, any>;
|
|
11
12
|
}
|
|
12
13
|
/**
|
|
13
14
|
* @group Datasource
|
|
@@ -54,9 +55,8 @@ export interface DeleteEntityProps<M extends Record<string, any> = any> {
|
|
|
54
55
|
entity: Entity<M>;
|
|
55
56
|
}
|
|
56
57
|
/**
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
* A Firestore implementation of this interface can be found in {@link useFirestoreDataSource}
|
|
58
|
+
* Component in charge of communicating with the data source.
|
|
59
|
+
* Usually you won't need to implement this interface, but a {@link DataSourceDelegate} instead.
|
|
60
60
|
* @group Datasource
|
|
61
61
|
*/
|
|
62
62
|
export interface DataSource {
|
|
@@ -145,6 +145,17 @@ export interface DataSource {
|
|
|
145
145
|
* @param props
|
|
146
146
|
*/
|
|
147
147
|
isFilterCombinationValid?(props: FilterCombinationValidProps): boolean;
|
|
148
|
+
/**
|
|
149
|
+
* Called when the user clicks on the search bar in a collection view.
|
|
150
|
+
* Useful for initializing a text search index.
|
|
151
|
+
* @param props
|
|
152
|
+
*/
|
|
153
|
+
initTextSearch?: (props: {
|
|
154
|
+
context: FireCMSContext;
|
|
155
|
+
path: string;
|
|
156
|
+
collection: EntityCollection;
|
|
157
|
+
parentCollectionIds?: string[];
|
|
158
|
+
}) => Promise<boolean>;
|
|
148
159
|
}
|
|
149
160
|
export type FilterCombinationValidProps = {
|
|
150
161
|
path: string;
|
|
@@ -160,6 +171,14 @@ export type ListenCollectionDelegateProps<M extends Record<string, any> = any> =
|
|
|
160
171
|
isCollectionGroup?: boolean;
|
|
161
172
|
};
|
|
162
173
|
export interface DataSourceDelegate {
|
|
174
|
+
/**
|
|
175
|
+
* Key that identifies this data source delegate
|
|
176
|
+
*/
|
|
177
|
+
key: string;
|
|
178
|
+
/**
|
|
179
|
+
* If the data source has been initialised
|
|
180
|
+
*/
|
|
181
|
+
initialised?: boolean;
|
|
163
182
|
/**
|
|
164
183
|
* Fetch data from a collection
|
|
165
184
|
* @param path
|
|
@@ -208,8 +227,8 @@ export interface DataSourceDelegate {
|
|
|
208
227
|
/**
|
|
209
228
|
* Save entity to the specified path
|
|
210
229
|
* @param path
|
|
211
|
-
* @param
|
|
212
|
-
* @param
|
|
230
|
+
* @param entityId
|
|
231
|
+
* @param values
|
|
213
232
|
* @param status
|
|
214
233
|
*/
|
|
215
234
|
saveEntity<M extends Record<string, any> = any>({ path, entityId, values, status }: SaveEntityDelegateProps<M>): Promise<Entity<M>>;
|
|
@@ -241,22 +260,17 @@ export interface DataSourceDelegate {
|
|
|
241
260
|
* @param props
|
|
242
261
|
*/
|
|
243
262
|
isFilterCombinationValid?(props: Omit<FilterCombinationValidProps, "collection">): boolean;
|
|
244
|
-
/**
|
|
245
|
-
* Convert a FireCMS reference to a reference that can be used by the datasource
|
|
246
|
-
* @param reference
|
|
247
|
-
*/
|
|
248
|
-
buildReference: (reference: EntityReference) => any;
|
|
249
|
-
/**
|
|
250
|
-
* Convert a FireCMS GeoPoint to a GeoPoint that can be used by the datasource
|
|
251
|
-
* @param geoPoint
|
|
252
|
-
*/
|
|
253
|
-
buildGeoPoint: (geoPoint: GeoPoint) => any;
|
|
254
263
|
/**
|
|
255
264
|
* Get the object to generate the current time in the datasource
|
|
256
265
|
*/
|
|
257
|
-
currentTime()
|
|
258
|
-
buildDate: (date: Date) => any;
|
|
259
|
-
buildDeleteFieldValue: () => any;
|
|
266
|
+
currentTime?: () => any;
|
|
260
267
|
delegateToCMSModel: (data: any) => any;
|
|
268
|
+
cmsToDelegateModel: (data: any) => any;
|
|
261
269
|
setDateToMidnight: (input?: any) => any;
|
|
270
|
+
initTextSearch?: (props: {
|
|
271
|
+
context: FireCMSContext;
|
|
272
|
+
path: string;
|
|
273
|
+
collection: EntityCollection;
|
|
274
|
+
parentCollectionIds?: string[];
|
|
275
|
+
}) => Promise<boolean>;
|
|
262
276
|
}
|
package/dist/types/entities.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ export type EntityValues<M extends object> = M;
|
|
|
31
31
|
/**
|
|
32
32
|
* Class used to create a reference to an entity in a different path
|
|
33
33
|
*/
|
|
34
|
-
export declare class EntityReference
|
|
34
|
+
export declare class EntityReference {
|
|
35
35
|
/**
|
|
36
36
|
* ID of the entity
|
|
37
37
|
*/
|
|
@@ -56,3 +56,7 @@ export declare class GeoPoint {
|
|
|
56
56
|
readonly longitude: number;
|
|
57
57
|
constructor(latitude: number, longitude: number);
|
|
58
58
|
}
|
|
59
|
+
export declare class Vector {
|
|
60
|
+
readonly value: number[];
|
|
61
|
+
constructor(value: number[]);
|
|
62
|
+
}
|
|
@@ -4,9 +4,23 @@ import { Entity } from "./entities";
|
|
|
4
4
|
import { EntityCollection, SelectionController } from "./collections";
|
|
5
5
|
import { User } from "./user";
|
|
6
6
|
import { SideEntityController } from "./side_entity_controller";
|
|
7
|
+
/**
|
|
8
|
+
* An entity action is a custom action that can be performed on an entity.
|
|
9
|
+
* They are displayed in the entity view and in the collection view.
|
|
10
|
+
*/
|
|
7
11
|
export type EntityAction<M extends object = any, UserType extends User = User> = {
|
|
12
|
+
/**
|
|
13
|
+
* Title of the action
|
|
14
|
+
*/
|
|
8
15
|
name: string;
|
|
16
|
+
/**
|
|
17
|
+
* Icon of the action
|
|
18
|
+
*/
|
|
9
19
|
icon?: React.ReactElement;
|
|
20
|
+
/**
|
|
21
|
+
* Callback when the action is clicked
|
|
22
|
+
* @param props
|
|
23
|
+
*/
|
|
10
24
|
onClick: (props: EntityActionClickProps<M, UserType>) => Promise<void> | void;
|
|
11
25
|
/**
|
|
12
26
|
* Show this action collapsed in the menu of the collection view.
|
|
@@ -63,7 +63,7 @@ export interface EntityOnFetchProps<M extends Record<string, any> = any, UserTyp
|
|
|
63
63
|
/**
|
|
64
64
|
* Collection of the entity
|
|
65
65
|
*/
|
|
66
|
-
collection: EntityCollection<M>;
|
|
66
|
+
collection: EntityCollection<M, UserType>;
|
|
67
67
|
/**
|
|
68
68
|
* Full path of the CMS where this collection is being fetched.
|
|
69
69
|
* Might contain unresolved aliases.
|
|
@@ -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<UserType>;
|
|
159
159
|
}
|
|
160
160
|
/**
|
|
161
161
|
* Parameters passed to hooks when an entity is deleted
|
package/dist/types/fields.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { EntityValues } from "./entities";
|
|
2
1
|
import { CMSType, PropertyOrBuilder } from "./properties";
|
|
3
2
|
import { ResolvedEntityCollection, ResolvedProperty } from "./resolved_entities";
|
|
3
|
+
import { FormexController } from "@firecms/formex";
|
|
4
4
|
/**
|
|
5
5
|
* When building a custom field you need to create a React component that takes
|
|
6
6
|
* this interface as props.
|
|
@@ -17,9 +17,6 @@ export interface FieldProps<T extends CMSType = any, CustomProps = any, M extend
|
|
|
17
17
|
* Current value of this field
|
|
18
18
|
*/
|
|
19
19
|
value: T;
|
|
20
|
-
/**
|
|
21
|
-
* Initial value of this field
|
|
22
|
-
*/
|
|
23
20
|
/**
|
|
24
21
|
* Set value of field directly
|
|
25
22
|
*/
|
|
@@ -34,24 +31,24 @@ export interface FieldProps<T extends CMSType = any, CustomProps = any, M extend
|
|
|
34
31
|
/**
|
|
35
32
|
* Is the form currently submitting
|
|
36
33
|
*/
|
|
37
|
-
isSubmitting
|
|
34
|
+
isSubmitting?: boolean;
|
|
38
35
|
/**
|
|
39
36
|
* Should this field show the error indicator.
|
|
40
37
|
* Note that there might be an error (like an empty field that should be
|
|
41
38
|
* filled) but we don't want to show the error until the user has tried
|
|
42
39
|
* saving.
|
|
43
40
|
*/
|
|
44
|
-
showError
|
|
41
|
+
showError?: boolean;
|
|
45
42
|
/**
|
|
46
43
|
* Is there an error in this field. The error field has the same shape as
|
|
47
44
|
* the field, replacing values with a string containing the error.
|
|
48
45
|
* It takes the value `null` if there is no error
|
|
49
46
|
*/
|
|
50
|
-
error
|
|
47
|
+
error?: any | null;
|
|
51
48
|
/**
|
|
52
49
|
* Has this field been touched
|
|
53
50
|
*/
|
|
54
|
-
touched
|
|
51
|
+
touched?: boolean;
|
|
55
52
|
/**
|
|
56
53
|
* Property related to this field
|
|
57
54
|
*/
|
|
@@ -59,32 +56,32 @@ export interface FieldProps<T extends CMSType = any, CustomProps = any, M extend
|
|
|
59
56
|
/**
|
|
60
57
|
* Should this field include a description
|
|
61
58
|
*/
|
|
62
|
-
includeDescription
|
|
59
|
+
includeDescription?: boolean;
|
|
63
60
|
/**
|
|
64
61
|
* Flag to indicate that the underlying value has been updated in the
|
|
65
62
|
* datasource
|
|
66
63
|
*/
|
|
67
|
-
underlyingValueHasChanged
|
|
64
|
+
underlyingValueHasChanged?: boolean;
|
|
68
65
|
/**
|
|
69
66
|
* Is this field part of an array
|
|
70
67
|
*/
|
|
71
|
-
partOfArray
|
|
68
|
+
partOfArray?: boolean;
|
|
72
69
|
/**
|
|
73
70
|
* Is this field part of a block (oneOf array)
|
|
74
71
|
*/
|
|
75
|
-
partOfBlock
|
|
72
|
+
partOfBlock?: boolean;
|
|
76
73
|
/**
|
|
77
74
|
* Is this field being rendered in the entity table popup
|
|
78
75
|
*/
|
|
79
|
-
tableMode
|
|
76
|
+
tableMode?: boolean;
|
|
80
77
|
/**
|
|
81
78
|
* Should this field autofocus on mount
|
|
82
79
|
*/
|
|
83
|
-
autoFocus
|
|
80
|
+
autoFocus?: boolean;
|
|
84
81
|
/**
|
|
85
82
|
* Additional properties set by the developer
|
|
86
83
|
*/
|
|
87
|
-
customProps
|
|
84
|
+
customProps?: CustomProps;
|
|
88
85
|
/**
|
|
89
86
|
* Additional values related to the state of the form or the entity
|
|
90
87
|
*/
|
|
@@ -92,7 +89,7 @@ export interface FieldProps<T extends CMSType = any, CustomProps = any, M extend
|
|
|
92
89
|
/**
|
|
93
90
|
* Flag to indicate if this field should be disabled
|
|
94
91
|
*/
|
|
95
|
-
disabled
|
|
92
|
+
disabled?: boolean;
|
|
96
93
|
}
|
|
97
94
|
/**
|
|
98
95
|
* Context passed to custom fields
|
|
@@ -100,13 +97,24 @@ export interface FieldProps<T extends CMSType = any, CustomProps = any, M extend
|
|
|
100
97
|
*/
|
|
101
98
|
export interface FormContext<M extends Record<string, any> = any> {
|
|
102
99
|
/**
|
|
103
|
-
*
|
|
100
|
+
* Current values of the entity
|
|
104
101
|
*/
|
|
105
|
-
|
|
102
|
+
values: M;
|
|
106
103
|
/**
|
|
107
|
-
*
|
|
104
|
+
* Update the value of a field
|
|
105
|
+
* @param key
|
|
106
|
+
* @param value
|
|
107
|
+
* @param shouldValidate
|
|
108
|
+
*/
|
|
109
|
+
setFieldValue: (key: string, value: any, shouldValidate?: boolean) => void;
|
|
110
|
+
/**
|
|
111
|
+
* Save the entity.
|
|
112
|
+
*/
|
|
113
|
+
save: (values: M) => void;
|
|
114
|
+
/**
|
|
115
|
+
* Collection of the entity being modified
|
|
108
116
|
*/
|
|
109
|
-
|
|
117
|
+
collection?: ResolvedEntityCollection<M>;
|
|
110
118
|
/**
|
|
111
119
|
* Entity id, it can be null if it's a new entity
|
|
112
120
|
*/
|
|
@@ -114,18 +122,11 @@ export interface FormContext<M extends Record<string, any> = any> {
|
|
|
114
122
|
/**
|
|
115
123
|
* Path this entity is located at
|
|
116
124
|
*/
|
|
117
|
-
path
|
|
118
|
-
/**
|
|
119
|
-
* Update the value of a field
|
|
120
|
-
* @param key
|
|
121
|
-
* @param value
|
|
122
|
-
* @param shouldValidate
|
|
123
|
-
*/
|
|
124
|
-
setFieldValue: (key: string, value: any, shouldValidate?: boolean) => void;
|
|
125
|
+
path?: string;
|
|
125
126
|
/**
|
|
126
|
-
*
|
|
127
|
+
* This is the underlying formex controller that powers the form
|
|
127
128
|
*/
|
|
128
|
-
|
|
129
|
+
formex: FormexController<M>;
|
|
129
130
|
}
|
|
130
131
|
/**
|
|
131
132
|
* In case you need to render a field bound to a Property inside your
|
package/dist/types/index.d.ts
CHANGED
|
@@ -23,7 +23,6 @@ export * from "./plugins";
|
|
|
23
23
|
export * from "./analytics";
|
|
24
24
|
export * from "./firecms";
|
|
25
25
|
export * from "./roles";
|
|
26
|
-
export * from "./appcheck";
|
|
27
26
|
export * from "./export_import";
|
|
28
27
|
export * from "./modify_collections";
|
|
29
28
|
export * from "./analytics_controller";
|
|
@@ -6,7 +6,7 @@ import { EntityReference } from "./entities";
|
|
|
6
6
|
* attributes.
|
|
7
7
|
* @group Models
|
|
8
8
|
*/
|
|
9
|
-
export type NavigationController = {
|
|
9
|
+
export type NavigationController<EC extends EntityCollection = EntityCollection<any>> = {
|
|
10
10
|
/**
|
|
11
11
|
* List of the mapped collections in the CMS.
|
|
12
12
|
* Each entry relates to a collection in the root database.
|
|
@@ -47,15 +47,15 @@ export type NavigationController = {
|
|
|
47
47
|
* Get the collection configuration for a given path.
|
|
48
48
|
* The collection is resolved from the given path or alias.
|
|
49
49
|
*/
|
|
50
|
-
getCollection:
|
|
50
|
+
getCollection: (pathOrId: string, includeUserOverride?: boolean) => EC | undefined;
|
|
51
51
|
/**
|
|
52
|
-
* Get the collection configuration from its parent
|
|
52
|
+
* Get the collection configuration from its parent ids.
|
|
53
53
|
*/
|
|
54
|
-
getCollectionFromIds:
|
|
54
|
+
getCollectionFromIds: (ids: string[]) => EC | undefined;
|
|
55
55
|
/**
|
|
56
56
|
* Get the collection configuration from its parent path segments.
|
|
57
57
|
*/
|
|
58
|
-
getCollectionFromPaths:
|
|
58
|
+
getCollectionFromPaths: (pathSegments: string[]) => EC | undefined;
|
|
59
59
|
/**
|
|
60
60
|
* Default path under the navigation routes of the CMS will be created
|
|
61
61
|
*/
|
package/dist/types/plugins.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { PropsWithChildren } from "react";
|
|
2
2
|
import { FireCMSContext } from "./firecms_context";
|
|
3
|
-
import { CollectionActionsProps, EntityCollection } from "./collections";
|
|
3
|
+
import { CollectionActionsProps, EntityCollection, EntityTableController } from "./collections";
|
|
4
4
|
import { User } from "./user";
|
|
5
5
|
import { FieldProps, FormContext } from "./fields";
|
|
6
6
|
import { CMSType, Property } from "./properties";
|
|
@@ -11,11 +11,11 @@ import { ResolvedProperty } from "./resolved_entities";
|
|
|
11
11
|
* NOTE: This is a work in progress and the API is not stable yet.
|
|
12
12
|
* @group Core
|
|
13
13
|
*/
|
|
14
|
-
export type FireCMSPlugin<PROPS = any, FORM_PROPS = any, EC extends EntityCollection = EntityCollection, COL_ACTIONS_PROPS = any> = {
|
|
14
|
+
export type FireCMSPlugin<PROPS = any, FORM_PROPS = any, EC extends EntityCollection = EntityCollection, COL_ACTIONS_PROPS = any, COL_ACTIONS_START__PROPS = any> = {
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
16
|
+
* Key of the plugin. This is used to identify the plugin in the CMS.
|
|
17
17
|
*/
|
|
18
|
-
|
|
18
|
+
key: string;
|
|
19
19
|
/**
|
|
20
20
|
* If this flag is set to true, no content will be shown in the CMS
|
|
21
21
|
* until the plugin is fully loaded.
|
|
@@ -78,6 +78,14 @@ export type FireCMSPlugin<PROPS = any, FORM_PROPS = any, EC extends EntityCollec
|
|
|
78
78
|
*/
|
|
79
79
|
CollectionActions?: React.ComponentType<CollectionActionsProps<any, any, EC> & COL_ACTIONS_PROPS> | React.ComponentType<CollectionActionsProps<any, any, EC> & COL_ACTIONS_PROPS>[];
|
|
80
80
|
collectionActionsProps?: COL_ACTIONS_PROPS;
|
|
81
|
+
CollectionActionsStart?: React.ComponentType<CollectionActionsProps<any, any, EC> & COL_ACTIONS_START__PROPS> | React.ComponentType<CollectionActionsProps<any, any, EC> & COL_ACTIONS_START__PROPS>[];
|
|
82
|
+
collectionActionsStartProps?: COL_ACTIONS_START__PROPS;
|
|
83
|
+
blockSearch?: (props: {
|
|
84
|
+
context: FireCMSContext;
|
|
85
|
+
path: string;
|
|
86
|
+
collection: EC;
|
|
87
|
+
parentCollectionIds?: string[];
|
|
88
|
+
}) => boolean;
|
|
81
89
|
showTextSearchBar?: (props: {
|
|
82
90
|
context: FireCMSContext;
|
|
83
91
|
path: string;
|
|
@@ -101,6 +109,7 @@ export type FireCMSPlugin<PROPS = any, FORM_PROPS = any, EC extends EntityCollec
|
|
|
101
109
|
parentCollectionIds: string[];
|
|
102
110
|
onHover: boolean;
|
|
103
111
|
collection: EC;
|
|
112
|
+
tableController: EntityTableController;
|
|
104
113
|
}>;
|
|
105
114
|
/**
|
|
106
115
|
* If you add this callback to your plugin, an add button will be added to the collection table.
|
|
@@ -110,6 +119,7 @@ export type FireCMSPlugin<PROPS = any, FORM_PROPS = any, EC extends EntityCollec
|
|
|
110
119
|
fullPath: string;
|
|
111
120
|
parentCollectionIds: string[];
|
|
112
121
|
collection: EC;
|
|
122
|
+
tableController: EntityTableController;
|
|
113
123
|
}>;
|
|
114
124
|
};
|
|
115
125
|
form?: {
|
|
@@ -159,8 +169,8 @@ export type PluginFieldBuilderParams<T extends CMSType = CMSType, M extends Reco
|
|
|
159
169
|
property: Property<T> | ResolvedProperty<T>;
|
|
160
170
|
Field: React.ComponentType<FieldProps<T, any, M>>;
|
|
161
171
|
plugin: FireCMSPlugin;
|
|
162
|
-
path
|
|
163
|
-
collection
|
|
172
|
+
path?: string;
|
|
173
|
+
collection?: EC;
|
|
164
174
|
};
|
|
165
175
|
export interface PluginGenericProps<UserType extends User = User> {
|
|
166
176
|
context: FireCMSContext<UserType>;
|