@firecms/collection_editor 3.0.0-canary.144 → 3.0.0-canary.145
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/index.es.js +13 -13
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +13 -13
- package/dist/index.umd.js.map +1 -1
- package/dist/types/config_permissions.d.ts +2 -2
- package/dist/types/persisted_collection.d.ts +1 -1
- package/dist/useCollectionEditorPlugin.d.ts +4 -4
- package/package.json +8 -8
- package/src/types/config_permissions.ts +1 -1
- package/src/types/persisted_collection.ts +2 -2
- package/src/ui/CollectionViewHeaderAction.tsx +1 -1
- package/src/ui/NewCollectionButton.tsx +1 -1
- package/src/ui/PropertyAddColumnComponent.tsx +2 -2
- package/src/ui/collection_editor/CollectionDetailsForm.tsx +1 -1
- package/src/ui/collection_editor/CollectionEditorDialog.tsx +1 -1
- package/src/ui/collection_editor/CollectionEditorWelcomeView.tsx +2 -2
- package/src/ui/collection_editor/CollectionPropertiesEditorForm.tsx +1 -1
- package/src/ui/collection_editor/PropertyFieldPreview.tsx +1 -1
- package/src/ui/collection_editor/properties/MarkdownPropertyField.tsx +1 -1
- package/src/ui/collection_editor/properties/StoragePropertyField.tsx +1 -1
- package/src/ui/collection_editor/properties/validation/ValidationPanel.tsx +1 -1
- package/src/useCollectionEditorPlugin.tsx +6 -6
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EntityCollection } from "@firecms/core";
|
|
2
|
-
export type CollectionEditorPermissionsBuilder<
|
|
3
|
-
user:
|
|
2
|
+
export type CollectionEditorPermissionsBuilder<USER = any, EC extends EntityCollection = EntityCollection> = (params: {
|
|
3
|
+
user: USER | null;
|
|
4
4
|
collection?: EC;
|
|
5
5
|
}) => CollectionEditorPermissions;
|
|
6
6
|
export type CollectionEditorPermissions = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EntityCollection, User } from "@firecms/core";
|
|
2
|
-
export type PersistedCollection<M extends Record<string, any> = any,
|
|
2
|
+
export type PersistedCollection<M extends Record<string, any> = any, USER extends User = User> = Omit<EntityCollection<M, USER>, "subcollections"> & {
|
|
3
3
|
ownerId?: string;
|
|
4
4
|
subcollections?: PersistedCollection<any, any>[];
|
|
5
5
|
editable?: boolean;
|
|
@@ -4,7 +4,7 @@ import { CollectionEditorPermissionsBuilder } from "./types/config_permissions";
|
|
|
4
4
|
import { PersistedCollection } from "./types/persisted_collection";
|
|
5
5
|
import { CollectionInference } from "./types/collection_inference";
|
|
6
6
|
import { CollectionsConfigController } from "./types/config_controller";
|
|
7
|
-
export interface CollectionConfigControllerProps<EC extends PersistedCollection = PersistedCollection,
|
|
7
|
+
export interface CollectionConfigControllerProps<EC extends PersistedCollection = PersistedCollection, USER extends User = User> {
|
|
8
8
|
/**
|
|
9
9
|
* Firebase app where the configuration is saved.
|
|
10
10
|
*/
|
|
@@ -12,7 +12,7 @@ export interface CollectionConfigControllerProps<EC extends PersistedCollection
|
|
|
12
12
|
/**
|
|
13
13
|
* Define what actions can be performed on the configuration.
|
|
14
14
|
*/
|
|
15
|
-
configPermissions?: CollectionEditorPermissionsBuilder<
|
|
15
|
+
configPermissions?: CollectionEditorPermissionsBuilder<USER, EC>;
|
|
16
16
|
/**
|
|
17
17
|
* The words you define here will not be allowed to be used as group
|
|
18
18
|
* names when creating collections.
|
|
@@ -28,7 +28,7 @@ export interface CollectionConfigControllerProps<EC extends PersistedCollection
|
|
|
28
28
|
getPathSuggestions?: (path?: string) => Promise<string[]>;
|
|
29
29
|
collectionInference?: CollectionInference;
|
|
30
30
|
getData?: (path: string, parentPaths: string[]) => Promise<object[]>;
|
|
31
|
-
getUser?: (uid: string) =>
|
|
31
|
+
getUser?: (uid: string) => USER | null;
|
|
32
32
|
onAnalyticsEvent?: (event: string, params?: object) => void;
|
|
33
33
|
components?: {
|
|
34
34
|
/**
|
|
@@ -51,5 +51,5 @@ export interface CollectionConfigControllerProps<EC extends PersistedCollection
|
|
|
51
51
|
* @param getUser
|
|
52
52
|
* @param collectionInference
|
|
53
53
|
*/
|
|
54
|
-
export declare function useCollectionEditorPlugin<EC extends PersistedCollection = PersistedCollection,
|
|
54
|
+
export declare function useCollectionEditorPlugin<EC extends PersistedCollection = PersistedCollection, USER extends User = User>({ collectionConfigController, configPermissions, reservedGroups, extraView, getPathSuggestions, getUser, collectionInference, getData, onAnalyticsEvent, components }: CollectionConfigControllerProps<EC, USER>): FireCMSPlugin<any, any, PersistedCollection>;
|
|
55
55
|
export declare function IntroWidget({}: {}): import("react/jsx-runtime").JSX.Element | null;
|
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@firecms/collection_editor",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "3.0.0-canary.
|
|
4
|
+
"version": "3.0.0-canary.145",
|
|
5
5
|
"main": "./dist/index.umd.js",
|
|
6
6
|
"module": "./dist/index.es.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
8
|
"source": "src/index.ts",
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@firecms/data_export": "^3.0.0-canary.
|
|
11
|
-
"@firecms/data_import": "^3.0.0-canary.
|
|
12
|
-
"@firecms/data_import_export": "^3.0.0-canary.
|
|
13
|
-
"@firecms/formex": "^3.0.0-canary.
|
|
14
|
-
"@firecms/schema_inference": "^3.0.0-canary.
|
|
15
|
-
"@firecms/ui": "^3.0.0-canary.
|
|
10
|
+
"@firecms/data_export": "^3.0.0-canary.145",
|
|
11
|
+
"@firecms/data_import": "^3.0.0-canary.145",
|
|
12
|
+
"@firecms/data_import_export": "^3.0.0-canary.145",
|
|
13
|
+
"@firecms/formex": "^3.0.0-canary.145",
|
|
14
|
+
"@firecms/schema_inference": "^3.0.0-canary.145",
|
|
15
|
+
"@firecms/ui": "^3.0.0-canary.145",
|
|
16
16
|
"json5": "^2.2.3",
|
|
17
17
|
"prism-react-renderer": "^2.4.0"
|
|
18
18
|
},
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"publishConfig": {
|
|
68
68
|
"access": "public"
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "e5d660f00c5806e1b63839c013af3c973f3dd47e"
|
|
71
71
|
}
|
|
@@ -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,7 +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,
|
|
3
|
+
export type PersistedCollection<M extends Record<string, any> = any, USER extends User = User>
|
|
4
|
+
= Omit<EntityCollection<M, USER>, "subcollections"> & {
|
|
5
5
|
// properties: Properties<M>;
|
|
6
6
|
ownerId?: string;
|
|
7
7
|
subcollections?: PersistedCollection<any, any>[];
|
|
@@ -29,7 +29,7 @@ export function CollectionViewHeaderAction({
|
|
|
29
29
|
asChild={true}
|
|
30
30
|
title={"Edit"}>
|
|
31
31
|
<IconButton
|
|
32
|
-
className={onHover ? "bg-white dark:bg-
|
|
32
|
+
className={onHover ? "bg-white dark:bg-surface-950" : "hidden"}
|
|
33
33
|
onClick={() => {
|
|
34
34
|
collectionEditorController.editProperty({
|
|
35
35
|
propertyKey,
|
|
@@ -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({
|
|
@@ -29,8 +29,8 @@ export function PropertyAddColumnComponent({
|
|
|
29
29
|
asChild={true}
|
|
30
30
|
title={canEditCollection ? "Add new property" : "You don't have permission to add new properties"}>
|
|
31
31
|
<div
|
|
32
|
-
className={"p-0.5 w-20 h-full flex items-center justify-center cursor-pointer bg-
|
|
33
|
-
// 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}
|
|
34
34
|
onClick={() => {
|
|
35
35
|
collectionEditorController.editProperty({
|
|
36
36
|
editedCollectionId: collection.id,
|
|
@@ -214,7 +214,7 @@ export function CollectionDetailsForm({
|
|
|
214
214
|
expanded={advancedPanelExpanded}
|
|
215
215
|
onExpandedChange={setAdvancedPanelExpanded}
|
|
216
216
|
title={
|
|
217
|
-
<div className="flex flex-row text-
|
|
217
|
+
<div className="flex flex-row text-surface-500">
|
|
218
218
|
<SettingsIcon/>
|
|
219
219
|
<Typography variant={"subtitle2"}
|
|
220
220
|
className="ml-2">
|
|
@@ -536,7 +536,7 @@ function CollectionEditorInternal<M extends Record<string, any>>({
|
|
|
536
536
|
|
|
537
537
|
<>
|
|
538
538
|
{!isNewCollection && <Tabs value={currentView}
|
|
539
|
-
className={cls(defaultBorderMixin, "justify-end bg-
|
|
539
|
+
className={cls(defaultBorderMixin, "justify-end bg-surface-50 dark:bg-surface-950 border-b")}
|
|
540
540
|
onValueChange={(v) => setCurrentView(v as EditorView)}>
|
|
541
541
|
<Tab value={"details"}>
|
|
542
542
|
Details
|
|
@@ -191,9 +191,9 @@ export function TemplateButton({
|
|
|
191
191
|
onClick={onClick}
|
|
192
192
|
className={cls(
|
|
193
193
|
"my-2 rounded-md border mx-0 p-6 px-4 focus:outline-none transition ease-in-out duration-150 flex flex-row gap-4 items-center",
|
|
194
|
-
"text-
|
|
194
|
+
"text-surface-700 dark:text-surface-accent-300",
|
|
195
195
|
"hover:border-primary-dark hover:text-primary-dark dark:hover:text-primary focus:ring-primary hover:ring-1 hover:ring-primary",
|
|
196
|
-
"border-
|
|
196
|
+
"border-surface-400 dark:border-surface-600 "
|
|
197
197
|
)}
|
|
198
198
|
>
|
|
199
199
|
{icon}
|
|
@@ -316,7 +316,7 @@ export function CollectionPropertiesEditorForm({
|
|
|
316
316
|
};
|
|
317
317
|
|
|
318
318
|
const body = (
|
|
319
|
-
<div className={"grid grid-cols-12 gap-2 h-full bg-
|
|
319
|
+
<div className={"grid grid-cols-12 gap-2 h-full bg-surface-50 dark:bg-surface-900"}>
|
|
320
320
|
<div className={cls(
|
|
321
321
|
"p-4 md:p-8 pb-20 md:pb-20",
|
|
322
322
|
"col-span-12 lg:col-span-5 h-full overflow-auto",
|
|
@@ -130,7 +130,7 @@ export function NonEditablePropertyPreview({
|
|
|
130
130
|
<div className={"relative m-4"}>
|
|
131
131
|
{propertyConfig && <PropertyConfigBadge propertyConfig={propertyConfig}/>}
|
|
132
132
|
{!propertyConfig && <div
|
|
133
|
-
className={"h-8 w-8 p-1 rounded-full shadow text-white bg-
|
|
133
|
+
className={"h-8 w-8 p-1 rounded-full shadow text-white bg-surface-500"}>
|
|
134
134
|
<FunctionsIcon color={"inherit"} size={"medium"}/>
|
|
135
135
|
</div>}
|
|
136
136
|
<RemoveCircleIcon color={"disabled"} size={"small"} className={"absolute -right-2 -top-2"}/>
|
|
@@ -54,7 +54,7 @@ export function MarkdownPropertyField({
|
|
|
54
54
|
<div className={"col-span-12"}>
|
|
55
55
|
<ExpandablePanel
|
|
56
56
|
title={
|
|
57
|
-
<div className="flex flex-row text-
|
|
57
|
+
<div className="flex flex-row text-surface-500">
|
|
58
58
|
<FileUploadIcon/>
|
|
59
59
|
<Typography variant={"subtitle2"}
|
|
60
60
|
className="ml-2">
|
|
@@ -12,7 +12,7 @@ export function ValidationPanel({
|
|
|
12
12
|
asField={true}
|
|
13
13
|
innerClassName="p-4"
|
|
14
14
|
title={
|
|
15
|
-
<div className="flex flex-row text-
|
|
15
|
+
<div className="flex flex-row text-surface-500">
|
|
16
16
|
<RuleIcon/>
|
|
17
17
|
<Typography variant={"subtitle2"}
|
|
18
18
|
className="ml-2">
|
|
@@ -15,7 +15,7 @@ import { useCollectionEditorController } from "./useCollectionEditorController";
|
|
|
15
15
|
import { EditorCollectionActionStart } from "./ui/EditorCollectionActionStart";
|
|
16
16
|
import { NewCollectionCard } from "./ui/NewCollectionCard";
|
|
17
17
|
|
|
18
|
-
export interface CollectionConfigControllerProps<EC extends PersistedCollection = PersistedCollection,
|
|
18
|
+
export interface CollectionConfigControllerProps<EC extends PersistedCollection = PersistedCollection, USER extends User = User> {
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* Firebase app where the configuration is saved.
|
|
@@ -25,7 +25,7 @@ export interface CollectionConfigControllerProps<EC extends PersistedCollection
|
|
|
25
25
|
/**
|
|
26
26
|
* Define what actions can be performed on the configuration.
|
|
27
27
|
*/
|
|
28
|
-
configPermissions?: CollectionEditorPermissionsBuilder<
|
|
28
|
+
configPermissions?: CollectionEditorPermissionsBuilder<USER, EC>;
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
31
|
* The words you define here will not be allowed to be used as group
|
|
@@ -47,7 +47,7 @@ export interface CollectionConfigControllerProps<EC extends PersistedCollection
|
|
|
47
47
|
|
|
48
48
|
getData?: (path: string, parentPaths: string[]) => Promise<object[]>;
|
|
49
49
|
|
|
50
|
-
getUser?: (uid: string) =>
|
|
50
|
+
getUser?: (uid: string) => USER | null;
|
|
51
51
|
|
|
52
52
|
onAnalyticsEvent?: (event: string, params?: object) => void;
|
|
53
53
|
|
|
@@ -71,7 +71,7 @@ export interface CollectionConfigControllerProps<EC extends PersistedCollection
|
|
|
71
71
|
* @param getUser
|
|
72
72
|
* @param collectionInference
|
|
73
73
|
*/
|
|
74
|
-
export function useCollectionEditorPlugin<EC extends PersistedCollection = PersistedCollection,
|
|
74
|
+
export function useCollectionEditorPlugin<EC extends PersistedCollection = PersistedCollection, USER extends User = User>
|
|
75
75
|
({
|
|
76
76
|
collectionConfigController,
|
|
77
77
|
configPermissions,
|
|
@@ -83,7 +83,7 @@ export function useCollectionEditorPlugin<EC extends PersistedCollection = Persi
|
|
|
83
83
|
getData,
|
|
84
84
|
onAnalyticsEvent,
|
|
85
85
|
components
|
|
86
|
-
}: CollectionConfigControllerProps<EC,
|
|
86
|
+
}: CollectionConfigControllerProps<EC, USER>): FireCMSPlugin<any, any, PersistedCollection> {
|
|
87
87
|
|
|
88
88
|
return {
|
|
89
89
|
key: "collection_editor",
|
|
@@ -140,7 +140,7 @@ export function IntroWidget({}: {}) {
|
|
|
140
140
|
|
|
141
141
|
return (
|
|
142
142
|
<Paper
|
|
143
|
-
className={"my-4 px-4 py-6 flex flex-col bg-white dark:bg-
|
|
143
|
+
className={"my-4 px-4 py-6 flex flex-col bg-white dark:bg-surface-accent-800 gap-2"}>
|
|
144
144
|
<Typography variant={"subtitle2"} className={"uppercase"}>No collections found</Typography>
|
|
145
145
|
<Typography>
|
|
146
146
|
Start building collections in FireCMS easily. Map them to your existing
|