@firecms/core 3.0.0-canary.7 → 3.0.0-canary.9
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/components/EntityCollectionTable/EntityCollectionRowActions.d.ts +1 -1
- package/dist/components/EntityCollectionTable/EntityCollectionTable.d.ts +2 -2
- package/dist/components/EntityCollectionTable/PropertyTableCell.d.ts +2 -2
- package/dist/components/EntityCollectionView/EntityCollectionView.d.ts +1 -2
- package/dist/components/EntityCollectionView/useSelectionController.d.ts +2 -0
- package/dist/components/EntityPreview.d.ts +25 -7
- package/dist/components/EntityView.d.ts +11 -0
- package/dist/components/FieldCaption.d.ts +5 -0
- package/dist/components/HomePage/NavigationCard.d.ts +8 -0
- package/dist/components/HomePage/{NavigationCollectionCard.d.ts → NavigationCardBinding.d.ts} +2 -2
- package/dist/components/HomePage/SmallNavigationCard.d.ts +6 -0
- package/dist/components/HomePage/index.d.ts +3 -1
- package/dist/components/VirtualTable/VirtualTableProps.d.ts +1 -1
- package/dist/components/index.d.ts +4 -2
- package/dist/core/{EntityView.d.ts → EntityEditView.d.ts} +2 -2
- package/dist/core/SideEntityView.d.ts +2 -2
- package/dist/form/EntityForm.d.ts +1 -1
- package/dist/form/components/StorageItemPreview.d.ts +3 -2
- package/dist/form/components/StorageUploadProgress.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/StorageUploadFieldBinding.d.ts +4 -3
- package/dist/form/field_bindings/TextFieldBinding.d.ts +2 -2
- package/dist/form/validation.d.ts +1 -1
- package/dist/hooks/data/useDataSource.d.ts +2 -2
- package/dist/hooks/useBuildNavigationController.d.ts +5 -2
- package/dist/hooks/useProjectLog.d.ts +5 -1
- package/dist/hooks/useStorageSource.d.ts +2 -2
- package/dist/index.es.js +8333 -8060
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +5 -5
- package/dist/index.umd.js.map +1 -1
- package/dist/internal/useRestoreScroll.d.ts +1 -1
- package/dist/preview/PropertyPreview.d.ts +1 -1
- package/dist/preview/components/BooleanPreview.d.ts +5 -1
- package/dist/preview/components/EnumValuesChip.d.ts +1 -1
- package/dist/preview/components/ReferencePreview.d.ts +1 -7
- package/dist/types/analytics.d.ts +1 -1
- package/dist/types/auth.d.ts +13 -1
- package/dist/types/collections.d.ts +14 -1
- package/dist/types/entity_overrides.d.ts +6 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/navigation.d.ts +10 -9
- package/dist/types/permissions.d.ts +5 -1
- package/dist/types/plugins.d.ts +15 -17
- package/dist/types/properties.d.ts +2 -2
- package/dist/types/property_config.d.ts +2 -2
- package/dist/types/roles.d.ts +31 -0
- package/dist/types/user.d.ts +5 -0
- package/dist/util/collections.d.ts +9 -1
- package/dist/util/icons.d.ts +8 -2
- package/dist/util/permissions.d.ts +4 -4
- package/dist/util/references.d.ts +4 -2
- package/dist/util/resolutions.d.ts +1 -1
- package/package.json +23 -23
- package/src/components/DeleteEntityDialog.tsx +4 -4
- package/src/components/EntityCollectionTable/EntityCollectionRowActions.tsx +2 -2
- package/src/components/EntityCollectionTable/EntityCollectionTable.tsx +273 -277
- package/src/components/EntityCollectionTable/EntityCollectionTableProps.tsx +1 -1
- package/src/components/EntityCollectionTable/PropertyTableCell.tsx +12 -13
- package/src/components/EntityCollectionTable/fields/TableReferenceField.tsx +8 -15
- package/src/components/EntityCollectionTable/fields/TableStorageUpload.tsx +3 -3
- package/src/components/EntityCollectionTable/internal/CollectionTableToolbar.tsx +1 -1
- package/src/components/EntityCollectionTable/internal/default_entity_actions.tsx +9 -5
- package/src/components/EntityCollectionView/EntityCollectionView.tsx +28 -49
- package/src/components/EntityCollectionView/EntityCollectionViewActions.tsx +5 -6
- package/src/components/EntityCollectionView/useSelectionController.tsx +30 -0
- package/src/components/EntityPreview.tsx +204 -70
- package/src/components/EntityView.tsx +84 -0
- package/src/components/FieldCaption.tsx +14 -0
- package/src/components/FireCMSAppBar.tsx +8 -0
- package/src/components/HomePage/DefaultHomePage.tsx +13 -9
- package/src/components/HomePage/NavigationCard.tsx +69 -0
- package/src/components/HomePage/NavigationCardBinding.tsx +116 -0
- package/src/components/HomePage/SmallNavigationCard.tsx +45 -0
- package/src/components/HomePage/index.tsx +3 -1
- package/src/components/ReferenceTable/ReferenceSelectionTable.tsx +3 -4
- package/src/components/ReferenceWidget.tsx +3 -3
- package/src/components/SelectableTable/filters/ReferenceFilterField.tsx +11 -19
- package/src/components/VirtualTable/VirtualTableProps.tsx +1 -1
- package/src/components/common/useDataSourceEntityCollectionTableController.tsx +1 -1
- package/src/components/index.tsx +4 -2
- package/src/core/Drawer.tsx +66 -39
- package/src/core/{EntityView.tsx → EntityEditView.tsx} +20 -37
- package/src/core/EntitySidePanel.tsx +2 -2
- package/src/core/FireCMS.tsx +18 -2
- package/src/core/NavigationRoutes.tsx +8 -0
- package/src/core/SideEntityView.tsx +2 -2
- package/src/form/EntityForm.tsx +19 -11
- package/src/form/components/StorageItemPreview.tsx +5 -3
- package/src/form/components/StorageUploadProgress.tsx +6 -5
- package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +8 -12
- package/src/form/field_bindings/KeyValueFieldBinding.tsx +15 -15
- package/src/form/field_bindings/MapFieldBinding.tsx +15 -15
- package/src/form/field_bindings/ReadOnlyFieldBinding.tsx +1 -1
- package/src/form/field_bindings/ReferenceFieldBinding.tsx +1 -0
- package/src/form/field_bindings/StorageUploadFieldBinding.tsx +14 -5
- package/src/form/field_bindings/TextFieldBinding.tsx +7 -5
- package/src/form/validation.ts +3 -4
- package/src/hooks/data/useCollectionFetch.tsx +1 -1
- package/src/hooks/data/useDataSource.tsx +8 -3
- package/src/hooks/data/useEntityFetch.tsx +1 -1
- package/src/hooks/useBuildNavigationController.tsx +79 -38
- package/src/hooks/useProjectLog.tsx +11 -3
- package/src/hooks/useReferenceDialog.tsx +2 -2
- package/src/hooks/useStorageSource.tsx +7 -2
- package/src/preview/PropertyPreview.tsx +1 -1
- package/src/preview/components/BooleanPreview.tsx +16 -3
- package/src/preview/components/EnumValuesChip.tsx +1 -1
- package/src/preview/components/ReferencePreview.tsx +54 -146
- package/src/preview/property_previews/StringPropertyPreview.tsx +8 -7
- package/src/types/analytics.ts +1 -0
- package/src/types/auth.tsx +17 -1
- package/src/types/collections.ts +16 -1
- package/src/types/entity_actions.tsx +4 -0
- package/src/types/entity_overrides.tsx +7 -0
- package/src/types/firecms.tsx +0 -1
- package/src/types/index.ts +2 -0
- package/src/types/navigation.ts +11 -10
- package/src/types/permissions.ts +6 -1
- package/src/types/plugins.tsx +22 -25
- package/src/types/properties.ts +3 -2
- package/src/types/property_config.tsx +2 -2
- package/src/types/roles.ts +41 -0
- package/src/types/side_entity_controller.tsx +1 -0
- package/src/types/user.ts +7 -0
- package/src/util/collections.ts +22 -0
- package/src/util/icons.tsx +11 -3
- package/src/util/permissions.ts +11 -8
- package/src/util/references.ts +36 -5
- package/src/components/HomePage/NavigationCollectionCard.tsx +0 -146
|
@@ -4,4 +4,4 @@ import { PropertyPreviewProps } from "./PropertyPreviewProps";
|
|
|
4
4
|
/**
|
|
5
5
|
* @group Preview components
|
|
6
6
|
*/
|
|
7
|
-
export declare const PropertyPreview: React.MemoExoticComponent<(<T extends CMSType>(props: PropertyPreviewProps<T
|
|
7
|
+
export declare const PropertyPreview: React.MemoExoticComponent<(<T extends CMSType>(props: PropertyPreviewProps<T>) => any)>;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { PreviewSize } from "../PropertyPreviewProps";
|
|
3
|
+
import { Property } from "../../types";
|
|
2
4
|
/**
|
|
3
5
|
* @group Preview components
|
|
4
6
|
*/
|
|
5
|
-
export declare function BooleanPreview({ value }: {
|
|
7
|
+
export declare function BooleanPreview({ value, size, property }: {
|
|
6
8
|
value: boolean;
|
|
9
|
+
size: PreviewSize;
|
|
10
|
+
property: Property;
|
|
7
11
|
}): React.ReactElement;
|
|
@@ -7,16 +7,10 @@ export type ReferencePreviewProps = {
|
|
|
7
7
|
size: PreviewSize;
|
|
8
8
|
previewProperties?: string[];
|
|
9
9
|
onClick?: (e: React.SyntheticEvent) => void;
|
|
10
|
-
|
|
10
|
+
hover?: boolean;
|
|
11
11
|
allowEntityNavigation?: boolean;
|
|
12
12
|
};
|
|
13
13
|
/**
|
|
14
14
|
* @group Preview components
|
|
15
15
|
*/
|
|
16
16
|
export declare const ReferencePreview: React.FunctionComponent<ReferencePreviewProps>;
|
|
17
|
-
export declare function ReferencePreviewContainer({ children, onHover, size, onClick }: {
|
|
18
|
-
children: React.ReactNode;
|
|
19
|
-
onHover?: boolean;
|
|
20
|
-
size: PreviewSize;
|
|
21
|
-
onClick?: (e: React.SyntheticEvent) => void;
|
|
22
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export type CMSAnalyticsEvent = "entity_click" | "entity_click_from_reference" | "reference_selection_clear" | "reference_selection_toggle" | "reference_selected_single" | "reference_selection_new_entity" | "edit_entity_clicked" | "entity_edited" | "new_entity_click" | "new_entity_saved" | "copy_entity_click" | "entity_copied" | "single_delete_dialog_open" | "multiple_delete_dialog_open" | "single_entity_deleted" | "multiple_entities_deleted" | "drawer_navigate_to_home" | "drawer_navigate_to_collection" | "drawer_navigate_to_view" | "home_navigate_to_collection" | "home_favorite_navigate_to_collection" | "home_navigate_to_view" | "home_favorite_navigate_to_view" | "collection_inline_editing" | "unmapped_event";
|
|
1
|
+
export type CMSAnalyticsEvent = "entity_click" | "entity_click_from_reference" | "reference_selection_clear" | "reference_selection_toggle" | "reference_selected_single" | "reference_selection_new_entity" | "edit_entity_clicked" | "entity_edited" | "new_entity_click" | "new_entity_saved" | "copy_entity_click" | "entity_copied" | "single_delete_dialog_open" | "multiple_delete_dialog_open" | "single_entity_deleted" | "multiple_entities_deleted" | "drawer_navigate_to_home" | "drawer_navigate_to_collection" | "drawer_navigate_to_view" | "home_navigate_to_collection" | "home_favorite_navigate_to_collection" | "home_navigate_to_view" | "home_navigate_to_admin_view" | "home_favorite_navigate_to_view" | "collection_inline_editing" | "unmapped_event";
|
package/dist/types/auth.d.ts
CHANGED
|
@@ -1,22 +1,32 @@
|
|
|
1
1
|
import { User } from "./user";
|
|
2
|
+
import { Role } from "./roles";
|
|
2
3
|
/**
|
|
3
4
|
* Controller for retrieving the logged user or performing auth related operations.
|
|
4
5
|
* Note that if you are implementing your AuthController, you probably will want
|
|
5
6
|
* to do it as the result of a hook.
|
|
6
7
|
* @group Hooks and utilities
|
|
7
8
|
*/
|
|
8
|
-
export type AuthController<UserType extends User = User> = {
|
|
9
|
+
export type AuthController<UserType extends User = User, ExtraData extends any = any> = {
|
|
9
10
|
/**
|
|
10
11
|
* The user currently logged in
|
|
11
12
|
* The values can be: the user object, null if they skipped login
|
|
12
13
|
*/
|
|
13
14
|
user: UserType | null;
|
|
15
|
+
/**
|
|
16
|
+
* Roles related to the logged user
|
|
17
|
+
*/
|
|
18
|
+
roles?: Role[];
|
|
14
19
|
/**
|
|
15
20
|
* Initial loading flag. It is used not to display the login screen
|
|
16
21
|
* when the app first loads, and it has not been checked whether the user
|
|
17
22
|
* is logged in or not.
|
|
18
23
|
*/
|
|
19
24
|
initialLoading?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Loading flag. It is used to display a loading screen when the user is
|
|
27
|
+
* logging in or out.
|
|
28
|
+
*/
|
|
29
|
+
authLoading: boolean;
|
|
20
30
|
/**
|
|
21
31
|
* Sign out
|
|
22
32
|
*/
|
|
@@ -37,4 +47,6 @@ export type AuthController<UserType extends User = User> = {
|
|
|
37
47
|
* Has the user skipped the login process
|
|
38
48
|
*/
|
|
39
49
|
loginSkipped: boolean;
|
|
50
|
+
extra: ExtraData;
|
|
51
|
+
setExtra: (extra: ExtraData) => void;
|
|
40
52
|
};
|
|
@@ -8,6 +8,7 @@ import { EnumValues, PropertiesOrBuilders } from "./properties";
|
|
|
8
8
|
import { FormContext } from "./fields";
|
|
9
9
|
import { EntityAction } from "./entity_actions";
|
|
10
10
|
import { ExportConfig } from "./export_import";
|
|
11
|
+
import { EntityOverrides } from "./entity_overrides";
|
|
11
12
|
/**
|
|
12
13
|
* This interface represents a view that includes a collection of entities.
|
|
13
14
|
* It can be in the root level of the configuration, defining the main
|
|
@@ -65,6 +66,12 @@ export interface EntityCollection<M extends Record<string, any> = any, UserType
|
|
|
65
66
|
* Set of properties that compose an entity
|
|
66
67
|
*/
|
|
67
68
|
properties: PropertiesOrBuilders<M>;
|
|
69
|
+
/**
|
|
70
|
+
* Title property of the entity. This is the property that will be used
|
|
71
|
+
* as the title in entity related views and references.
|
|
72
|
+
* If not specified, the first property simple text property will be used.
|
|
73
|
+
*/
|
|
74
|
+
titleProperty?: keyof M;
|
|
68
75
|
/**
|
|
69
76
|
* Can this collection be edited by the end user.
|
|
70
77
|
* Defaults to `true`.
|
|
@@ -241,6 +248,12 @@ export interface EntityCollection<M extends Record<string, any> = any, UserType
|
|
|
241
248
|
*
|
|
242
249
|
*/
|
|
243
250
|
exportable?: boolean | ExportConfig<UserType>;
|
|
251
|
+
/**
|
|
252
|
+
* User id of the owner of this collection. This is used only by plugins, or if you
|
|
253
|
+
* are writing custom code
|
|
254
|
+
*/
|
|
255
|
+
ownerId?: string;
|
|
256
|
+
overrides?: EntityOverrides;
|
|
244
257
|
}
|
|
245
258
|
/**
|
|
246
259
|
* Parameter passed to the `Actions` prop in the collection configuration.
|
|
@@ -300,7 +313,7 @@ export type SelectionController<M extends Record<string, any> = any> = {
|
|
|
300
313
|
};
|
|
301
314
|
/**
|
|
302
315
|
* Filter conditions in a `Query.where()` clause are specified using the
|
|
303
|
-
* strings
|
|
316
|
+
* strings `<`, `<=`, `==`, `>=`, `>`, `array-contains`, `in`, and `array-contains-any`.
|
|
304
317
|
* @group Models
|
|
305
318
|
*/
|
|
306
319
|
export type WhereFilterOp = "<" | "<=" | "==" | "!=" | ">=" | ">" | "array-contains" | "in" | "not-in" | "array-contains-any";
|
package/dist/types/index.d.ts
CHANGED
|
@@ -17,10 +17,12 @@ export * from "./side_entity_controller";
|
|
|
17
17
|
export * from "./side_dialogs_controller";
|
|
18
18
|
export * from "./firecms_context";
|
|
19
19
|
export * from "./entity_callbacks";
|
|
20
|
+
export * from "./entity_overrides";
|
|
20
21
|
export * from "./local_config_persistence";
|
|
21
22
|
export * from "./plugins";
|
|
22
23
|
export * from "./analytics";
|
|
23
24
|
export * from "./firecms";
|
|
25
|
+
export * from "./roles";
|
|
24
26
|
export * from "./appcheck";
|
|
25
27
|
export * from "./export_import";
|
|
26
28
|
export * from "./modify_collections";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
import { EntityCollection } from "./collections";
|
|
2
3
|
import { EntityReference } from "./entities";
|
|
3
4
|
/**
|
|
@@ -18,6 +19,11 @@ export type NavigationController = {
|
|
|
18
19
|
* navigation
|
|
19
20
|
*/
|
|
20
21
|
views?: CMSView[];
|
|
22
|
+
/**
|
|
23
|
+
* Custom additional views created by the developer, added to the admin
|
|
24
|
+
* navigation
|
|
25
|
+
*/
|
|
26
|
+
adminViews?: CMSView[];
|
|
21
27
|
/**
|
|
22
28
|
* Configuration for the views that should be displayed at the top
|
|
23
29
|
* level of the navigation (e.g. in the home page or the navigation
|
|
@@ -95,12 +101,6 @@ export type NavigationController = {
|
|
|
95
101
|
* @param pathWithAliases
|
|
96
102
|
*/
|
|
97
103
|
resolveAliasesFrom: (pathWithAliases: string) => string;
|
|
98
|
-
/**
|
|
99
|
-
* Location used as the base for routes.
|
|
100
|
-
* This is the location that will be used underneath, when the url changes while
|
|
101
|
-
* opening a side dialog
|
|
102
|
-
*/
|
|
103
|
-
baseLocation: string;
|
|
104
104
|
/**
|
|
105
105
|
* Call this method to recalculate the navigation
|
|
106
106
|
*/
|
|
@@ -159,6 +159,7 @@ export interface CMSView {
|
|
|
159
159
|
/**
|
|
160
160
|
* Optional field used to group top level navigation entries under a
|
|
161
161
|
* navigation view.
|
|
162
|
+
* This prop is ignored for admin views.
|
|
162
163
|
*/
|
|
163
164
|
group?: string;
|
|
164
165
|
}
|
|
@@ -166,11 +167,11 @@ export interface TopNavigationEntry {
|
|
|
166
167
|
url: string;
|
|
167
168
|
name: string;
|
|
168
169
|
path: string;
|
|
169
|
-
type: "collection" | "view";
|
|
170
|
+
type: "collection" | "view" | "admin";
|
|
170
171
|
collection?: EntityCollection;
|
|
171
|
-
view
|
|
172
|
+
view?: CMSView;
|
|
172
173
|
description?: string;
|
|
173
|
-
group
|
|
174
|
+
group: string;
|
|
174
175
|
}
|
|
175
176
|
export type TopNavigationResult = {
|
|
176
177
|
navigationEntries: TopNavigationEntry[];
|
|
@@ -38,6 +38,10 @@ export interface PermissionsBuilderProps<EC extends EntityCollection = EntityCol
|
|
|
38
38
|
* in a collection, the entity will be null.
|
|
39
39
|
*/
|
|
40
40
|
entity: Entity<M> | null;
|
|
41
|
+
/**
|
|
42
|
+
* Path of the collection e.g. 'products/12345/locales'
|
|
43
|
+
*/
|
|
44
|
+
path: string;
|
|
41
45
|
/**
|
|
42
46
|
* Path segments of the collection e.g. ['products', 'locales']
|
|
43
47
|
*/
|
|
@@ -60,4 +64,4 @@ export interface PermissionsBuilderProps<EC extends EntityCollection = EntityCol
|
|
|
60
64
|
* based on the logged user or collection.
|
|
61
65
|
* @group Models
|
|
62
66
|
*/
|
|
63
|
-
export type PermissionsBuilder<EC extends EntityCollection = EntityCollection, UserType extends User = User, M extends object = InferCollectionType<EC>> = (({ pathSegments, user, collection, authController }: PermissionsBuilderProps<EC, UserType, M>) => Permissions);
|
|
67
|
+
export type PermissionsBuilder<EC extends EntityCollection = EntityCollection, UserType extends User = User, M extends object = InferCollectionType<EC>> = (({ pathSegments, user, collection, authController }: PermissionsBuilderProps<EC, UserType, M>) => Permissions | undefined);
|
package/dist/types/plugins.d.ts
CHANGED
|
@@ -21,23 +21,6 @@ export type FireCMSPlugin<PROPS = any, FORM_PROPS = any, EC extends EntityCollec
|
|
|
21
21
|
* until the plugin is fully loaded.
|
|
22
22
|
*/
|
|
23
23
|
loading?: boolean;
|
|
24
|
-
collections?: {
|
|
25
|
-
/**
|
|
26
|
-
* Use this component to add custom actions to the entity collections
|
|
27
|
-
* toolbar.
|
|
28
|
-
*/
|
|
29
|
-
CollectionActions?: React.ComponentType<CollectionActionsProps<any, any, EC> & COL_ACTIONS_PROPS> | React.ComponentType<CollectionActionsProps<any, any, EC> & COL_ACTIONS_PROPS>[];
|
|
30
|
-
collectionActionsProps?: COL_ACTIONS_PROPS;
|
|
31
|
-
};
|
|
32
|
-
form?: {
|
|
33
|
-
provider?: {
|
|
34
|
-
Component: React.ComponentType<PropsWithChildren<FORM_PROPS & PluginFormActionProps<any, EC>>>;
|
|
35
|
-
props?: FORM_PROPS;
|
|
36
|
-
};
|
|
37
|
-
Actions?: React.ComponentType<PluginFormActionProps<any, EC>>;
|
|
38
|
-
fieldBuilder?: <T extends CMSType = CMSType>(props: PluginFieldBuilderParams<T, any, EC>) => React.ComponentType<FieldProps<T>> | null;
|
|
39
|
-
fieldBuilderEnabled?: <T extends CMSType = CMSType>(props: PluginFieldBuilderParams<T>) => boolean;
|
|
40
|
-
};
|
|
41
24
|
/**
|
|
42
25
|
* You can use this prop to add higher order components to the CMS.
|
|
43
26
|
* The components will be added to the root of the CMS, so any component
|
|
@@ -89,6 +72,12 @@ export type FireCMSPlugin<PROPS = any, FORM_PROPS = any, EC extends EntityCollec
|
|
|
89
72
|
};
|
|
90
73
|
};
|
|
91
74
|
collectionView?: {
|
|
75
|
+
/**
|
|
76
|
+
* Use this component to add custom actions to the entity collections
|
|
77
|
+
* toolbar.
|
|
78
|
+
*/
|
|
79
|
+
CollectionActions?: React.ComponentType<CollectionActionsProps<any, any, EC> & COL_ACTIONS_PROPS> | React.ComponentType<CollectionActionsProps<any, any, EC> & COL_ACTIONS_PROPS>[];
|
|
80
|
+
collectionActionsProps?: COL_ACTIONS_PROPS;
|
|
92
81
|
showTextSearchBar?: (props: {
|
|
93
82
|
context: FireCMSContext;
|
|
94
83
|
path: string;
|
|
@@ -123,6 +112,15 @@ export type FireCMSPlugin<PROPS = any, FORM_PROPS = any, EC extends EntityCollec
|
|
|
123
112
|
collection: EC;
|
|
124
113
|
}>;
|
|
125
114
|
};
|
|
115
|
+
form?: {
|
|
116
|
+
provider?: {
|
|
117
|
+
Component: React.ComponentType<PropsWithChildren<FORM_PROPS & PluginFormActionProps<any, EC>>>;
|
|
118
|
+
props?: FORM_PROPS;
|
|
119
|
+
};
|
|
120
|
+
Actions?: React.ComponentType<PluginFormActionProps<any, EC>>;
|
|
121
|
+
fieldBuilder?: <T extends CMSType = CMSType>(props: PluginFieldBuilderParams<T, any, EC>) => React.ComponentType<FieldProps<T>> | null;
|
|
122
|
+
fieldBuilderEnabled?: <T extends CMSType = CMSType>(props: PluginFieldBuilderParams<T>) => boolean;
|
|
123
|
+
};
|
|
126
124
|
};
|
|
127
125
|
/**
|
|
128
126
|
* Props passed to the {@link FireCMSPlugin.homePage.CollectionActions} method.
|
|
@@ -552,7 +552,7 @@ export interface ArrayPropertyValidationSchema extends PropertyValidationSchema
|
|
|
552
552
|
* Additional configuration related to Storage related fields
|
|
553
553
|
* @group Entity properties
|
|
554
554
|
*/
|
|
555
|
-
export
|
|
555
|
+
export type StorageConfig = {
|
|
556
556
|
/**
|
|
557
557
|
* File MIME types that can be uploaded to this reference. Don't specify for
|
|
558
558
|
* all.
|
|
@@ -620,7 +620,7 @@ export interface StorageConfig {
|
|
|
620
620
|
* after it has been resolved.
|
|
621
621
|
*/
|
|
622
622
|
postProcess?: (pathOrUrl: string) => Promise<string>;
|
|
623
|
-
}
|
|
623
|
+
};
|
|
624
624
|
/**
|
|
625
625
|
* @group Entity properties
|
|
626
626
|
*/
|
|
@@ -9,7 +9,7 @@ export type PropertyConfig<T extends CMSType = any> = {
|
|
|
9
9
|
/**
|
|
10
10
|
* Key used to identify this property config.
|
|
11
11
|
*/
|
|
12
|
-
key: string;
|
|
12
|
+
key: PropertyConfigId | string;
|
|
13
13
|
/**
|
|
14
14
|
* Name of this field type.
|
|
15
15
|
* This is not the name of the property.
|
|
@@ -39,4 +39,4 @@ export type PropertyConfig<T extends CMSType = any> = {
|
|
|
39
39
|
*/
|
|
40
40
|
description?: string;
|
|
41
41
|
};
|
|
42
|
-
export type
|
|
42
|
+
export type PropertyConfigId = "text_field" | "multiline" | "markdown" | "url" | "email" | "select" | "multi_select" | "number_input" | "number_select" | "multi_number_select" | "file_upload" | "multi_file_upload" | "group" | "key_value" | "reference" | "multi_references" | "switch" | "date_time" | "repeat" | "custom_array" | "block";
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Permissions } from "../index";
|
|
2
|
+
export type Role = {
|
|
3
|
+
/**
|
|
4
|
+
* ID of the role
|
|
5
|
+
*/
|
|
6
|
+
id: string;
|
|
7
|
+
/**
|
|
8
|
+
* Name of the role
|
|
9
|
+
*/
|
|
10
|
+
name: string;
|
|
11
|
+
/**
|
|
12
|
+
* If this flag is true, the user can perform any action
|
|
13
|
+
*/
|
|
14
|
+
isAdmin?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Default permissions for all collections for this role.
|
|
17
|
+
* You can override this values at the collection level using
|
|
18
|
+
* {@link collectionPermissions}
|
|
19
|
+
*/
|
|
20
|
+
defaultPermissions?: Permissions;
|
|
21
|
+
/**
|
|
22
|
+
* Record of stripped collection ids to their permissions.
|
|
23
|
+
* @see stripCollectionPath
|
|
24
|
+
*/
|
|
25
|
+
collectionPermissions?: Record<string, Permissions>;
|
|
26
|
+
config?: {
|
|
27
|
+
createCollections?: boolean;
|
|
28
|
+
editCollections?: boolean | "own";
|
|
29
|
+
deleteCollections?: boolean | "own";
|
|
30
|
+
};
|
|
31
|
+
};
|
package/dist/types/user.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Role } from "./roles";
|
|
1
2
|
/**
|
|
2
3
|
* This interface represents a user.
|
|
3
4
|
* It has some of the same fields as a Firebase User.
|
|
@@ -33,4 +34,8 @@ export type User = {
|
|
|
33
34
|
*
|
|
34
35
|
*/
|
|
35
36
|
readonly isAnonymous: boolean;
|
|
37
|
+
/**
|
|
38
|
+
*
|
|
39
|
+
*/
|
|
40
|
+
roles?: Role[];
|
|
36
41
|
};
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
-
import { DefaultSelectedViewBuilder, DefaultSelectedViewParams, PropertiesOrBuilders } from "../types";
|
|
1
|
+
import { DefaultSelectedViewBuilder, DefaultSelectedViewParams, EntityCollection, PermissionsBuilder, PropertiesOrBuilders } from "../types";
|
|
2
2
|
export declare function sortProperties<M extends Record<string, any>>(properties: PropertiesOrBuilders<M>, propertiesOrder?: (keyof M)[]): PropertiesOrBuilders<M>;
|
|
3
3
|
export declare function resolveDefaultSelectedView(defaultSelectedView: string | DefaultSelectedViewBuilder | undefined, params: DefaultSelectedViewParams): string | undefined;
|
|
4
|
+
/**
|
|
5
|
+
* If a collection is not applying permissions, we apply the given permissionsBuilder.
|
|
6
|
+
* This is used to apply the role permissions to the collections, unless they are already
|
|
7
|
+
* applying permissions.
|
|
8
|
+
* @param collections
|
|
9
|
+
* @param permissionsBuilder
|
|
10
|
+
*/
|
|
11
|
+
export declare const applyPermissionsFunctionIfEmpty: (collections: EntityCollection[], permissionsBuilder?: PermissionsBuilder) => EntityCollection[];
|
package/dist/util/icons.d.ts
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { CMSView, EntityCollection } from "../types";
|
|
3
2
|
export declare function getIcon(iconKey?: string, className?: string): React.ReactElement | undefined;
|
|
3
|
+
export type IconViewProps = {
|
|
4
|
+
path: string;
|
|
5
|
+
name: string;
|
|
6
|
+
singularName?: string;
|
|
7
|
+
group?: string;
|
|
8
|
+
icon?: string;
|
|
9
|
+
};
|
|
4
10
|
export declare const IconForView: React.NamedExoticComponent<{
|
|
5
|
-
collectionOrView
|
|
11
|
+
collectionOrView?: IconViewProps | undefined;
|
|
6
12
|
className?: string | undefined;
|
|
7
13
|
}>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AuthController, Entity, EntityCollection, Permissions, User } from "../types";
|
|
2
|
-
export declare function resolvePermissions<M extends Record<string, any>, UserType extends User>(collection: EntityCollection<M>, authController: AuthController<UserType>,
|
|
3
|
-
export declare function canEditEntity<M extends Record<string, any>, UserType extends User>(collection: EntityCollection<M>, authController: AuthController<UserType>,
|
|
4
|
-
export declare function canCreateEntity<M extends Record<string, any>, UserType extends User>(collection: EntityCollection<M>, authController: AuthController<UserType>,
|
|
5
|
-
export declare function canDeleteEntity<M extends Record<string, any>, UserType extends User>(collection: EntityCollection<M>, authController: AuthController<UserType>,
|
|
2
|
+
export declare function resolvePermissions<M extends Record<string, any>, UserType extends User>(collection: EntityCollection<M>, authController: AuthController<UserType>, path: string, entity: Entity<M> | null): Permissions | undefined;
|
|
3
|
+
export declare function canEditEntity<M extends Record<string, any>, UserType extends User>(collection: EntityCollection<M>, authController: AuthController<UserType>, path: string, entity: Entity<M> | null): boolean;
|
|
4
|
+
export declare function canCreateEntity<M extends Record<string, any>, UserType extends User>(collection: EntityCollection<M>, authController: AuthController<UserType>, path: string, entity: Entity<M> | null): boolean;
|
|
5
|
+
export declare function canDeleteEntity<M extends Record<string, any>, UserType extends User>(collection: EntityCollection<M>, authController: AuthController<UserType>, path: string, entity: Entity<M> | null): boolean;
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
import { EntityCollection, PropertyConfig } from "../types";
|
|
2
|
-
export declare function
|
|
1
|
+
import { EntityCollection, PropertyConfig, ResolvedEntityCollection } from "../types";
|
|
2
|
+
export declare function getEntityPreviewKeys(targetCollection: EntityCollection<any>, fields: Record<string, PropertyConfig>, previewProperties?: string[], limit?: number): string[];
|
|
3
|
+
export declare function getEntityTitlePropertyKey<M extends Record<string, any>>(collection: EntityCollection<M>, propertyConfigs: Record<string, PropertyConfig<any>>): string | undefined;
|
|
4
|
+
export declare function getEntityImagePreviewPropertyKey<M extends object>(collection: ResolvedEntityCollection<M>): string | undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ArrayProperty, CMSType, EntityCollection, EntityCustomView, EntityValues, EnumValueConfig, EnumValues, NumberProperty, PropertiesOrBuilders, PropertyConfig, PropertyOrBuilder, ResolvedArrayProperty, ResolvedEntityCollection, ResolvedNumberProperty, ResolvedProperties, ResolvedProperty, ResolvedStringProperty, StringProperty, UserConfigurationPersistence } from "../types";
|
|
2
2
|
export declare const resolveCollection: <M extends Record<string, any>>({ collection, path, entityId, values, previousValues, userConfigPersistence, fields }: {
|
|
3
|
-
collection: EntityCollection<M
|
|
3
|
+
collection: EntityCollection<M> | ResolvedEntityCollection<M>;
|
|
4
4
|
path: string;
|
|
5
5
|
entityId?: string | undefined;
|
|
6
6
|
values?: Partial<M> | undefined;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@firecms/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "3.0.0-canary.
|
|
4
|
+
"version": "3.0.0-canary.9",
|
|
5
5
|
"description": "Awesome Firebase/Firestore-based headless open-source CMS",
|
|
6
6
|
"funding": {
|
|
7
7
|
"url": "https://github.com/sponsors/firecmsco"
|
|
@@ -46,15 +46,15 @@
|
|
|
46
46
|
"./package.json": "./package.json"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@firecms/formex": "^3.0.0-canary.
|
|
50
|
-
"@firecms/ui": "^3.0.0-canary.
|
|
51
|
-
"@fontsource/ibm-plex-mono": "^5.0.
|
|
52
|
-
"@fontsource/roboto": "^5.0.
|
|
49
|
+
"@firecms/formex": "^3.0.0-canary.9",
|
|
50
|
+
"@firecms/ui": "^3.0.0-canary.9",
|
|
51
|
+
"@fontsource/ibm-plex-mono": "^5.0.12",
|
|
52
|
+
"@fontsource/roboto": "^5.0.12",
|
|
53
53
|
"@hello-pangea/dnd": "^16.5.0",
|
|
54
|
-
"date-fns": "^3.
|
|
54
|
+
"date-fns": "^3.6.0",
|
|
55
55
|
"history": "^5.3.0",
|
|
56
56
|
"js-search": "^2.0.1",
|
|
57
|
-
"markdown-it": "^14.
|
|
57
|
+
"markdown-it": "^14.1.0",
|
|
58
58
|
"notistack": "^3.0.1",
|
|
59
59
|
"object-hash": "^3.0.0",
|
|
60
60
|
"react-image-file-resizer": "^0.4.8",
|
|
@@ -80,42 +80,42 @@
|
|
|
80
80
|
},
|
|
81
81
|
"devDependencies": {
|
|
82
82
|
"@jest/globals": "^29.7.0",
|
|
83
|
-
"@testing-library/jest-dom": "^
|
|
83
|
+
"@testing-library/jest-dom": "^6.4.2",
|
|
84
84
|
"@testing-library/react": "^14.2.1",
|
|
85
85
|
"@testing-library/user-event": "^14.5.2",
|
|
86
86
|
"@types/jest": "^29.5.12",
|
|
87
|
-
"@types/node": "^20.11.
|
|
87
|
+
"@types/node": "^20.11.30",
|
|
88
88
|
"@types/object-hash": "^3.0.6",
|
|
89
|
-
"@types/react": "^18.2.
|
|
90
|
-
"@types/react-dom": "^18.2.
|
|
89
|
+
"@types/react": "^18.2.67",
|
|
90
|
+
"@types/react-dom": "^18.2.22",
|
|
91
91
|
"@types/react-measure": "^2.0.12",
|
|
92
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
93
|
-
"@typescript-eslint/parser": "^
|
|
92
|
+
"@typescript-eslint/eslint-plugin": "^7.3.1",
|
|
93
|
+
"@typescript-eslint/parser": "^7.3.1",
|
|
94
94
|
"@vitejs/plugin-react": "^4.2.1",
|
|
95
95
|
"cross-env": "^7.0.3",
|
|
96
|
-
"eslint": "^8.
|
|
96
|
+
"eslint": "^8.57.0",
|
|
97
97
|
"eslint-config-standard": "^17.1.0",
|
|
98
98
|
"eslint-plugin-import": "^2.29.1",
|
|
99
|
-
"eslint-plugin-n": "^
|
|
99
|
+
"eslint-plugin-n": "^16.6.2",
|
|
100
100
|
"eslint-plugin-promise": "^6.1.1",
|
|
101
|
-
"eslint-plugin-react": "^7.
|
|
101
|
+
"eslint-plugin-react": "^7.34.1",
|
|
102
102
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
103
|
-
"firebase": "^10.
|
|
103
|
+
"firebase": "^10.9.0",
|
|
104
104
|
"jest": "^29.7.0",
|
|
105
105
|
"npm-run-all": "^4.1.5",
|
|
106
|
-
"react-router": "^6.22.
|
|
107
|
-
"react-router-dom": "^6.22.
|
|
106
|
+
"react-router": "^6.22.3",
|
|
107
|
+
"react-router-dom": "^6.22.3",
|
|
108
108
|
"ts-jest": "^29.1.2",
|
|
109
109
|
"ts-node": "^10.9.2",
|
|
110
|
-
"tsd": "^0.30.
|
|
111
|
-
"typescript": "^5.
|
|
112
|
-
"vite": "^5.1.
|
|
110
|
+
"tsd": "^0.30.7",
|
|
111
|
+
"typescript": "^5.4.2",
|
|
112
|
+
"vite": "^5.1.6"
|
|
113
113
|
},
|
|
114
114
|
"files": [
|
|
115
115
|
"dist",
|
|
116
116
|
"src"
|
|
117
117
|
],
|
|
118
|
-
"gitHead": "
|
|
118
|
+
"gitHead": "5bd7f971be5956d225835af3b6cbe9f71d3e7e50",
|
|
119
119
|
"publishConfig": {
|
|
120
120
|
"access": "public"
|
|
121
121
|
}
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
useSnackbarController
|
|
10
10
|
} from "../hooks";
|
|
11
11
|
import { resolveCollection } from "../util";
|
|
12
|
-
import {
|
|
12
|
+
import { EntityView } from "./EntityView";
|
|
13
13
|
|
|
14
14
|
export interface DeleteEntityDialogProps<M extends Record<string, any>> {
|
|
15
15
|
entityOrEntitiesToDelete?: Entity<M> | Entity<M>[],
|
|
@@ -35,7 +35,7 @@ export function DeleteEntityDialog<M extends Record<string, any>>({
|
|
|
35
35
|
path
|
|
36
36
|
}: DeleteEntityDialogProps<M>) {
|
|
37
37
|
|
|
38
|
-
const dataSource = useDataSource();
|
|
38
|
+
const dataSource = useDataSource(collection);
|
|
39
39
|
const customizationController = useCustomizationController();
|
|
40
40
|
const snackbarController = useSnackbarController();
|
|
41
41
|
const [loading, setLoading] = useState(false);
|
|
@@ -163,7 +163,7 @@ export function DeleteEntityDialog<M extends Record<string, any>>({
|
|
|
163
163
|
} else {
|
|
164
164
|
const entity = entityOrEntities as Entity<M> | undefined;
|
|
165
165
|
content = entity
|
|
166
|
-
? <
|
|
166
|
+
? <EntityView
|
|
167
167
|
entity={entity}
|
|
168
168
|
collection={collection}
|
|
169
169
|
path={path}/>
|
|
@@ -176,7 +176,7 @@ export function DeleteEntityDialog<M extends Record<string, any>>({
|
|
|
176
176
|
|
|
177
177
|
return (
|
|
178
178
|
<Dialog
|
|
179
|
-
maxWidth={"2xl"}
|
|
179
|
+
maxWidth={multipleEntities ? "lg" : "2xl"}
|
|
180
180
|
aria-labelledby="delete-dialog"
|
|
181
181
|
open={open}
|
|
182
182
|
onOpenChange={(open) => !open ? onClose() : undefined}
|
|
@@ -99,7 +99,7 @@ export const EntityCollectionRowActions = function EntityCollectionRowActions({
|
|
|
99
99
|
selectionController,
|
|
100
100
|
highlightEntity,
|
|
101
101
|
unhighlightEntity,
|
|
102
|
-
onCollectionChange
|
|
102
|
+
onCollectionChange,
|
|
103
103
|
});
|
|
104
104
|
}}
|
|
105
105
|
size={largeLayout ? "medium" : "small"}>
|
|
@@ -127,7 +127,7 @@ export const EntityCollectionRowActions = function EntityCollectionRowActions({
|
|
|
127
127
|
selectionController,
|
|
128
128
|
highlightEntity,
|
|
129
129
|
unhighlightEntity,
|
|
130
|
-
onCollectionChange
|
|
130
|
+
onCollectionChange,
|
|
131
131
|
});
|
|
132
132
|
}}>
|
|
133
133
|
{action.icon}
|