@firecms/core 3.0.0-canary.248 → 3.0.0-canary.249
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/HomePage/DefaultHomePage.d.ts +2 -15
- package/dist/components/HomePage/HomePageDnD.d.ts +76 -0
- package/dist/components/HomePage/NavigationCard.d.ts +3 -1
- package/dist/components/HomePage/NavigationCardBinding.d.ts +3 -2
- package/dist/components/HomePage/NavigationGroup.d.ts +7 -1
- package/dist/components/HomePage/RenameGroupDialog.d.ts +9 -0
- package/dist/core/field_configs.d.ts +1 -1
- package/dist/form/field_bindings/ReferenceAsStringFieldBinding.d.ts +9 -0
- package/dist/form/index.d.ts +1 -0
- package/dist/hooks/useBuildNavigationController.d.ts +51 -2
- package/dist/index.es.js +1726 -778
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +1723 -775
- package/dist/index.umd.js.map +1 -1
- package/dist/types/analytics.d.ts +1 -1
- package/dist/types/collections.d.ts +3 -0
- package/dist/types/navigation.d.ts +20 -4
- package/dist/types/plugins.d.ts +12 -0
- package/dist/types/properties.d.ts +7 -0
- package/dist/types/property_config.d.ts +1 -1
- package/dist/util/icons.d.ts +1 -1
- package/package.json +5 -5
- package/src/components/EntityCollectionTable/PropertyTableCell.tsx +25 -3
- package/src/components/HomePage/DefaultHomePage.tsx +476 -157
- package/src/components/HomePage/FavouritesView.tsx +3 -3
- package/src/components/HomePage/HomePageDnD.tsx +613 -0
- package/src/components/HomePage/NavigationCard.tsx +47 -38
- package/src/components/HomePage/NavigationCardBinding.tsx +10 -6
- package/src/components/HomePage/NavigationGroup.tsx +63 -29
- package/src/components/HomePage/RenameGroupDialog.tsx +113 -0
- package/src/core/DefaultDrawer.tsx +8 -8
- package/src/core/DrawerNavigationItem.tsx +1 -1
- package/src/core/field_configs.tsx +15 -1
- package/src/form/field_bindings/ReferenceAsStringFieldBinding.tsx +135 -0
- package/src/form/field_bindings/RepeatFieldBinding.tsx +0 -1
- package/src/form/index.tsx +1 -0
- package/src/hooks/useBuildNavigationController.tsx +273 -84
- package/src/preview/PropertyPreview.tsx +14 -0
- package/src/types/analytics.ts +3 -0
- package/src/types/collections.ts +3 -0
- package/src/types/navigation.ts +27 -5
- package/src/types/plugins.tsx +15 -0
- package/src/types/properties.ts +8 -0
- package/src/types/property_config.tsx +1 -0
- package/src/util/icons.tsx +7 -3
|
@@ -1,21 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* for each collection defined in the navigation.
|
|
5
|
-
|
|
6
|
-
* @group Components
|
|
7
|
-
*/
|
|
2
|
+
export declare const DEFAULT_GROUP_NAME = "Views";
|
|
3
|
+
export declare const ADMIN_GROUP_NAME = "Admin";
|
|
8
4
|
export declare function DefaultHomePage({ additionalActions, additionalChildrenStart, additionalChildrenEnd }: {
|
|
9
|
-
/**
|
|
10
|
-
* Additional actions to be rendered in the home page, close to the search bar.
|
|
11
|
-
*/
|
|
12
5
|
additionalActions?: React.ReactNode;
|
|
13
|
-
/**
|
|
14
|
-
* Additional children to be rendered in the beginning of the home page.
|
|
15
|
-
*/
|
|
16
6
|
additionalChildrenStart?: React.ReactNode;
|
|
17
|
-
/**
|
|
18
|
-
* Additional children to be rendered at the end of the home page.
|
|
19
|
-
*/
|
|
20
7
|
additionalChildrenEnd?: React.ReactNode;
|
|
21
8
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Active, CollisionDetection, DropAnimation, UniqueIdentifier } from "@dnd-kit/core";
|
|
3
|
+
import { NavigationEntry } from "../../types";
|
|
4
|
+
export declare function SortableNavigationCard({ entry, onClick }: {
|
|
5
|
+
entry: NavigationEntry;
|
|
6
|
+
onClick?: () => void;
|
|
7
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare function NavigationGroupDroppable({ id, itemIds, children, isPotentialCardDropTarget }: {
|
|
9
|
+
id: UniqueIdentifier;
|
|
10
|
+
itemIds: UniqueIdentifier[];
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
isPotentialCardDropTarget?: boolean;
|
|
13
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export declare function SortableNavigationGroup({ groupName, children, disabled }: {
|
|
15
|
+
groupName: string;
|
|
16
|
+
children: React.ReactNode;
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export declare function useHomePageDnd({ items: dndItems, setItems: setDndItems, disabled, onCardMovedBetweenGroups, onGroupMoved, onNewGroupDrop, onPersist }: {
|
|
20
|
+
items: {
|
|
21
|
+
name: string;
|
|
22
|
+
entries: NavigationEntry[];
|
|
23
|
+
}[];
|
|
24
|
+
setItems: (newItemsOrUpdater: {
|
|
25
|
+
name: string;
|
|
26
|
+
entries: NavigationEntry[];
|
|
27
|
+
}[] | ((currentItems: {
|
|
28
|
+
name: string;
|
|
29
|
+
entries: NavigationEntry[];
|
|
30
|
+
}[]) => {
|
|
31
|
+
name: string;
|
|
32
|
+
entries: NavigationEntry[];
|
|
33
|
+
}[])) => void;
|
|
34
|
+
disabled: boolean;
|
|
35
|
+
onCardMovedBetweenGroups?: (card: NavigationEntry) => void;
|
|
36
|
+
onGroupMoved?: (groupName: string, oldIndex: number, newIndex: number) => void;
|
|
37
|
+
onNewGroupDrop?: () => void;
|
|
38
|
+
onPersist?: (latest: {
|
|
39
|
+
name: string;
|
|
40
|
+
entries: NavigationEntry[];
|
|
41
|
+
}[]) => void;
|
|
42
|
+
}): {
|
|
43
|
+
sensors: import("@dnd-kit/core").SensorDescriptor<import("@dnd-kit/core").SensorOptions>[];
|
|
44
|
+
collisionDetection: CollisionDetection;
|
|
45
|
+
onDragStart: ({ active }: {
|
|
46
|
+
active: Active;
|
|
47
|
+
}) => void;
|
|
48
|
+
onDragOver: ({ active, over }: {
|
|
49
|
+
active: Active;
|
|
50
|
+
over: any;
|
|
51
|
+
}) => void;
|
|
52
|
+
onDragEnd: ({ active, over }: {
|
|
53
|
+
active: Active;
|
|
54
|
+
over: any;
|
|
55
|
+
}) => void;
|
|
56
|
+
onDragCancel: () => void;
|
|
57
|
+
dropAnimation: DropAnimation;
|
|
58
|
+
activeItemForOverlay: NavigationEntry | null;
|
|
59
|
+
activeGroupData: {
|
|
60
|
+
name: string;
|
|
61
|
+
entries: NavigationEntry[];
|
|
62
|
+
} | null;
|
|
63
|
+
draggingGroupId: UniqueIdentifier | null;
|
|
64
|
+
containers: string[];
|
|
65
|
+
dndKitActiveNode: Active | null;
|
|
66
|
+
isDraggingCardOnly: boolean;
|
|
67
|
+
dialogOpenForGroup: string | null;
|
|
68
|
+
setDialogOpenForGroup: React.Dispatch<React.SetStateAction<string | null>>;
|
|
69
|
+
handleRenameGroup: (oldName: string, newName: string) => void;
|
|
70
|
+
isHoveringNewGroupDropZone: boolean;
|
|
71
|
+
setIsHoveringNewGroupDropZone: React.Dispatch<React.SetStateAction<boolean>>;
|
|
72
|
+
};
|
|
73
|
+
export declare function NewGroupDropZone({ disabled, setIsHovering }: {
|
|
74
|
+
disabled: boolean;
|
|
75
|
+
setIsHovering: (v: boolean) => void;
|
|
76
|
+
}): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
export type NavigationCardProps = {
|
|
2
3
|
name: string;
|
|
3
4
|
description?: string;
|
|
4
5
|
actions: React.ReactNode;
|
|
5
6
|
icon: React.ReactNode;
|
|
6
7
|
onClick?: () => void;
|
|
8
|
+
shrink?: boolean;
|
|
7
9
|
};
|
|
8
|
-
export declare
|
|
10
|
+
export declare const NavigationCard: React.NamedExoticComponent<NavigationCardProps>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NavigationEntry } from "../../types";
|
|
2
2
|
/**
|
|
3
3
|
* This is the component used in the home page to render a card for each
|
|
4
4
|
* collection or view.
|
|
@@ -12,6 +12,7 @@ import { TopNavigationEntry } from "../../types";
|
|
|
12
12
|
* @param onClick
|
|
13
13
|
|
|
14
14
|
*/
|
|
15
|
-
export declare function NavigationCardBinding({ path, collection, view, url, name, description, onClick, type }:
|
|
15
|
+
export declare function NavigationCardBinding({ path, collection, view, url, name, description, onClick, type, shrink }: NavigationEntry & {
|
|
16
16
|
onClick?: () => void;
|
|
17
|
+
shrink?: boolean;
|
|
17
18
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { PropsWithChildren } from "react";
|
|
2
|
-
export declare function NavigationGroup({ children, group
|
|
2
|
+
export declare function NavigationGroup({ children, group, minimised, isPreview, isPotentialCardDropTarget, onEditGroup, // New prop to handle editing
|
|
3
|
+
dndDisabled }: PropsWithChildren<{
|
|
3
4
|
group: string | undefined;
|
|
5
|
+
minimised?: boolean;
|
|
6
|
+
isPreview?: boolean;
|
|
7
|
+
isPotentialCardDropTarget?: boolean;
|
|
8
|
+
onEditGroup?: (groupName: string) => void;
|
|
9
|
+
dndDisabled?: boolean;
|
|
4
10
|
}>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
interface RenameGroupDialogProps {
|
|
2
|
+
open: boolean;
|
|
3
|
+
initialName: string;
|
|
4
|
+
existingGroupNames: string[];
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
onRename: (newName: string) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare function RenameGroupDialog({ open, initialName, existingGroupNames, onClose, onRename }: RenameGroupDialogProps): import("react/jsx-runtime").JSX.Element | null;
|
|
9
|
+
export {};
|
|
@@ -3,5 +3,5 @@ export declare function isDefaultFieldConfigId(id: string): boolean;
|
|
|
3
3
|
export declare const DEFAULT_FIELD_CONFIGS: Record<string, PropertyConfig<any>>;
|
|
4
4
|
export declare function getDefaultFieldConfig(property: Property | ResolvedProperty): PropertyConfig | undefined;
|
|
5
5
|
export declare function getFieldConfig(property: Property | ResolvedProperty, propertyConfigs: Record<string, PropertyConfig<any>>): PropertyConfig | undefined;
|
|
6
|
-
export declare function getDefaultFieldId(property: Property | ResolvedProperty): "reference" | "date_time" | "text_field" | "multiline" | "markdown" | "url" | "email" | "select" | "multi_select" | "number_input" | "number_select" | "multi_number_select" | "file_upload" | "multi_file_upload" | "group" | "key_value" | "multi_references" | "switch" | "repeat" | "custom_array" | "block" | undefined;
|
|
6
|
+
export declare function getDefaultFieldId(property: Property | ResolvedProperty): "reference" | "date_time" | "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_as_string" | "multi_references" | "switch" | "repeat" | "custom_array" | "block" | undefined;
|
|
7
7
|
export declare function getFieldId(property: Property | ResolvedProperty): string | undefined;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FieldProps } from "../../types";
|
|
2
|
+
/**
|
|
3
|
+
* Field that opens a reference selection dialog and stores the entity ID as a string.
|
|
4
|
+
*
|
|
5
|
+
* This is one of the internal components that get mapped natively inside forms
|
|
6
|
+
* and tables to the specified properties.
|
|
7
|
+
* @group Form fields
|
|
8
|
+
*/
|
|
9
|
+
export declare function ReferenceAsStringFieldBinding(props: FieldProps<string>): import("react/jsx-runtime").JSX.Element;
|
package/dist/form/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export { TextFieldBinding } from "./field_bindings/TextFieldBinding";
|
|
|
7
7
|
export { SwitchFieldBinding } from "./field_bindings/SwitchFieldBinding";
|
|
8
8
|
export { DateTimeFieldBinding } from "./field_bindings/DateTimeFieldBinding";
|
|
9
9
|
export { ReferenceFieldBinding } from "./field_bindings/ReferenceFieldBinding";
|
|
10
|
+
export { ReferenceAsStringFieldBinding } from "./field_bindings/ReferenceAsStringFieldBinding";
|
|
10
11
|
export { MapFieldBinding } from "./field_bindings/MapFieldBinding";
|
|
11
12
|
export { KeyValueFieldBinding } from "./field_bindings/KeyValueFieldBinding";
|
|
12
13
|
export { RepeatFieldBinding } from "./field_bindings/RepeatFieldBinding";
|
|
@@ -1,19 +1,68 @@
|
|
|
1
|
-
import { AuthController, CMSView, CMSViewsBuilder, DataSourceDelegate, EntityCollection, EntityCollectionsBuilder, FireCMSPlugin, NavigationController, PermissionsBuilder, User, UserConfigurationPersistence } from "../types";
|
|
1
|
+
import { AuthController, CMSView, CMSViewsBuilder, DataSourceDelegate, EntityCollection, EntityCollectionsBuilder, FireCMSPlugin, NavigationController, NavigationGroupMapping, PermissionsBuilder, User, UserConfigurationPersistence } from "../types";
|
|
2
|
+
export declare const NAVIGATION_DEFAULT_GROUP_NAME = "Views";
|
|
3
|
+
export declare const NAVIGATION_ADMIN_GROUP_NAME = "Admin";
|
|
2
4
|
export type BuildNavigationContextProps<EC extends EntityCollection, USER extends User> = {
|
|
5
|
+
/**
|
|
6
|
+
* Base path for the CMS, used to build the all the URLs.
|
|
7
|
+
* Defaults to "/".
|
|
8
|
+
*/
|
|
3
9
|
basePath?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Base path for the collections, used to build the collection URLs.
|
|
12
|
+
* Defaults to "c" (e.g. "/c/products").
|
|
13
|
+
*/
|
|
4
14
|
baseCollectionPath?: string;
|
|
15
|
+
/**
|
|
16
|
+
* The auth controller used to manage the user authentication and permissions.
|
|
17
|
+
*/
|
|
5
18
|
authController: AuthController<USER>;
|
|
19
|
+
/**
|
|
20
|
+
* The collections to be used in the CMS.
|
|
21
|
+
* This can be a static array of collections or a function that returns a promise
|
|
22
|
+
* resolving to an array of collections.
|
|
23
|
+
*/
|
|
6
24
|
collections?: EC[] | EntityCollectionsBuilder<EC>;
|
|
25
|
+
/**
|
|
26
|
+
* Optional permissions builder to be applied to the collections.
|
|
27
|
+
* If not provided, the permissions will be resolved from the collection configuration.
|
|
28
|
+
*/
|
|
7
29
|
collectionPermissions?: PermissionsBuilder;
|
|
30
|
+
/**
|
|
31
|
+
* Custom views to be added to the CMS, these will be available in the main navigation.
|
|
32
|
+
* This can be a static array of views or a function that returns a promise
|
|
33
|
+
* resolving to an array of views.
|
|
34
|
+
*/
|
|
8
35
|
views?: CMSView[] | CMSViewsBuilder;
|
|
36
|
+
/**
|
|
37
|
+
* Custom views to be added to the CMS admin navigation.
|
|
38
|
+
* This can be a static array of views or a function that returns a promise
|
|
39
|
+
* resolving to an array of views.
|
|
40
|
+
*/
|
|
9
41
|
adminViews?: CMSView[] | CMSViewsBuilder;
|
|
10
|
-
|
|
42
|
+
/**
|
|
43
|
+
* Controller for storing user preferences.
|
|
44
|
+
*/
|
|
11
45
|
userConfigPersistence?: UserConfigurationPersistence;
|
|
46
|
+
/**
|
|
47
|
+
* Delegate for data source operations, used to resolve collections and views.
|
|
48
|
+
*/
|
|
12
49
|
dataSourceDelegate: DataSourceDelegate;
|
|
50
|
+
/**
|
|
51
|
+
* Plugins to be used in the CMS.
|
|
52
|
+
*/
|
|
13
53
|
plugins?: FireCMSPlugin[];
|
|
54
|
+
/**
|
|
55
|
+
* Used to define the name of groups and order of the navigation entries.
|
|
56
|
+
*/
|
|
57
|
+
navigationGroupMappings?: NavigationGroupMapping[];
|
|
14
58
|
/**
|
|
15
59
|
* If true, the navigation logic will not be updated until this flag is false
|
|
16
60
|
*/
|
|
17
61
|
disabled?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* @deprecated
|
|
64
|
+
* Use `navigationGroupMappings` instead.
|
|
65
|
+
*/
|
|
66
|
+
viewsOrder?: string[];
|
|
18
67
|
};
|
|
19
68
|
export declare function useBuildNavigationController<EC extends EntityCollection, USER extends User>(props: BuildNavigationContextProps<EC, USER>): NavigationController;
|