@firecms/collection_editor 3.0.0-canary.21 → 3.0.0-canary.211
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/LICENSE +114 -21
- package/dist/ConfigControllerProvider.d.ts +2 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +10060 -4770
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +10750 -3
- package/dist/index.umd.js.map +1 -1
- package/dist/types/collection_editor_controller.d.ts +4 -2
- package/dist/types/collection_inference.d.ts +1 -1
- package/dist/types/config_permissions.d.ts +2 -2
- package/dist/types/persisted_collection.d.ts +1 -1
- package/dist/ui/CollectionViewHeaderAction.d.ts +3 -2
- package/dist/ui/EditorCollectionActionStart.d.ts +2 -0
- package/dist/ui/PropertyAddColumnComponent.d.ts +3 -1
- package/dist/ui/collection_editor/CollectionDetailsForm.d.ts +3 -1
- package/dist/ui/collection_editor/CollectionEditorDialog.d.ts +3 -2
- package/dist/ui/collection_editor/CollectionEditorWelcomeView.d.ts +1 -1
- package/dist/ui/collection_editor/CollectionPropertiesEditorForm.d.ts +1 -1
- package/dist/ui/collection_editor/LayoutModeSwitch.d.ts +5 -0
- package/dist/ui/collection_editor/PropertyEditView.d.ts +8 -0
- package/dist/ui/collection_editor/PropertyTree.d.ts +9 -9
- package/dist/ui/collection_editor/SubcollectionsEditTab.d.ts +1 -1
- package/dist/ui/collection_editor/import/CollectionEditorImportMapping.d.ts +7 -0
- package/dist/ui/collection_editor/properties/MarkdownPropertyField.d.ts +4 -0
- package/dist/ui/collection_editor/properties/StringPropertyField.d.ts +1 -1
- package/dist/useCollectionEditorPlugin.d.ts +8 -11
- package/dist/utils/collections.d.ts +6 -0
- package/package.json +24 -35
- package/src/ConfigControllerProvider.tsx +67 -64
- package/src/index.ts +1 -0
- package/src/types/collection_editor_controller.tsx +7 -4
- package/src/types/collection_inference.ts +1 -1
- package/src/types/config_permissions.ts +1 -1
- package/src/types/persisted_collection.ts +2 -3
- package/src/ui/CollectionViewHeaderAction.tsx +10 -5
- package/src/ui/EditorCollectionAction.tsx +10 -63
- package/src/ui/EditorCollectionActionStart.tsx +88 -0
- package/src/ui/HomePageEditorCollectionAction.tsx +19 -13
- package/src/ui/NewCollectionButton.tsx +1 -1
- package/src/ui/NewCollectionCard.tsx +3 -3
- package/src/ui/PropertyAddColumnComponent.tsx +11 -6
- package/src/ui/collection_editor/CollectionDetailsForm.tsx +89 -12
- package/src/ui/collection_editor/CollectionEditorDialog.tsx +101 -34
- package/src/ui/collection_editor/CollectionEditorWelcomeView.tsx +8 -7
- package/src/ui/collection_editor/CollectionPropertiesEditorForm.tsx +37 -36
- package/src/ui/collection_editor/EntityCustomViewsSelectDialog.tsx +6 -5
- package/src/ui/collection_editor/EnumForm.tsx +10 -6
- package/src/ui/collection_editor/GetCodeDialog.tsx +56 -26
- package/src/ui/collection_editor/LayoutModeSwitch.tsx +54 -0
- package/src/ui/collection_editor/PropertyEditView.tsx +257 -79
- package/src/ui/collection_editor/PropertyFieldPreview.tsx +7 -10
- package/src/ui/collection_editor/PropertyTree.tsx +9 -7
- package/src/ui/collection_editor/SubcollectionsEditTab.tsx +26 -19
- package/src/ui/collection_editor/UnsavedChangesDialog.tsx +3 -5
- package/src/ui/collection_editor/import/CollectionEditorImportDataPreview.tsx +26 -9
- package/src/ui/collection_editor/import/CollectionEditorImportMapping.tsx +42 -9
- package/src/ui/collection_editor/properties/BlockPropertyField.tsx +32 -20
- package/src/ui/collection_editor/properties/DateTimePropertyField.tsx +54 -47
- package/src/ui/collection_editor/properties/EnumPropertyField.tsx +3 -1
- package/src/ui/collection_editor/properties/MapPropertyField.tsx +7 -6
- package/src/ui/collection_editor/properties/MarkdownPropertyField.tsx +139 -0
- package/src/ui/collection_editor/properties/ReferencePropertyField.tsx +2 -0
- package/src/ui/collection_editor/properties/RepeatPropertyField.tsx +0 -1
- package/src/ui/collection_editor/properties/StoragePropertyField.tsx +34 -19
- package/src/ui/collection_editor/properties/StringPropertyField.tsx +1 -10
- package/src/ui/collection_editor/properties/UrlPropertyField.tsx +1 -0
- package/src/ui/collection_editor/properties/validation/ValidationPanel.tsx +2 -2
- package/src/ui/collection_editor/templates/pages_template.ts +1 -6
- package/src/useCollectionEditorPlugin.tsx +33 -32
- package/src/utils/collections.ts +36 -0
- package/dist/ui/RootCollectionSuggestions.d.ts +0 -3
- package/dist/ui/collection_editor/PropertySelectItem.d.ts +0 -8
- package/src/ui/RootCollectionSuggestions.tsx +0 -63
- package/src/ui/collection_editor/PropertySelectItem.tsx +0 -32
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
import { CollectionEditorPermissionsBuilder } from "./config_permissions";
|
|
2
|
-
import { Property } from "@firecms/core";
|
|
3
|
+
import { Entity, Property } from "@firecms/core";
|
|
3
4
|
import { PersistedCollection } from "./persisted_collection";
|
|
4
5
|
|
|
5
6
|
/**
|
|
@@ -12,7 +13,8 @@ export interface CollectionEditorController {
|
|
|
12
13
|
id?: string,
|
|
13
14
|
fullPath?: string,
|
|
14
15
|
parentCollectionIds: string[],
|
|
15
|
-
parentCollection?: PersistedCollection
|
|
16
|
+
parentCollection?: PersistedCollection,
|
|
17
|
+
existingEntities?: Entity<any>[]
|
|
16
18
|
}) => void;
|
|
17
19
|
|
|
18
20
|
createCollection: (props: {
|
|
@@ -33,11 +35,12 @@ export interface CollectionEditorController {
|
|
|
33
35
|
currentPropertiesOrder?: string[],
|
|
34
36
|
editedCollectionId: string,
|
|
35
37
|
parentCollectionIds: string[],
|
|
36
|
-
collection: PersistedCollection
|
|
38
|
+
collection: PersistedCollection,
|
|
39
|
+
existingEntities: Entity<any>[]
|
|
37
40
|
}) => void;
|
|
38
41
|
|
|
39
42
|
configPermissions: CollectionEditorPermissionsBuilder;
|
|
40
43
|
|
|
41
|
-
|
|
44
|
+
getPathSuggestions?: (path: string) => Promise<string[]>;
|
|
42
45
|
|
|
43
46
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { EntityCollection } from "@firecms/core";
|
|
2
2
|
|
|
3
|
-
export type CollectionInference = (path: string, collectionGroup: boolean,
|
|
3
|
+
export type CollectionInference = (path: string, collectionGroup: boolean, parentCollectionPaths: string[]) => Promise<Partial<EntityCollection> | null>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EntityCollection } from "@firecms/core";
|
|
2
2
|
|
|
3
|
-
export type CollectionEditorPermissionsBuilder<
|
|
3
|
+
export type CollectionEditorPermissionsBuilder<USER = any, EC extends EntityCollection = EntityCollection> = (params: { user: USER | null, collection?: EC }) => CollectionEditorPermissions;
|
|
4
4
|
|
|
5
5
|
export type CollectionEditorPermissions = {
|
|
6
6
|
/**
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { EntityCollection, User } from "@firecms/core";
|
|
2
2
|
|
|
3
|
-
export type PersistedCollection<M extends Record<string, any> = any,
|
|
4
|
-
= Omit<EntityCollection<M,
|
|
5
|
-
// properties: Properties<M>;
|
|
3
|
+
export type PersistedCollection<M extends Record<string, any> = any, USER extends User = User>
|
|
4
|
+
= Omit<EntityCollection<M, USER>, "subcollections"> & {
|
|
6
5
|
ownerId?: string;
|
|
7
6
|
subcollections?: PersistedCollection<any, any>[];
|
|
8
7
|
editable?: boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ResolvedProperty } from "@firecms/core";
|
|
1
|
+
import { EntityTableController, ResolvedProperty } from "@firecms/core";
|
|
2
2
|
import { IconButton, SettingsIcon, Tooltip } from "@firecms/ui";
|
|
3
3
|
import React from "react";
|
|
4
4
|
import { useCollectionEditorController } from "../useCollectionEditorController";
|
|
@@ -10,7 +10,8 @@ export function CollectionViewHeaderAction({
|
|
|
10
10
|
property,
|
|
11
11
|
fullPath,
|
|
12
12
|
parentCollectionIds,
|
|
13
|
-
collection
|
|
13
|
+
collection,
|
|
14
|
+
tableController
|
|
14
15
|
}: {
|
|
15
16
|
property: ResolvedProperty,
|
|
16
17
|
propertyKey: string,
|
|
@@ -18,21 +19,25 @@ export function CollectionViewHeaderAction({
|
|
|
18
19
|
fullPath: string,
|
|
19
20
|
parentCollectionIds: string[],
|
|
20
21
|
collection: PersistedCollection;
|
|
22
|
+
tableController: EntityTableController;
|
|
21
23
|
}) {
|
|
22
24
|
|
|
23
25
|
const collectionEditorController = useCollectionEditorController();
|
|
24
26
|
|
|
25
27
|
return (
|
|
26
|
-
<Tooltip
|
|
28
|
+
<Tooltip
|
|
29
|
+
asChild={true}
|
|
30
|
+
title={"Edit"}>
|
|
27
31
|
<IconButton
|
|
28
|
-
className={onHover ? "bg-white dark:bg-
|
|
32
|
+
className={onHover ? "bg-white dark:bg-surface-950" : "hidden"}
|
|
29
33
|
onClick={() => {
|
|
30
34
|
collectionEditorController.editProperty({
|
|
31
35
|
propertyKey,
|
|
32
36
|
property,
|
|
33
37
|
editedCollectionId: collection.id,
|
|
34
38
|
parentCollectionIds,
|
|
35
|
-
collection
|
|
39
|
+
collection,
|
|
40
|
+
existingEntities: tableController.data ?? []
|
|
36
41
|
});
|
|
37
42
|
}}
|
|
38
43
|
size={"small"}>
|
|
@@ -1,16 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
CollectionActionsProps,
|
|
5
|
-
mergeDeep,
|
|
6
|
-
useAuthController,
|
|
7
|
-
useNavigationController,
|
|
8
|
-
useSnackbarController
|
|
9
|
-
} from "@firecms/core";
|
|
10
|
-
import { Button, IconButton, SaveIcon, SettingsIcon, Tooltip, UndoIcon, } from "@firecms/ui";
|
|
1
|
+
import { CollectionActionsProps, useAuthController, useNavigationController } from "@firecms/core";
|
|
2
|
+
import { IconButton, SettingsIcon, Tooltip, } from "@firecms/ui";
|
|
11
3
|
|
|
12
4
|
import { useCollectionEditorController } from "../useCollectionEditorController";
|
|
13
|
-
import { useCollectionsConfigController } from "../useCollectionsConfigController";
|
|
14
5
|
import { PersistedCollection } from "../types/persisted_collection";
|
|
15
6
|
|
|
16
7
|
export function EditorCollectionAction({
|
|
@@ -23,8 +14,6 @@ export function EditorCollectionAction({
|
|
|
23
14
|
const authController = useAuthController();
|
|
24
15
|
const navigationController = useNavigationController();
|
|
25
16
|
const collectionEditorController = useCollectionEditorController();
|
|
26
|
-
const configController = useCollectionsConfigController();
|
|
27
|
-
const snackbarController = useSnackbarController();
|
|
28
17
|
|
|
29
18
|
const parentCollection = navigationController.getCollectionFromIds(parentCollectionIds);
|
|
30
19
|
|
|
@@ -35,68 +24,26 @@ export function EditorCollectionAction({
|
|
|
35
24
|
}).editCollections
|
|
36
25
|
: true;
|
|
37
26
|
|
|
38
|
-
let saveDefaultFilterButton = null;
|
|
39
|
-
if (!equal(getObjectOrNull(tableController.filterValues), getObjectOrNull(collection.initialFilter)) ||
|
|
40
|
-
!equal(getObjectOrNull(tableController.sortBy), getObjectOrNull(collection.initialSort))) {
|
|
41
|
-
saveDefaultFilterButton = <>
|
|
42
|
-
{(collection.initialFilter || collection.initialSort) && <Tooltip
|
|
43
|
-
title={"Reset to default filter and sort"}>
|
|
44
|
-
<Button
|
|
45
|
-
color={"primary"}
|
|
46
|
-
size={"small"}
|
|
47
|
-
variant={"text"}
|
|
48
|
-
onClick={() => {
|
|
49
|
-
tableController.clearFilter?.();
|
|
50
|
-
if (collection?.initialFilter)
|
|
51
|
-
tableController.setFilterValues?.(collection?.initialFilter);
|
|
52
|
-
if (collection?.initialSort)
|
|
53
|
-
tableController.setSortBy?.(collection?.initialSort);
|
|
54
|
-
}}>
|
|
55
|
-
<UndoIcon/>
|
|
56
|
-
</Button>
|
|
57
|
-
</Tooltip>}
|
|
58
|
-
|
|
59
|
-
<Tooltip
|
|
60
|
-
title={tableController.sortBy || tableController.filterValues ? "Save default filter and sort" : "Clear default filter and sort"}>
|
|
61
|
-
<Button
|
|
62
|
-
color={"primary"}
|
|
63
|
-
size={"small"}
|
|
64
|
-
variant={"outlined"}
|
|
65
|
-
onClick={() => configController
|
|
66
|
-
?.saveCollection({
|
|
67
|
-
id: collection.id,
|
|
68
|
-
parentCollectionIds,
|
|
69
|
-
collectionData: mergeDeep(collection as PersistedCollection,
|
|
70
|
-
{
|
|
71
|
-
initialFilter: tableController.filterValues ?? null,
|
|
72
|
-
initialSort: tableController.sortBy ?? null
|
|
73
|
-
})
|
|
74
|
-
}).then(() => {
|
|
75
|
-
snackbarController.open({
|
|
76
|
-
type: "success",
|
|
77
|
-
message: "Default config saved"
|
|
78
|
-
});
|
|
79
|
-
})}>
|
|
80
|
-
<SaveIcon/>
|
|
81
|
-
</Button>
|
|
82
|
-
</Tooltip>
|
|
83
|
-
</>;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
27
|
const editorButton = <Tooltip
|
|
28
|
+
asChild={true}
|
|
87
29
|
title={canEditCollection ? "Edit collection" : "You don't have permissions to edit this collection"}>
|
|
88
30
|
<IconButton
|
|
89
31
|
color={"primary"}
|
|
90
32
|
disabled={!canEditCollection}
|
|
91
33
|
onClick={canEditCollection
|
|
92
|
-
? () => collectionEditorController?.editCollection({
|
|
34
|
+
? () => collectionEditorController?.editCollection({
|
|
35
|
+
id: collection.id,
|
|
36
|
+
fullPath,
|
|
37
|
+
parentCollectionIds,
|
|
38
|
+
parentCollection: parentCollection as PersistedCollection,
|
|
39
|
+
existingEntities: tableController?.data ?? []
|
|
40
|
+
})
|
|
93
41
|
: undefined}>
|
|
94
42
|
<SettingsIcon/>
|
|
95
43
|
</IconButton>
|
|
96
44
|
</Tooltip>;
|
|
97
45
|
|
|
98
46
|
return <>
|
|
99
|
-
{canEditCollection && saveDefaultFilterButton}
|
|
100
47
|
{editorButton}
|
|
101
48
|
</>
|
|
102
49
|
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import equal from "react-fast-compare"
|
|
2
|
+
|
|
3
|
+
import { CollectionActionsProps, mergeDeep, useAuthController, useSnackbarController } from "@firecms/core";
|
|
4
|
+
import { Button, SaveIcon, Tooltip, UndoIcon, } from "@firecms/ui";
|
|
5
|
+
|
|
6
|
+
import { useCollectionEditorController } from "../useCollectionEditorController";
|
|
7
|
+
import { useCollectionsConfigController } from "../useCollectionsConfigController";
|
|
8
|
+
import { PersistedCollection } from "../types/persisted_collection";
|
|
9
|
+
|
|
10
|
+
export function EditorCollectionActionStart({
|
|
11
|
+
path: fullPath,
|
|
12
|
+
parentCollectionIds,
|
|
13
|
+
collection,
|
|
14
|
+
tableController
|
|
15
|
+
}: CollectionActionsProps) {
|
|
16
|
+
|
|
17
|
+
const authController = useAuthController();
|
|
18
|
+
const collectionEditorController = useCollectionEditorController();
|
|
19
|
+
const configController = useCollectionsConfigController();
|
|
20
|
+
const snackbarController = useSnackbarController();
|
|
21
|
+
|
|
22
|
+
const canEditCollection = collectionEditorController.configPermissions
|
|
23
|
+
? collectionEditorController.configPermissions({
|
|
24
|
+
user: authController.user,
|
|
25
|
+
collection
|
|
26
|
+
}).editCollections
|
|
27
|
+
: true;
|
|
28
|
+
|
|
29
|
+
let saveDefaultFilterButton = null;
|
|
30
|
+
if (!equal(getObjectOrNull(tableController.filterValues), getObjectOrNull(collection.initialFilter)) ||
|
|
31
|
+
!equal(getObjectOrNull(tableController.sortBy), getObjectOrNull(collection.initialSort))) {
|
|
32
|
+
saveDefaultFilterButton = <>
|
|
33
|
+
<Tooltip
|
|
34
|
+
asChild={true}
|
|
35
|
+
title={tableController.sortBy || tableController.filterValues ? "Save default filter and sort" : "Clear default filter and sort"}>
|
|
36
|
+
<Button
|
|
37
|
+
color={"primary"}
|
|
38
|
+
size={"small"}
|
|
39
|
+
variant={"outlined"}
|
|
40
|
+
onClick={() => configController
|
|
41
|
+
?.saveCollection({
|
|
42
|
+
id: collection.id,
|
|
43
|
+
parentCollectionIds,
|
|
44
|
+
collectionData: mergeDeep(collection as PersistedCollection,
|
|
45
|
+
{
|
|
46
|
+
initialFilter: tableController.filterValues ?? null,
|
|
47
|
+
initialSort: tableController.sortBy ?? null
|
|
48
|
+
})
|
|
49
|
+
}).then(() => {
|
|
50
|
+
snackbarController.open({
|
|
51
|
+
type: "success",
|
|
52
|
+
message: "Default config saved"
|
|
53
|
+
});
|
|
54
|
+
})}>
|
|
55
|
+
<SaveIcon/>
|
|
56
|
+
</Button>
|
|
57
|
+
</Tooltip>
|
|
58
|
+
|
|
59
|
+
{(collection.initialFilter || collection.initialSort) && <Tooltip
|
|
60
|
+
title={"Reset to default filter and sort"}>
|
|
61
|
+
<Button
|
|
62
|
+
color={"primary"}
|
|
63
|
+
size={"small"}
|
|
64
|
+
variant={"text"}
|
|
65
|
+
onClick={() => {
|
|
66
|
+
tableController.clearFilter?.();
|
|
67
|
+
if (collection?.initialFilter)
|
|
68
|
+
tableController.setFilterValues?.(collection?.initialFilter);
|
|
69
|
+
if (collection?.initialSort)
|
|
70
|
+
tableController.setSortBy?.(collection?.initialSort);
|
|
71
|
+
}}>
|
|
72
|
+
<UndoIcon/>
|
|
73
|
+
</Button>
|
|
74
|
+
</Tooltip>}
|
|
75
|
+
</>;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return <>
|
|
79
|
+
{canEditCollection && saveDefaultFilterButton}
|
|
80
|
+
</>
|
|
81
|
+
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function getObjectOrNull(o?: object): object | null {
|
|
85
|
+
if (o && Object.keys(o).length === 0)
|
|
86
|
+
return o
|
|
87
|
+
return o ?? null;
|
|
88
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
ConfirmationDialog,
|
|
3
3
|
PluginHomePageActionsProps,
|
|
4
4
|
useAuthController,
|
|
5
5
|
useSnackbarController
|
|
6
6
|
} from "@firecms/core";
|
|
7
7
|
import { DeleteIcon, IconButton, Menu, MenuItem, MoreVertIcon, SettingsIcon, } from "@firecms/ui";
|
|
8
8
|
import { useCollectionEditorController } from "../useCollectionEditorController";
|
|
9
|
-
import {
|
|
9
|
+
import { useState } from "react";
|
|
10
10
|
import { useCollectionsConfigController } from "../useCollectionsConfigController";
|
|
11
11
|
|
|
12
12
|
export function HomePageEditorCollectionAction({
|
|
@@ -14,6 +14,7 @@ export function HomePageEditorCollectionAction({
|
|
|
14
14
|
collection
|
|
15
15
|
}: PluginHomePageActionsProps) {
|
|
16
16
|
|
|
17
|
+
|
|
17
18
|
const snackbarController = useSnackbarController();
|
|
18
19
|
const authController = useAuthController();
|
|
19
20
|
const configController = useCollectionsConfigController();
|
|
@@ -24,13 +25,16 @@ export function HomePageEditorCollectionAction({
|
|
|
24
25
|
collection
|
|
25
26
|
});
|
|
26
27
|
|
|
27
|
-
const onEditCollectionClicked =
|
|
28
|
-
collectionEditorController?.editCollection({
|
|
29
|
-
|
|
28
|
+
const onEditCollectionClicked = () => {
|
|
29
|
+
collectionEditorController?.editCollection({
|
|
30
|
+
id: collection.id,
|
|
31
|
+
parentCollectionIds: []
|
|
32
|
+
});
|
|
33
|
+
};
|
|
30
34
|
|
|
31
35
|
const [deleteRequested, setDeleteRequested] = useState(false);
|
|
32
36
|
|
|
33
|
-
const deleteCollection =
|
|
37
|
+
const deleteCollection = () => {
|
|
34
38
|
configController?.deleteCollection({ id: collection.id }).then(() => {
|
|
35
39
|
setDeleteRequested(false);
|
|
36
40
|
snackbarController.open({
|
|
@@ -38,7 +42,7 @@ export function HomePageEditorCollectionAction({
|
|
|
38
42
|
type: "success"
|
|
39
43
|
});
|
|
40
44
|
});
|
|
41
|
-
}
|
|
45
|
+
};
|
|
42
46
|
|
|
43
47
|
return <>
|
|
44
48
|
|
|
@@ -49,11 +53,13 @@ export function HomePageEditorCollectionAction({
|
|
|
49
53
|
<MoreVertIcon size={"small"}/>
|
|
50
54
|
</IconButton>}
|
|
51
55
|
>
|
|
52
|
-
<MenuItem
|
|
53
|
-
|
|
54
|
-
event
|
|
55
|
-
|
|
56
|
-
|
|
56
|
+
<MenuItem
|
|
57
|
+
dense={true}
|
|
58
|
+
onClick={(event) => {
|
|
59
|
+
event.preventDefault();
|
|
60
|
+
event.stopPropagation();
|
|
61
|
+
setDeleteRequested(true);
|
|
62
|
+
}}>
|
|
57
63
|
<DeleteIcon/>
|
|
58
64
|
Delete
|
|
59
65
|
</MenuItem>
|
|
@@ -71,7 +77,7 @@ export function HomePageEditorCollectionAction({
|
|
|
71
77
|
</IconButton>}
|
|
72
78
|
</div>
|
|
73
79
|
|
|
74
|
-
<
|
|
80
|
+
<ConfirmationDialog
|
|
75
81
|
open={deleteRequested}
|
|
76
82
|
onAccept={deleteCollection}
|
|
77
83
|
onCancel={() => setDeleteRequested(false)}
|
|
@@ -3,7 +3,7 @@ import { useCollectionEditorController } from "../useCollectionEditorController"
|
|
|
3
3
|
|
|
4
4
|
export function NewCollectionButton() {
|
|
5
5
|
const collectionEditorController = useCollectionEditorController();
|
|
6
|
-
return <div className={"bg-
|
|
6
|
+
return <div className={"bg-surface-50 dark:bg-surface-900 min-w-fit rounded"}>
|
|
7
7
|
<Button className={"min-w-fit"}
|
|
8
8
|
variant={"outlined"}
|
|
9
9
|
onClick={() => collectionEditorController.createCollection({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PluginHomePageAdditionalCardsProps, useAuthController } from "@firecms/core";
|
|
2
|
-
import { AddIcon, Card,
|
|
2
|
+
import { AddIcon, Card, cls, Typography } from "@firecms/ui";
|
|
3
3
|
import { useCollectionEditorController } from "../useCollectionEditorController";
|
|
4
4
|
|
|
5
5
|
export function NewCollectionCard({
|
|
@@ -20,7 +20,7 @@ export function NewCollectionCard({
|
|
|
20
20
|
: true;
|
|
21
21
|
|
|
22
22
|
return (
|
|
23
|
-
<Card className={
|
|
23
|
+
<Card className={cls("h-full p-4 min-h-[124px]")}
|
|
24
24
|
onClick={collectionEditorController && canCreateCollections
|
|
25
25
|
? () => collectionEditorController.createCollection({
|
|
26
26
|
initialValues: group ? { group } : undefined,
|
|
@@ -31,7 +31,7 @@ export function NewCollectionCard({
|
|
|
31
31
|
: undefined}>
|
|
32
32
|
|
|
33
33
|
<div
|
|
34
|
-
className="flex
|
|
34
|
+
className="flex items-center justify-center h-full w-full flex-grow flex-col">
|
|
35
35
|
<AddIcon color="primary" size={"large"}/>
|
|
36
36
|
<Typography color="primary"
|
|
37
37
|
variant={"caption"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getDefaultPropertiesOrder, useAuthController } from "@firecms/core";
|
|
1
|
+
import { EntityTableController, getDefaultPropertiesOrder, useAuthController } from "@firecms/core";
|
|
2
2
|
import { AddIcon, Tooltip } from "@firecms/ui";
|
|
3
3
|
import { useCollectionEditorController } from "../useCollectionEditorController";
|
|
4
4
|
import { PersistedCollection } from "../types/persisted_collection";
|
|
@@ -6,11 +6,13 @@ import { PersistedCollection } from "../types/persisted_collection";
|
|
|
6
6
|
export function PropertyAddColumnComponent({
|
|
7
7
|
fullPath,
|
|
8
8
|
parentCollectionIds,
|
|
9
|
-
collection
|
|
9
|
+
collection,
|
|
10
|
+
tableController
|
|
10
11
|
}: {
|
|
11
12
|
fullPath: string,
|
|
12
13
|
parentCollectionIds: string[],
|
|
13
14
|
collection: PersistedCollection;
|
|
15
|
+
tableController: EntityTableController;
|
|
14
16
|
}) {
|
|
15
17
|
|
|
16
18
|
const authController = useAuthController();
|
|
@@ -23,16 +25,19 @@ export function PropertyAddColumnComponent({
|
|
|
23
25
|
: true;
|
|
24
26
|
|
|
25
27
|
return (
|
|
26
|
-
<Tooltip
|
|
28
|
+
<Tooltip
|
|
29
|
+
asChild={true}
|
|
30
|
+
title={canEditCollection ? "Add new property" : "You don't have permission to add new properties"}>
|
|
27
31
|
<div
|
|
28
|
-
className={"p-0.5 w-20 h-full flex items-center justify-center cursor-pointer bg-
|
|
29
|
-
// className={onHover ? "bg-white dark:bg-
|
|
32
|
+
className={"p-0.5 w-20 h-full flex items-center justify-center cursor-pointer bg-surface-100 bg-opacity-40 hover:bg-surface-100 dark:bg-surface-950 dark:bg-opacity-40 dark:hover:bg-surface-950"}
|
|
33
|
+
// className={onHover ? "bg-white dark:bg-surface-950" : undefined}
|
|
30
34
|
onClick={() => {
|
|
31
35
|
collectionEditorController.editProperty({
|
|
32
36
|
editedCollectionId: collection.id,
|
|
33
37
|
parentCollectionIds,
|
|
34
38
|
currentPropertiesOrder: getDefaultPropertiesOrder(collection),
|
|
35
|
-
collection
|
|
39
|
+
collection,
|
|
40
|
+
existingEntities: tableController.data
|
|
36
41
|
});
|
|
37
42
|
}}>
|
|
38
43
|
<AddIcon color={"inherit"}/>
|