@firecms/core 3.0.0-alpha.61 → 3.0.0-alpha.63
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 +11 -1
- package/dist/index.es.js +3974 -3977
- 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/preview/PropertyPreview.d.ts +2 -1
- package/dist/preview/PropertyPreviewProps.d.ts +1 -6
- package/dist/preview/property_previews/ArrayOfMapsPreview.d.ts +1 -1
- package/dist/preview/property_previews/ArrayOfStorageComponentsPreview.d.ts +1 -1
- package/dist/preview/property_previews/ArrayOfStringsPreview.d.ts +1 -1
- package/dist/preview/property_previews/ArrayOneOfPreview.d.ts +1 -1
- package/dist/preview/property_previews/ArrayPropertyPreview.d.ts +1 -1
- package/dist/preview/property_previews/MapPropertyPreview.d.ts +1 -1
- package/dist/types/navigation.d.ts +6 -1
- package/dist/types/plugins.d.ts +10 -0
- package/dist/util/navigation_utils.d.ts +2 -2
- package/package.json +3 -3
- package/src/components/EntityCollectionTable/fields/TableStorageUpload.tsx +1 -1
- package/src/components/EntityCollectionTable/internal/PropertyTableCell.tsx +2 -2
- package/src/components/EntityPreview.tsx +1 -1
- package/src/components/HomePage/DefaultHomePage.tsx +16 -4
- package/src/form/components/StorageItemPreview.tsx +1 -1
- package/src/form/field_bindings/ReadOnlyFieldBinding.tsx +1 -1
- package/src/internal/useBuildNavigationController.tsx +21 -5
- package/src/preview/PropertyPreview.tsx +15 -13
- package/src/preview/PropertyPreviewProps.tsx +2 -2
- package/src/preview/components/ReferencePreview.tsx +1 -1
- package/src/preview/property_previews/ArrayOfMapsPreview.tsx +2 -2
- package/src/preview/property_previews/ArrayOfStorageComponentsPreview.tsx +2 -2
- package/src/preview/property_previews/ArrayOfStringsPreview.tsx +2 -2
- package/src/preview/property_previews/ArrayOneOfPreview.tsx +2 -2
- package/src/preview/property_previews/ArrayPropertyPreview.tsx +2 -2
- package/src/preview/property_previews/MapPropertyPreview.tsx +4 -4
- package/src/types/navigation.ts +7 -1
- package/src/types/plugins.tsx +13 -0
- package/src/util/join_collections.ts +5 -2
- package/src/util/navigation_utils.ts +5 -5
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
import { CMSType } from "../types";
|
|
2
3
|
import { PropertyPreviewProps } from "./PropertyPreviewProps";
|
|
3
4
|
/**
|
|
4
5
|
* @group Preview components
|
|
5
6
|
*/
|
|
6
|
-
export declare
|
|
7
|
+
export declare const PropertyPreview: React.MemoExoticComponent<(<T extends CMSType>(props: PropertyPreviewProps<T, any, Record<string, any>>) => any)>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CMSType,
|
|
1
|
+
import { CMSType, Property, ResolvedProperty } from "../types";
|
|
2
2
|
/**
|
|
3
3
|
* @group Preview components
|
|
4
4
|
*/
|
|
@@ -22,7 +22,6 @@ export interface PropertyPreviewProps<T extends CMSType = any, CustomProps = any
|
|
|
22
22
|
/**
|
|
23
23
|
* Click handler
|
|
24
24
|
*/
|
|
25
|
-
onClick?: () => void;
|
|
26
25
|
/**
|
|
27
26
|
* Desired size of the preview, depending on the context.
|
|
28
27
|
*/
|
|
@@ -41,8 +40,4 @@ export interface PropertyPreviewProps<T extends CMSType = any, CustomProps = any
|
|
|
41
40
|
* Additional properties set by the developer
|
|
42
41
|
*/
|
|
43
42
|
customProps?: CustomProps;
|
|
44
|
-
/**
|
|
45
|
-
* Entity this property refers to
|
|
46
|
-
*/
|
|
47
|
-
entity?: Entity<M>;
|
|
48
43
|
}
|
|
@@ -2,4 +2,4 @@ import { PropertyPreviewProps } from "../PropertyPreviewProps";
|
|
|
2
2
|
/**
|
|
3
3
|
* @group Preview components
|
|
4
4
|
*/
|
|
5
|
-
export declare function ArrayOfMapsPreview({ propertyKey, value, property: inputProperty, size,
|
|
5
|
+
export declare function ArrayOfMapsPreview({ propertyKey, value, property: inputProperty, size, }: PropertyPreviewProps<Record<string, any>[]>): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -2,4 +2,4 @@ import { PropertyPreviewProps } from "../PropertyPreviewProps";
|
|
|
2
2
|
/**
|
|
3
3
|
* @group Preview components
|
|
4
4
|
*/
|
|
5
|
-
export declare function ArrayOfStorageComponentsPreview({ propertyKey,
|
|
5
|
+
export declare function ArrayOfStorageComponentsPreview({ propertyKey, value, property: inputProperty, size }: PropertyPreviewProps<any[]>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,4 +2,4 @@ import { PropertyPreviewProps } from "../../preview";
|
|
|
2
2
|
/**
|
|
3
3
|
* @group Preview components
|
|
4
4
|
*/
|
|
5
|
-
export declare function ArrayOfStringsPreview({ propertyKey, value, property: inputProperty,
|
|
5
|
+
export declare function ArrayOfStringsPreview({ propertyKey, value, property: inputProperty, size }: PropertyPreviewProps<string[]>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,4 +2,4 @@ import { PropertyPreviewProps } from "../PropertyPreviewProps";
|
|
|
2
2
|
/**
|
|
3
3
|
* @group Preview components
|
|
4
4
|
*/
|
|
5
|
-
export declare function ArrayOneOfPreview({ propertyKey, value, property: inputProperty, size,
|
|
5
|
+
export declare function ArrayOneOfPreview({ propertyKey, value, property: inputProperty, size, }: PropertyPreviewProps<any[]>): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -2,4 +2,4 @@ import { PropertyPreviewProps } from "../PropertyPreviewProps";
|
|
|
2
2
|
/**
|
|
3
3
|
* @group Preview components
|
|
4
4
|
*/
|
|
5
|
-
export declare function ArrayPropertyPreview({ propertyKey, value, property: inputProperty,
|
|
5
|
+
export declare function ArrayPropertyPreview({ propertyKey, value, property: inputProperty, size }: PropertyPreviewProps<any[]>): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -2,7 +2,7 @@ import { PropertyPreviewProps } from "../PropertyPreviewProps";
|
|
|
2
2
|
/**
|
|
3
3
|
* @group Preview components
|
|
4
4
|
*/
|
|
5
|
-
export declare function MapPropertyPreview<T extends Record<string, any> = Record<string, any>>({ propertyKey, value, property,
|
|
5
|
+
export declare function MapPropertyPreview<T extends Record<string, any> = Record<string, any>>({ propertyKey, value, property, size }: PropertyPreviewProps<T>): import("react/jsx-runtime").JSX.Element | null;
|
|
6
6
|
export declare function KeyValuePreview({ value }: {
|
|
7
7
|
value: any;
|
|
8
8
|
}): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -106,7 +106,7 @@ export type NavigationController = {
|
|
|
106
106
|
*/
|
|
107
107
|
refreshNavigation: () => void;
|
|
108
108
|
/**
|
|
109
|
-
* Retrieve all the related parent
|
|
109
|
+
* Retrieve all the related parent references for a given path
|
|
110
110
|
* @param path
|
|
111
111
|
*/
|
|
112
112
|
getParentReferencesFromPath: (path: string) => EntityReference[];
|
|
@@ -115,6 +115,11 @@ export type NavigationController = {
|
|
|
115
115
|
* @param path
|
|
116
116
|
*/
|
|
117
117
|
getParentCollectionIds: (path: string) => string[];
|
|
118
|
+
/**
|
|
119
|
+
* Resolve paths from a list of ids
|
|
120
|
+
* @param ids
|
|
121
|
+
*/
|
|
122
|
+
convertIdsToPaths: (ids: string[]) => string[];
|
|
118
123
|
};
|
|
119
124
|
/**
|
|
120
125
|
* Custom additional views created by the developer, added to the main
|
package/dist/types/plugins.d.ts
CHANGED
|
@@ -62,7 +62,17 @@ export type FireCMSPlugin<PROPS = any, FORM_PROPS = any, EC extends EntityCollec
|
|
|
62
62
|
props?: PROPS;
|
|
63
63
|
};
|
|
64
64
|
homePage?: {
|
|
65
|
+
/**
|
|
66
|
+
* Additional actions to be rendered in the home page, close to the search bar.
|
|
67
|
+
*/
|
|
68
|
+
additionalActions?: React.ReactNode;
|
|
69
|
+
/**
|
|
70
|
+
* Additional children to be rendered in the beginning of the home page.
|
|
71
|
+
*/
|
|
65
72
|
additionalChildrenStart?: React.ReactNode;
|
|
73
|
+
/**
|
|
74
|
+
* Additional children to be rendered at the end of the home page.
|
|
75
|
+
*/
|
|
66
76
|
additionalChildrenEnd?: React.ReactNode;
|
|
67
77
|
/**
|
|
68
78
|
* Use this component to add custom actions to the navigation card
|
|
@@ -5,14 +5,14 @@ export declare function removeInitialSlash(s: string): string;
|
|
|
5
5
|
export declare function removeTrailingSlash(s: string): string;
|
|
6
6
|
export declare function addInitialSlash(s: string): string;
|
|
7
7
|
export declare function getLastSegment(path: string): string;
|
|
8
|
-
export declare function
|
|
8
|
+
export declare function resolveCollectionPathIds(path: string, allCollections: EntityCollection[]): string;
|
|
9
9
|
/**
|
|
10
10
|
* Find the corresponding view at any depth for a given path.
|
|
11
11
|
* Note that path or segments of the paths can be collection aliases.
|
|
12
12
|
* @param pathOrAlias
|
|
13
13
|
* @param collections
|
|
14
14
|
*/
|
|
15
|
-
export declare function
|
|
15
|
+
export declare function getCollectionByPathOrId(pathOrAlias: string, collections: EntityCollection[]): EntityCollection | undefined;
|
|
16
16
|
/**
|
|
17
17
|
* Get the subcollection combinations from a path:
|
|
18
18
|
* "sites/es/locales" => ["sites/es/locales", "sites"]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@firecms/core",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.63",
|
|
4
4
|
"description": "Awesome Firebase/Firestore-based headless open-source CMS",
|
|
5
5
|
"funding": {
|
|
6
6
|
"url": "https://github.com/sponsors/firecmsco"
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"generateIcons": "ts-node --esm src/icons/generateIcons.ts"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@firecms/ui": "^3.0.0-alpha.
|
|
48
|
+
"@firecms/ui": "^3.0.0-alpha.63",
|
|
49
49
|
"@fontsource/ibm-plex-mono": "^5.0.8",
|
|
50
50
|
"@fontsource/roboto": "^5.0.8",
|
|
51
51
|
"@hello-pangea/dnd": "^16.5.0",
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
"dist",
|
|
117
117
|
"src"
|
|
118
118
|
],
|
|
119
|
-
"gitHead": "
|
|
119
|
+
"gitHead": "5605d67318bec83aeae289a2a8a989db32894e7c",
|
|
120
120
|
"publishConfig": {
|
|
121
121
|
"access": "public"
|
|
122
122
|
}
|
|
@@ -235,7 +235,7 @@ export const PropertyTableCell = React.memo<PropertyTableCellProps<any, any>>(
|
|
|
235
235
|
height={getRowHeight(size)}
|
|
236
236
|
propertyKey={propertyKey}
|
|
237
237
|
property={property}
|
|
238
|
-
entity={entity}
|
|
238
|
+
// entity={entity}
|
|
239
239
|
value={internalValue}
|
|
240
240
|
size={getPreviewSizeFrom(size)}
|
|
241
241
|
/>
|
|
@@ -404,7 +404,7 @@ export const PropertyTableCell = React.memo<PropertyTableCellProps<any, any>>(
|
|
|
404
404
|
<PropertyPreview
|
|
405
405
|
width={width}
|
|
406
406
|
height={height}
|
|
407
|
-
entity={entity}
|
|
407
|
+
// entity={entity}
|
|
408
408
|
propertyKey={propertyKey as string}
|
|
409
409
|
value={internalValue}
|
|
410
410
|
property={property}
|
|
@@ -27,11 +27,22 @@ search.addIndex("path");
|
|
|
27
27
|
* @group Components
|
|
28
28
|
*/
|
|
29
29
|
export function DefaultHomePage({
|
|
30
|
+
additionalActions,
|
|
30
31
|
additionalChildrenStart,
|
|
31
32
|
additionalChildrenEnd
|
|
32
33
|
}: {
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
/**
|
|
35
|
+
* Additional actions to be rendered in the home page, close to the search bar.
|
|
36
|
+
*/
|
|
37
|
+
additionalActions?: React.ReactNode;
|
|
38
|
+
/**
|
|
39
|
+
* Additional children to be rendered in the beginning of the home page.
|
|
40
|
+
*/
|
|
41
|
+
additionalChildrenStart?: React.ReactNode;
|
|
42
|
+
/**
|
|
43
|
+
* Additional children to be rendered at the end of the home page.
|
|
44
|
+
*/
|
|
45
|
+
additionalChildrenEnd?: React.ReactNode;
|
|
35
46
|
}) {
|
|
36
47
|
|
|
37
48
|
const context = useFireCMSContext();
|
|
@@ -117,12 +128,13 @@ export function DefaultHomePage({
|
|
|
117
128
|
className="py-2 overflow-auto h-full w-full">
|
|
118
129
|
<Container maxWidth={"6xl"}>
|
|
119
130
|
<div
|
|
120
|
-
className="sticky py-4 transition-all duration-400 ease-in-out top-0 z-10"
|
|
131
|
+
className="w-full sticky py-4 transition-all duration-400 ease-in-out top-0 z-10 flex flex-row gap-4"
|
|
121
132
|
style={{ top: direction === "down" ? -84 : 0 }}>
|
|
122
133
|
<SearchBar onTextSearch={updateSearchResults}
|
|
123
134
|
placeholder={"Search collections"}
|
|
124
135
|
large={false}
|
|
125
|
-
className={"w-full"}/>
|
|
136
|
+
className={"w-full flex-grow"}/>
|
|
137
|
+
{additionalActions}
|
|
126
138
|
</div>
|
|
127
139
|
|
|
128
140
|
<FavouritesView hidden={Boolean(filteredUrls)}/>
|
|
@@ -17,10 +17,10 @@ import {
|
|
|
17
17
|
UserConfigurationPersistence
|
|
18
18
|
} from "../types";
|
|
19
19
|
import {
|
|
20
|
-
|
|
20
|
+
getCollectionByPathOrId,
|
|
21
21
|
mergeDeep,
|
|
22
22
|
removeInitialAndTrailingSlashes,
|
|
23
|
-
|
|
23
|
+
resolveCollectionPathIds,
|
|
24
24
|
resolvePermissions
|
|
25
25
|
} from "../util";
|
|
26
26
|
import { getParentReferencesFromPath } from "../util/parent_references_from_path";
|
|
@@ -149,7 +149,7 @@ export function useBuildNavigationController<EC extends EntityCollection, UserTy
|
|
|
149
149
|
if (!collections)
|
|
150
150
|
return undefined;
|
|
151
151
|
|
|
152
|
-
const baseCollection =
|
|
152
|
+
const baseCollection = getCollectionByPathOrId(removeInitialAndTrailingSlashes(idOrPath), collections);
|
|
153
153
|
|
|
154
154
|
const userOverride = includeUserOverride ? userConfigPersistence?.getCollectionConfig(idOrPath) : undefined;
|
|
155
155
|
|
|
@@ -239,7 +239,7 @@ export function useBuildNavigationController<EC extends EntityCollection, UserTy
|
|
|
239
239
|
const resolveAliasesFrom = useCallback((path: string): string => {
|
|
240
240
|
if (!collections)
|
|
241
241
|
throw Error("Collections have not been initialised yet");
|
|
242
|
-
return
|
|
242
|
+
return resolveCollectionPathIds(path, collections);
|
|
243
243
|
}, [collections]);
|
|
244
244
|
|
|
245
245
|
const state = location.state as any;
|
|
@@ -261,6 +261,21 @@ export function useBuildNavigationController<EC extends EntityCollection, UserTy
|
|
|
261
261
|
return getAllParentCollectionsForPath(path).map(r => r.id);
|
|
262
262
|
}, [getAllParentCollectionsForPath])
|
|
263
263
|
|
|
264
|
+
const convertIdsToPaths = useCallback((ids: string[]): string[] => {
|
|
265
|
+
let currentCollections = collections;
|
|
266
|
+
const paths: string[] = [];
|
|
267
|
+
for (let i = 0; i < ids.length; i++) {
|
|
268
|
+
const id = ids[i];
|
|
269
|
+
const collection: EntityCollection | undefined = currentCollections!.find(c => c.id === id);
|
|
270
|
+
if (!collection)
|
|
271
|
+
throw Error(`Collection with id ${id} not found`);
|
|
272
|
+
paths.push(collection.path);
|
|
273
|
+
currentCollections = collection.subcollections;
|
|
274
|
+
}
|
|
275
|
+
return paths;
|
|
276
|
+
}
|
|
277
|
+
, [getCollectionFromIds]);
|
|
278
|
+
|
|
264
279
|
return useMemo(() => ({
|
|
265
280
|
collections: collections ?? [],
|
|
266
281
|
views: views ?? [],
|
|
@@ -283,7 +298,8 @@ export function useBuildNavigationController<EC extends EntityCollection, UserTy
|
|
|
283
298
|
baseLocation,
|
|
284
299
|
refreshNavigation,
|
|
285
300
|
getParentReferencesFromPath: getAllParentCollectionsForPath,
|
|
286
|
-
getParentCollectionIds
|
|
301
|
+
getParentCollectionIds,
|
|
302
|
+
convertIdsToPaths
|
|
287
303
|
}), [baseCollectionPath, baseLocation, basePath, buildCMSUrlPath, buildUrlCollectionPath, buildUrlEditCollectionPath, collections, getAllParentCollectionsForPath, getCollection, getCollectionFromPaths, homeUrl, initialised, isUrlCollectionPath, navigationLoading, navigationLoadingError, refreshNavigation, resolveAliasesFrom, topLevelNavigation, urlPathToDataPath, views]);
|
|
288
304
|
}
|
|
289
305
|
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import React, { createElement } from "react";
|
|
2
|
+
import equal from "react-fast-compare"
|
|
3
|
+
|
|
2
4
|
import {
|
|
3
5
|
CMSType,
|
|
4
6
|
EntityReference,
|
|
@@ -33,7 +35,7 @@ import { ErrorView } from "../components";
|
|
|
33
35
|
/**
|
|
34
36
|
* @group Preview components
|
|
35
37
|
*/
|
|
36
|
-
export function PropertyPreview<T extends CMSType>(props: PropertyPreviewProps<T>) {
|
|
38
|
+
export const PropertyPreview = React.memo(function PropertyPreview<T extends CMSType>(props: PropertyPreviewProps<T>) {
|
|
37
39
|
|
|
38
40
|
const fireCMSContext = useFireCMSContext();
|
|
39
41
|
let content: React.ReactNode | any;
|
|
@@ -44,7 +46,7 @@ export function PropertyPreview<T extends CMSType>(props: PropertyPreviewProps<T
|
|
|
44
46
|
size,
|
|
45
47
|
height,
|
|
46
48
|
width,
|
|
47
|
-
entity
|
|
49
|
+
// entity
|
|
48
50
|
} = props;
|
|
49
51
|
|
|
50
52
|
const property = resolveProperty({
|
|
@@ -65,7 +67,7 @@ export function PropertyPreview<T extends CMSType>(props: PropertyPreviewProps<T
|
|
|
65
67
|
size,
|
|
66
68
|
height,
|
|
67
69
|
width,
|
|
68
|
-
entity,
|
|
70
|
+
// entity,
|
|
69
71
|
customProps: property.customProps
|
|
70
72
|
});
|
|
71
73
|
} else if (value === null) {
|
|
@@ -111,14 +113,14 @@ export function PropertyPreview<T extends CMSType>(props: PropertyPreviewProps<T
|
|
|
111
113
|
value={value}
|
|
112
114
|
property={property as ResolvedArrayProperty}/>;
|
|
113
115
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
116
|
+
// else if (arrayProperty.of.dataType === "map") {
|
|
117
|
+
// content =
|
|
118
|
+
// <ArrayOfMapsPreview propertyKey={propertyKey}
|
|
119
|
+
// property={property as ResolvedArrayProperty}
|
|
120
|
+
// value={value as Record<string, any>[]} // This might be wrong
|
|
121
|
+
// entity={entity}
|
|
122
|
+
// size={size}
|
|
123
|
+
// />;
|
|
122
124
|
// }
|
|
123
125
|
else if (arrayProperty.of.dataType === "reference") {
|
|
124
126
|
content = <ArrayOfReferencesPreview {...props}
|
|
@@ -180,7 +182,7 @@ export function PropertyPreview<T extends CMSType>(props: PropertyPreviewProps<T
|
|
|
180
182
|
disabled={!property.path}
|
|
181
183
|
previewProperties={property.previewProperties}
|
|
182
184
|
size={props.size}
|
|
183
|
-
onClick={props.onClick}
|
|
185
|
+
// onClick={props.onClick}
|
|
184
186
|
reference={value as EntityReference}
|
|
185
187
|
/>;
|
|
186
188
|
} else {
|
|
@@ -209,7 +211,7 @@ export function PropertyPreview<T extends CMSType>(props: PropertyPreviewProps<T
|
|
|
209
211
|
}
|
|
210
212
|
|
|
211
213
|
return content === undefined || content === null ? <EmptyValue/> : content;
|
|
212
|
-
}
|
|
214
|
+
}, equal);
|
|
213
215
|
|
|
214
216
|
function buildWrongValueType(name: string | undefined, dataType: string, value: any) {
|
|
215
217
|
console.warn(`Unexpected value for property ${name}, of type ${dataType}`, value);
|
|
@@ -27,7 +27,7 @@ export interface PropertyPreviewProps<T extends CMSType = any, CustomProps = any
|
|
|
27
27
|
/**
|
|
28
28
|
* Click handler
|
|
29
29
|
*/
|
|
30
|
-
onClick?: () => void;
|
|
30
|
+
// onClick?: () => void;
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
33
|
* Desired size of the preview, depending on the context.
|
|
@@ -54,6 +54,6 @@ export interface PropertyPreviewProps<T extends CMSType = any, CustomProps = any
|
|
|
54
54
|
/**
|
|
55
55
|
* Entity this property refers to
|
|
56
56
|
*/
|
|
57
|
-
entity?: Entity<M>;
|
|
57
|
+
// entity?: Entity<M>;
|
|
58
58
|
|
|
59
59
|
}
|
|
@@ -160,7 +160,7 @@ function ReferencePreviewExisting<M extends Record<string, any> = any>({ referen
|
|
|
160
160
|
propertyKey={key as string}
|
|
161
161
|
value={getValueInPath(usedEntity.values, key)}
|
|
162
162
|
property={childProperty as ResolvedProperty}
|
|
163
|
-
entity={usedEntity}
|
|
163
|
+
// entity={usedEntity}
|
|
164
164
|
size={"tiny"}/>
|
|
165
165
|
: <SkeletonPropertyComponent
|
|
166
166
|
property={childProperty as ResolvedProperty}
|
|
@@ -13,7 +13,7 @@ export function ArrayOfMapsPreview({
|
|
|
13
13
|
value,
|
|
14
14
|
property: inputProperty,
|
|
15
15
|
size,
|
|
16
|
-
entity
|
|
16
|
+
// entity
|
|
17
17
|
}: PropertyPreviewProps<Record<string, any>[]>) {
|
|
18
18
|
const fireCMSContext = useFireCMSContext();
|
|
19
19
|
|
|
@@ -67,7 +67,7 @@ export function ArrayOfMapsPreview({
|
|
|
67
67
|
propertyKey={key as string}
|
|
68
68
|
value={(v)[key]}
|
|
69
69
|
property={properties[key as string]}
|
|
70
|
-
entity={entity}
|
|
70
|
+
// entity={entity}
|
|
71
71
|
size={"small"}/>
|
|
72
72
|
</ErrorBoundary>
|
|
73
73
|
</div>
|
|
@@ -13,7 +13,7 @@ import { ErrorBoundary } from "../../components";
|
|
|
13
13
|
*/
|
|
14
14
|
export function ArrayOfStorageComponentsPreview({
|
|
15
15
|
propertyKey,
|
|
16
|
-
entity,
|
|
16
|
+
// entity,
|
|
17
17
|
value,
|
|
18
18
|
property: inputProperty,
|
|
19
19
|
size
|
|
@@ -44,7 +44,7 @@ export function ArrayOfStorageComponentsPreview({
|
|
|
44
44
|
<PropertyPreview
|
|
45
45
|
propertyKey={propertyKey}
|
|
46
46
|
value={v}
|
|
47
|
-
entity={entity}
|
|
47
|
+
// entity={entity}
|
|
48
48
|
property={property.of as ResolvedProperty<string>}
|
|
49
49
|
size={childSize}/>
|
|
50
50
|
</ErrorBoundary>
|
|
@@ -13,7 +13,7 @@ export function ArrayOfStringsPreview({
|
|
|
13
13
|
propertyKey,
|
|
14
14
|
value,
|
|
15
15
|
property: inputProperty,
|
|
16
|
-
entity,
|
|
16
|
+
// entity,
|
|
17
17
|
size
|
|
18
18
|
}: PropertyPreviewProps<string[]>) {
|
|
19
19
|
|
|
@@ -45,7 +45,7 @@ export function ArrayOfStringsPreview({
|
|
|
45
45
|
<StringPropertyPreview propertyKey={propertyKey}
|
|
46
46
|
property={stringProperty}
|
|
47
47
|
value={v}
|
|
48
|
-
entity={entity}
|
|
48
|
+
// entity={entity}
|
|
49
49
|
size={size}/>
|
|
50
50
|
</ErrorBoundary>
|
|
51
51
|
</div>
|
|
@@ -16,7 +16,7 @@ export function ArrayOneOfPreview({
|
|
|
16
16
|
value,
|
|
17
17
|
property: inputProperty,
|
|
18
18
|
size,
|
|
19
|
-
entity
|
|
19
|
+
// entity
|
|
20
20
|
}: PropertyPreviewProps<any[]>) {
|
|
21
21
|
|
|
22
22
|
const fireCMSContext = useFireCMSContext();
|
|
@@ -55,7 +55,7 @@ export function ArrayOneOfPreview({
|
|
|
55
55
|
{value && <PropertyPreview
|
|
56
56
|
propertyKey={propertyKey}
|
|
57
57
|
value={value[valueField]}
|
|
58
|
-
entity={entity}
|
|
58
|
+
// entity={entity}
|
|
59
59
|
property={(property.resolvedProperties[index] ?? properties[value[typeField]]) as ResolvedProperty<any>}
|
|
60
60
|
size={childSize}/>}
|
|
61
61
|
</ErrorBoundary>
|
|
@@ -15,7 +15,7 @@ export function ArrayPropertyPreview({
|
|
|
15
15
|
propertyKey,
|
|
16
16
|
value,
|
|
17
17
|
property: inputProperty,
|
|
18
|
-
entity,
|
|
18
|
+
// entity,
|
|
19
19
|
size
|
|
20
20
|
}: PropertyPreviewProps<any[]>) {
|
|
21
21
|
|
|
@@ -53,7 +53,7 @@ export function ArrayPropertyPreview({
|
|
|
53
53
|
<ErrorBoundary>
|
|
54
54
|
<PropertyPreview
|
|
55
55
|
propertyKey={propertyKey}
|
|
56
|
-
entity={entity}
|
|
56
|
+
// entity={entity}
|
|
57
57
|
value={value}
|
|
58
58
|
property={of}
|
|
59
59
|
size={childSize}/>
|
|
@@ -13,7 +13,7 @@ export function MapPropertyPreview<T extends Record<string, any> = Record<string
|
|
|
13
13
|
propertyKey,
|
|
14
14
|
value,
|
|
15
15
|
property,
|
|
16
|
-
entity,
|
|
16
|
+
// entity,
|
|
17
17
|
size
|
|
18
18
|
}: PropertyPreviewProps<T>) {
|
|
19
19
|
|
|
@@ -43,7 +43,7 @@ export function MapPropertyPreview<T extends Record<string, any> = Record<string
|
|
|
43
43
|
<PropertyPreview propertyKey={key}
|
|
44
44
|
value={(value)[key]}
|
|
45
45
|
property={mapProperty.properties![key]}
|
|
46
|
-
entity={entity}
|
|
46
|
+
// entity={entity}
|
|
47
47
|
size={size}/>
|
|
48
48
|
</ErrorBoundary>
|
|
49
49
|
</div>
|
|
@@ -79,7 +79,7 @@ export function MapPropertyPreview<T extends Record<string, any> = Record<string
|
|
|
79
79
|
propertyKey={key}
|
|
80
80
|
value={(value)[key]}
|
|
81
81
|
property={childProperty}
|
|
82
|
-
entity={entity}
|
|
82
|
+
// entity={entity}
|
|
83
83
|
size={size}/>}
|
|
84
84
|
</ErrorBoundary>
|
|
85
85
|
</div>
|
|
@@ -91,7 +91,7 @@ export function MapPropertyPreview<T extends Record<string, any> = Record<string
|
|
|
91
91
|
propertyKey={key}
|
|
92
92
|
value={(value)[key]}
|
|
93
93
|
property={childProperty}
|
|
94
|
-
entity={entity}
|
|
94
|
+
// entity={entity}
|
|
95
95
|
size={size}/>
|
|
96
96
|
</div>
|
|
97
97
|
}
|
package/src/types/navigation.ts
CHANGED
|
@@ -129,7 +129,7 @@ export type NavigationController = {
|
|
|
129
129
|
refreshNavigation: () => void;
|
|
130
130
|
|
|
131
131
|
/**
|
|
132
|
-
* Retrieve all the related parent
|
|
132
|
+
* Retrieve all the related parent references for a given path
|
|
133
133
|
* @param path
|
|
134
134
|
*/
|
|
135
135
|
getParentReferencesFromPath: (path: string) => EntityReference[];
|
|
@@ -139,6 +139,12 @@ export type NavigationController = {
|
|
|
139
139
|
* @param path
|
|
140
140
|
*/
|
|
141
141
|
getParentCollectionIds: (path: string) => string[];
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Resolve paths from a list of ids
|
|
145
|
+
* @param ids
|
|
146
|
+
*/
|
|
147
|
+
convertIdsToPaths: (ids: string[]) => string[];
|
|
142
148
|
}
|
|
143
149
|
|
|
144
150
|
/**
|
package/src/types/plugins.tsx
CHANGED
|
@@ -78,8 +78,21 @@ export type FireCMSPlugin<PROPS = any, FORM_PROPS = any, EC extends EntityCollec
|
|
|
78
78
|
|
|
79
79
|
homePage?: {
|
|
80
80
|
|
|
81
|
+
/**
|
|
82
|
+
* Additional actions to be rendered in the home page, close to the search bar.
|
|
83
|
+
*/
|
|
84
|
+
additionalActions?: React.ReactNode;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Additional children to be rendered in the beginning of the home page.
|
|
88
|
+
*/
|
|
81
89
|
additionalChildrenStart?: React.ReactNode;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Additional children to be rendered at the end of the home page.
|
|
93
|
+
*/
|
|
82
94
|
additionalChildrenEnd?: React.ReactNode;
|
|
95
|
+
|
|
83
96
|
/**
|
|
84
97
|
* Use this component to add custom actions to the navigation card
|
|
85
98
|
* in the home page.
|
|
@@ -52,9 +52,12 @@ export function joinCollectionLists(targetCollections: EntityCollection[],
|
|
|
52
52
|
}
|
|
53
53
|
});
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
const sourceCollectionIds = updatedCollections.map(c => c.id);
|
|
56
|
+
// fetched collections that are not in the source collections
|
|
56
57
|
const resultStoredCollections = targetCollections
|
|
57
|
-
.filter((col) =>
|
|
58
|
+
.filter((col) => {
|
|
59
|
+
return !sourceCollectionIds.includes(col.id);
|
|
60
|
+
})
|
|
58
61
|
.map((col) => {
|
|
59
62
|
if (modifyCollection) {
|
|
60
63
|
return applyModifyFunction(modifyCollection, col, parentPaths);
|