@firecms/collection_editor 3.0.0-beta.6 → 3.0.0-beta.8
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 +1582 -1520
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +2 -2
- package/dist/index.umd.js.map +1 -1
- package/dist/types/collection_editor_controller.d.ts +3 -1
- package/dist/ui/CollectionViewHeaderAction.d.ts +3 -2
- package/dist/ui/PropertyAddColumnComponent.d.ts +3 -1
- package/dist/ui/collection_editor/CollectionEditorDialog.d.ts +2 -1
- package/dist/useCollectionEditorPlugin.d.ts +1 -1
- package/package.json +16 -32
- package/src/ConfigControllerProvider.tsx +37 -28
- package/src/types/collection_editor_controller.tsx +5 -3
- package/src/ui/CollectionViewHeaderAction.tsx +6 -3
- package/src/ui/EditorCollectionAction.tsx +9 -12
- package/src/ui/HomePageEditorCollectionAction.tsx +16 -11
- package/src/ui/NewCollectionCard.tsx +3 -3
- package/src/ui/PropertyAddColumnComponent.tsx +6 -3
- package/src/ui/collection_editor/CollectionDetailsForm.tsx +33 -3
- package/src/ui/collection_editor/CollectionEditorDialog.tsx +26 -16
- package/src/ui/collection_editor/CollectionEditorWelcomeView.tsx +2 -2
- package/src/ui/collection_editor/CollectionPropertiesEditorForm.tsx +19 -17
- package/src/ui/collection_editor/PropertyEditView.tsx +5 -4
- package/src/ui/collection_editor/PropertyFieldPreview.tsx +3 -6
- package/src/ui/collection_editor/PropertySelectItem.tsx +2 -2
- package/src/ui/collection_editor/PropertyTree.tsx +3 -3
- package/src/ui/collection_editor/SubcollectionsEditTab.tsx +1 -1
- package/src/ui/collection_editor/import/CollectionEditorImportDataPreview.tsx +2 -1
- package/src/ui/collection_editor/properties/BlockPropertyField.tsx +5 -5
- package/src/ui/collection_editor/properties/EnumPropertyField.tsx +1 -1
- package/src/ui/collection_editor/properties/MapPropertyField.tsx +5 -5
- package/src/ui/collection_editor/properties/RepeatPropertyField.tsx +0 -1
- package/src/useCollectionEditorPlugin.tsx +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CollectionEditorPermissionsBuilder } from "./config_permissions";
|
|
2
|
-
import { Property } from "@firecms/core";
|
|
2
|
+
import { Entity, Property } from "@firecms/core";
|
|
3
3
|
import { PersistedCollection } from "./persisted_collection";
|
|
4
4
|
/**
|
|
5
5
|
* Controller to open the collection editor dialog.
|
|
@@ -11,6 +11,7 @@ export interface CollectionEditorController {
|
|
|
11
11
|
fullPath?: string;
|
|
12
12
|
parentCollectionIds: string[];
|
|
13
13
|
parentCollection?: PersistedCollection;
|
|
14
|
+
existingEntities?: Entity<any>[];
|
|
14
15
|
}) => void;
|
|
15
16
|
createCollection: (props: {
|
|
16
17
|
initialValues?: {
|
|
@@ -30,6 +31,7 @@ export interface CollectionEditorController {
|
|
|
30
31
|
editedCollectionId: string;
|
|
31
32
|
parentCollectionIds: string[];
|
|
32
33
|
collection: PersistedCollection;
|
|
34
|
+
existingEntities: Entity<any>[];
|
|
33
35
|
}) => void;
|
|
34
36
|
configPermissions: CollectionEditorPermissionsBuilder;
|
|
35
37
|
getPathSuggestions?: (path: string) => Promise<string[]>;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { ResolvedProperty } from "@firecms/core";
|
|
1
|
+
import { EntityTableController, ResolvedProperty } from "@firecms/core";
|
|
2
2
|
import { PersistedCollection } from "../types/persisted_collection";
|
|
3
|
-
export declare function CollectionViewHeaderAction({ propertyKey, onHover, property, fullPath, parentCollectionIds, collection }: {
|
|
3
|
+
export declare function CollectionViewHeaderAction({ propertyKey, onHover, property, fullPath, parentCollectionIds, collection, tableController }: {
|
|
4
4
|
property: ResolvedProperty;
|
|
5
5
|
propertyKey: string;
|
|
6
6
|
onHover: boolean;
|
|
7
7
|
fullPath: string;
|
|
8
8
|
parentCollectionIds: string[];
|
|
9
9
|
collection: PersistedCollection;
|
|
10
|
+
tableController: EntityTableController;
|
|
10
11
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { EntityTableController } from "@firecms/core";
|
|
1
2
|
import { PersistedCollection } from "../types/persisted_collection";
|
|
2
|
-
export declare function PropertyAddColumnComponent({ fullPath, parentCollectionIds, collection }: {
|
|
3
|
+
export declare function PropertyAddColumnComponent({ fullPath, parentCollectionIds, collection, tableController }: {
|
|
3
4
|
fullPath: string;
|
|
4
5
|
parentCollectionIds: string[];
|
|
5
6
|
collection: PersistedCollection;
|
|
7
|
+
tableController: EntityTableController;
|
|
6
8
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { EntityCollection, User } from "@firecms/core";
|
|
2
|
+
import { Entity, EntityCollection, User } from "@firecms/core";
|
|
3
3
|
import { CollectionsConfigController } from "../../types/config_controller";
|
|
4
4
|
import { CollectionInference } from "../../types/collection_inference";
|
|
5
5
|
import { PersistedCollection } from "../../types/persisted_collection";
|
|
@@ -28,6 +28,7 @@ export interface CollectionEditorDialogProps {
|
|
|
28
28
|
getUser?: (uid: string) => User | null;
|
|
29
29
|
getData?: (path: string, parentPaths: string[]) => Promise<object[]>;
|
|
30
30
|
parentCollection?: PersistedCollection;
|
|
31
|
+
existingEntities?: Entity<any>[];
|
|
31
32
|
}
|
|
32
33
|
export declare function CollectionEditorDialog(props: CollectionEditorDialogProps): import("react/jsx-runtime").JSX.Element;
|
|
33
34
|
export declare function CollectionEditor(props: CollectionEditorDialogProps & {
|
|
@@ -38,7 +38,7 @@ export interface CollectionConfigControllerProps<EC extends PersistedCollection
|
|
|
38
38
|
* @param configPermissions
|
|
39
39
|
* @param reservedGroups
|
|
40
40
|
* @param extraView
|
|
41
|
-
* @param
|
|
41
|
+
* @param getData
|
|
42
42
|
* @param getUser
|
|
43
43
|
* @param collectionInference
|
|
44
44
|
*/
|
package/package.json
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@firecms/collection_editor",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "3.0.0-beta.
|
|
4
|
+
"version": "3.0.0-beta.8",
|
|
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_import_export": "^3.0.0-beta.
|
|
11
|
-
"@firecms/formex": "^3.0.0-beta.
|
|
12
|
-
"@firecms/schema_inference": "^3.0.0-beta.
|
|
13
|
-
"@firecms/ui": "^3.0.0-beta.
|
|
10
|
+
"@firecms/data_import_export": "^3.0.0-beta.8",
|
|
11
|
+
"@firecms/formex": "^3.0.0-beta.8",
|
|
12
|
+
"@firecms/schema_inference": "^3.0.0-beta.8",
|
|
13
|
+
"@firecms/ui": "^3.0.0-beta.8",
|
|
14
14
|
"json5": "^2.2.3",
|
|
15
15
|
"prism-react-renderer": "^2.3.1"
|
|
16
16
|
},
|
|
17
17
|
"peerDependencies": {
|
|
18
|
-
"react": "^18.
|
|
19
|
-
"react-dom": "^18.
|
|
18
|
+
"react": "^18.3.1",
|
|
19
|
+
"react-dom": "^18.3.1",
|
|
20
20
|
"react-router": "^6.22.0",
|
|
21
21
|
"react-router-dom": "^6.22.0"
|
|
22
22
|
},
|
|
@@ -34,12 +34,6 @@
|
|
|
34
34
|
"build": "vite build && tsc --emitDeclarationOnly -p tsconfig.prod.json",
|
|
35
35
|
"clean": "rm -rf dist && find ./src -name '*.js' -type f | xargs rm -f"
|
|
36
36
|
},
|
|
37
|
-
"eslintConfig": {
|
|
38
|
-
"extends": [
|
|
39
|
-
"react-app",
|
|
40
|
-
"react-app/jest"
|
|
41
|
-
]
|
|
42
|
-
},
|
|
43
37
|
"browserslist": {
|
|
44
38
|
"production": [
|
|
45
39
|
">0.2%",
|
|
@@ -54,25 +48,15 @@
|
|
|
54
48
|
},
|
|
55
49
|
"devDependencies": {
|
|
56
50
|
"@jest/globals": "^29.7.0",
|
|
57
|
-
"@types/react": "^18.
|
|
58
|
-
"@types/react-dom": "^18.
|
|
59
|
-
"@
|
|
60
|
-
"@typescript-eslint/parser": "^7.7.0",
|
|
61
|
-
"@vitejs/plugin-react": "^4.2.1",
|
|
62
|
-
"eslint": "^8.57.0",
|
|
63
|
-
"eslint-config-standard": "^17.1.0",
|
|
64
|
-
"eslint-plugin-import": "^2.29.1",
|
|
65
|
-
"eslint-plugin-n": "^16.6.2",
|
|
66
|
-
"eslint-plugin-promise": "^6.1.1",
|
|
67
|
-
"eslint-plugin-react": "^7.34.1",
|
|
68
|
-
"eslint-plugin-react-hooks": "^4.6.0",
|
|
51
|
+
"@types/react": "^18.3.3",
|
|
52
|
+
"@types/react-dom": "^18.3.0",
|
|
53
|
+
"@vitejs/plugin-react": "^4.3.1",
|
|
69
54
|
"jest": "^29.7.0",
|
|
70
|
-
"react-router": "^6.
|
|
71
|
-
"react-router-dom": "^6.
|
|
72
|
-
"ts-jest": "^29.1.
|
|
73
|
-
"typescript": "^5.
|
|
74
|
-
"vite": "^5.2
|
|
75
|
-
"vite-plugin-fonts": "^0.7.0"
|
|
55
|
+
"react-router": "^6.24.0",
|
|
56
|
+
"react-router-dom": "^6.24.0",
|
|
57
|
+
"ts-jest": "^29.1.5",
|
|
58
|
+
"typescript": "^5.5.3",
|
|
59
|
+
"vite": "^5.3.2"
|
|
76
60
|
},
|
|
77
61
|
"files": [
|
|
78
62
|
"dist",
|
|
@@ -81,5 +65,5 @@
|
|
|
81
65
|
"publishConfig": {
|
|
82
66
|
"access": "public"
|
|
83
67
|
},
|
|
84
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "4ef14d60f86cb2e581b908a1dc84ad6a87b14e2e"
|
|
85
69
|
}
|
|
@@ -3,6 +3,7 @@ import equal from "react-fast-compare"
|
|
|
3
3
|
|
|
4
4
|
import { CollectionsConfigController } from "./types/config_controller";
|
|
5
5
|
import {
|
|
6
|
+
Entity,
|
|
6
7
|
Property,
|
|
7
8
|
useCustomizationController,
|
|
8
9
|
useNavigationController,
|
|
@@ -88,7 +89,8 @@ export const ConfigControllerProvider = React.memo(
|
|
|
88
89
|
group?: string,
|
|
89
90
|
name?: string
|
|
90
91
|
},
|
|
91
|
-
redirect: boolean
|
|
92
|
+
redirect: boolean,
|
|
93
|
+
existingEntities?: Entity<any>[]
|
|
92
94
|
}>();
|
|
93
95
|
|
|
94
96
|
const [currentPropertyDialog, setCurrentPropertyDialog] = React.useState<{
|
|
@@ -101,6 +103,7 @@ export const ConfigControllerProvider = React.memo(
|
|
|
101
103
|
fullPath?: string,
|
|
102
104
|
parentCollectionIds: string[],
|
|
103
105
|
collectionEditable: boolean;
|
|
106
|
+
existingEntities?: Entity<any>[]
|
|
104
107
|
}>();
|
|
105
108
|
|
|
106
109
|
const defaultConfigPermissions: CollectionEditorPermissionsBuilder = useCallback(() => ({
|
|
@@ -109,16 +112,18 @@ export const ConfigControllerProvider = React.memo(
|
|
|
109
112
|
deleteCollections: true
|
|
110
113
|
}), []);
|
|
111
114
|
|
|
112
|
-
const editCollection =
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
115
|
+
const editCollection = ({
|
|
116
|
+
id,
|
|
117
|
+
fullPath,
|
|
118
|
+
parentCollectionIds,
|
|
119
|
+
parentCollection,
|
|
120
|
+
existingEntities
|
|
121
|
+
}: {
|
|
118
122
|
id?: string,
|
|
119
123
|
fullPath?: string,
|
|
120
124
|
parentCollectionIds: string[],
|
|
121
|
-
parentCollection?: PersistedCollection
|
|
125
|
+
parentCollection?: PersistedCollection,
|
|
126
|
+
existingEntities?: Entity<any>[]
|
|
122
127
|
}) => {
|
|
123
128
|
console.debug("Edit collection", id, fullPath, parentCollectionIds, parentCollection);
|
|
124
129
|
onAnalyticsEvent?.("edit_collection", {
|
|
@@ -131,24 +136,27 @@ export const ConfigControllerProvider = React.memo(
|
|
|
131
136
|
parentCollectionIds,
|
|
132
137
|
isNewCollection: false,
|
|
133
138
|
parentCollection,
|
|
134
|
-
redirect: false
|
|
139
|
+
redirect: false,
|
|
140
|
+
existingEntities
|
|
135
141
|
});
|
|
136
|
-
}
|
|
142
|
+
};
|
|
137
143
|
|
|
138
|
-
const editProperty =
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
144
|
+
const editProperty = ({
|
|
145
|
+
propertyKey,
|
|
146
|
+
property,
|
|
147
|
+
editedCollectionId,
|
|
148
|
+
currentPropertiesOrder,
|
|
149
|
+
parentCollectionIds,
|
|
150
|
+
collection,
|
|
151
|
+
existingEntities
|
|
152
|
+
}: {
|
|
146
153
|
propertyKey?: string,
|
|
147
154
|
property?: Property,
|
|
148
155
|
currentPropertiesOrder?: string[],
|
|
149
156
|
editedCollectionId: string,
|
|
150
157
|
parentCollectionIds: string[],
|
|
151
158
|
collection: PersistedCollection,
|
|
159
|
+
existingEntities?: Entity<any>[]
|
|
152
160
|
}) => {
|
|
153
161
|
console.debug("Edit property", propertyKey, property, editedCollectionId, currentPropertiesOrder, parentCollectionIds, collection);
|
|
154
162
|
onAnalyticsEvent?.("edit_property", {
|
|
@@ -169,17 +177,18 @@ export const ConfigControllerProvider = React.memo(
|
|
|
169
177
|
currentPropertiesOrder,
|
|
170
178
|
editedCollectionId,
|
|
171
179
|
parentCollectionIds,
|
|
172
|
-
collectionEditable: collection?.editable ?? false
|
|
180
|
+
collectionEditable: collection?.editable ?? false,
|
|
181
|
+
existingEntities
|
|
173
182
|
});
|
|
174
|
-
}
|
|
183
|
+
};
|
|
175
184
|
|
|
176
|
-
const createCollection =
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
185
|
+
const createCollection = ({
|
|
186
|
+
parentCollectionIds,
|
|
187
|
+
parentCollection,
|
|
188
|
+
initialValues,
|
|
189
|
+
redirect,
|
|
190
|
+
sourceClick
|
|
191
|
+
}: {
|
|
183
192
|
parentCollectionIds: string[],
|
|
184
193
|
parentCollection?: PersistedCollection
|
|
185
194
|
initialValues?: {
|
|
@@ -211,7 +220,7 @@ export const ConfigControllerProvider = React.memo(
|
|
|
211
220
|
initialValues,
|
|
212
221
|
redirect
|
|
213
222
|
});
|
|
214
|
-
}
|
|
223
|
+
};
|
|
215
224
|
|
|
216
225
|
return (
|
|
217
226
|
<ConfigControllerContext.Provider value={collectionConfigController}>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CollectionEditorPermissionsBuilder } from "./config_permissions";
|
|
2
|
-
import { Property } from "@firecms/core";
|
|
2
|
+
import { Entity, Property } from "@firecms/core";
|
|
3
3
|
import { PersistedCollection } from "./persisted_collection";
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -12,7 +12,8 @@ export interface CollectionEditorController {
|
|
|
12
12
|
id?: string,
|
|
13
13
|
fullPath?: string,
|
|
14
14
|
parentCollectionIds: string[],
|
|
15
|
-
parentCollection?: PersistedCollection
|
|
15
|
+
parentCollection?: PersistedCollection,
|
|
16
|
+
existingEntities?: Entity<any>[]
|
|
16
17
|
}) => void;
|
|
17
18
|
|
|
18
19
|
createCollection: (props: {
|
|
@@ -33,7 +34,8 @@ export interface CollectionEditorController {
|
|
|
33
34
|
currentPropertiesOrder?: string[],
|
|
34
35
|
editedCollectionId: string,
|
|
35
36
|
parentCollectionIds: string[],
|
|
36
|
-
collection: PersistedCollection
|
|
37
|
+
collection: PersistedCollection,
|
|
38
|
+
existingEntities: Entity<any>[]
|
|
37
39
|
}) => void;
|
|
38
40
|
|
|
39
41
|
configPermissions: CollectionEditorPermissionsBuilder;
|
|
@@ -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,6 +19,7 @@ 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();
|
|
@@ -32,7 +34,8 @@ export function CollectionViewHeaderAction({
|
|
|
32
34
|
property,
|
|
33
35
|
editedCollectionId: collection.id,
|
|
34
36
|
parentCollectionIds,
|
|
35
|
-
collection
|
|
37
|
+
collection,
|
|
38
|
+
existingEntities: tableController.data ?? []
|
|
36
39
|
});
|
|
37
40
|
}}
|
|
38
41
|
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({
|
|
@@ -39,7 +30,13 @@ export function EditorCollectionAction({
|
|
|
39
30
|
color={"primary"}
|
|
40
31
|
disabled={!canEditCollection}
|
|
41
32
|
onClick={canEditCollection
|
|
42
|
-
? () => collectionEditorController?.editCollection({
|
|
33
|
+
? () => collectionEditorController?.editCollection({
|
|
34
|
+
id: collection.id,
|
|
35
|
+
fullPath,
|
|
36
|
+
parentCollectionIds,
|
|
37
|
+
parentCollection: parentCollection as PersistedCollection,
|
|
38
|
+
existingEntities: tableController?.data ?? []
|
|
39
|
+
})
|
|
43
40
|
: undefined}>
|
|
44
41
|
<SettingsIcon/>
|
|
45
42
|
</IconButton>
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
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({
|
|
@@ -24,13 +24,16 @@ export function HomePageEditorCollectionAction({
|
|
|
24
24
|
collection
|
|
25
25
|
});
|
|
26
26
|
|
|
27
|
-
const onEditCollectionClicked =
|
|
28
|
-
collectionEditorController?.editCollection({
|
|
29
|
-
|
|
27
|
+
const onEditCollectionClicked = () => {
|
|
28
|
+
collectionEditorController?.editCollection({
|
|
29
|
+
id: collection.id,
|
|
30
|
+
parentCollectionIds: []
|
|
31
|
+
});
|
|
32
|
+
};
|
|
30
33
|
|
|
31
34
|
const [deleteRequested, setDeleteRequested] = useState(false);
|
|
32
35
|
|
|
33
|
-
const deleteCollection =
|
|
36
|
+
const deleteCollection = () => {
|
|
34
37
|
configController?.deleteCollection({ id: collection.id }).then(() => {
|
|
35
38
|
setDeleteRequested(false);
|
|
36
39
|
snackbarController.open({
|
|
@@ -38,7 +41,7 @@ export function HomePageEditorCollectionAction({
|
|
|
38
41
|
type: "success"
|
|
39
42
|
});
|
|
40
43
|
});
|
|
41
|
-
}
|
|
44
|
+
};
|
|
42
45
|
|
|
43
46
|
return <>
|
|
44
47
|
|
|
@@ -49,11 +52,13 @@ export function HomePageEditorCollectionAction({
|
|
|
49
52
|
<MoreVertIcon size={"small"}/>
|
|
50
53
|
</IconButton>}
|
|
51
54
|
>
|
|
52
|
-
<MenuItem
|
|
53
|
-
|
|
54
|
-
event
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
<MenuItem
|
|
56
|
+
dense={true}
|
|
57
|
+
onClick={(event) => {
|
|
58
|
+
event.preventDefault();
|
|
59
|
+
event.stopPropagation();
|
|
60
|
+
setDeleteRequested(true);
|
|
61
|
+
}}>
|
|
57
62
|
<DeleteIcon/>
|
|
58
63
|
Delete
|
|
59
64
|
</MenuItem>
|
|
@@ -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();
|
|
@@ -32,7 +34,8 @@ export function PropertyAddColumnComponent({
|
|
|
32
34
|
editedCollectionId: collection.id,
|
|
33
35
|
parentCollectionIds,
|
|
34
36
|
currentPropertiesOrder: getDefaultPropertiesOrder(collection),
|
|
35
|
-
collection
|
|
37
|
+
collection,
|
|
38
|
+
existingEntities: tableController.data
|
|
36
39
|
});
|
|
37
40
|
}}>
|
|
38
41
|
<AddIcon color={"inherit"}/>
|
|
@@ -5,7 +5,8 @@ import {
|
|
|
5
5
|
AutocompleteItem,
|
|
6
6
|
BooleanSwitchWithLabel,
|
|
7
7
|
Chip,
|
|
8
|
-
|
|
8
|
+
ClearIcon,
|
|
9
|
+
cls,
|
|
9
10
|
Container,
|
|
10
11
|
DebouncedTextField,
|
|
11
12
|
Dialog,
|
|
@@ -146,7 +147,7 @@ export function CollectionDetailsForm({
|
|
|
146
147
|
</FieldCaption>
|
|
147
148
|
</div>
|
|
148
149
|
|
|
149
|
-
<div className={
|
|
150
|
+
<div className={cls("col-span-12 ", isSubcollection ? "" : "sm:col-span-8")}>
|
|
150
151
|
<Field name={"path"}
|
|
151
152
|
as={DebouncedTextField}
|
|
152
153
|
label={"Path"}
|
|
@@ -235,6 +236,35 @@ export function CollectionDetailsForm({
|
|
|
235
236
|
{showErrors && Boolean(errors.singularName) ? errors.singularName : "Optionally define a singular name for your entities"}
|
|
236
237
|
</FieldCaption>
|
|
237
238
|
</div>
|
|
239
|
+
<div className={"col-span-12"}>
|
|
240
|
+
<TextField
|
|
241
|
+
error={showErrors && Boolean(errors.sideDialogWidth)}
|
|
242
|
+
name={"sideDialogWidth"}
|
|
243
|
+
type={"number"}
|
|
244
|
+
aria-describedby={"sideDialogWidth-helper"}
|
|
245
|
+
onChange={(e) => {
|
|
246
|
+
setFieldTouched("sideDialogWidth", true);
|
|
247
|
+
const value = e.target.value;
|
|
248
|
+
if (!value) {
|
|
249
|
+
setFieldValue("sideDialogWidth", null);
|
|
250
|
+
} else if (!isNaN(Number(value))) {
|
|
251
|
+
setFieldValue("sideDialogWidth", Number(value));
|
|
252
|
+
}
|
|
253
|
+
}}
|
|
254
|
+
endAdornment={<IconButton
|
|
255
|
+
size={"small"}
|
|
256
|
+
onClick={() => {
|
|
257
|
+
setFieldValue("sideDialogWidth", null);
|
|
258
|
+
}}
|
|
259
|
+
disabled={!values.sideDialogWidth}>
|
|
260
|
+
<ClearIcon size={"small"}/>
|
|
261
|
+
</IconButton>}
|
|
262
|
+
value={values.sideDialogWidth ?? ""}
|
|
263
|
+
label={"Side dialog width"}/>
|
|
264
|
+
<FieldCaption error={showErrors && Boolean(errors.singularName)}>
|
|
265
|
+
{showErrors && Boolean(errors.singularName) ? errors.singularName : "Optionally define the width (in pixels) of entities side dialog. Default is 768px"}
|
|
266
|
+
</FieldCaption>
|
|
267
|
+
</div>
|
|
238
268
|
<div className={"col-span-12"}>
|
|
239
269
|
<TextField
|
|
240
270
|
error={showErrors && Boolean(errors.description)}
|
|
@@ -272,7 +302,7 @@ export function CollectionDetailsForm({
|
|
|
272
302
|
<div className={"col-span-12"}>
|
|
273
303
|
<Select
|
|
274
304
|
name="customId"
|
|
275
|
-
label="
|
|
305
|
+
label="Document IDs generation"
|
|
276
306
|
position={"item-aligned"}
|
|
277
307
|
disabled={customIdValue === "code_defined"}
|
|
278
308
|
onValueChange={(v) => {
|