@firecms/core 3.0.0-canary.42 → 3.0.0-canary.44
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/EntityCollectionTable/EntityCollectionTable.d.ts +1 -1
- package/dist/components/EntityCollectionTable/EntityCollectionTableProps.d.ts +4 -2
- package/dist/components/EntityCollectionTable/PropertyTableCell.d.ts +1 -0
- package/dist/components/EntityCollectionTable/internal/popup_field/PopupFormField.d.ts +1 -1
- package/dist/components/FireCMSAppBar.d.ts +3 -2
- package/dist/components/SelectableTable/SelectableTable.d.ts +1 -1
- package/dist/components/common/types.d.ts +4 -6
- package/dist/core/NavigationRoutes.d.ts +1 -1
- package/dist/core/Scaffold.d.ts +1 -1
- package/dist/hooks/data/save.d.ts +1 -2
- package/dist/hooks/useValidateAuthenticator.d.ts +2 -6
- package/dist/index.es.js +4102 -4094
- 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/internal/useBuildDataSource.d.ts +1 -16
- package/dist/types/datasource.d.ts +2 -5
- package/dist/types/entities.d.ts +5 -1
- package/dist/types/index.d.ts +0 -1
- package/dist/types/properties.d.ts +2 -2
- package/dist/util/entities.d.ts +1 -1
- package/package.json +17 -17
- package/src/components/EntityCollectionTable/EntityCollectionTable.tsx +16 -8
- package/src/components/EntityCollectionTable/EntityCollectionTableProps.tsx +6 -4
- package/src/components/EntityCollectionTable/PropertyTableCell.tsx +33 -32
- package/src/components/EntityCollectionTable/internal/EntityTableCell.tsx +11 -6
- package/src/components/EntityCollectionTable/internal/popup_field/PopupFormField.tsx +2 -4
- package/src/components/EntityCollectionView/EntityCollectionView.tsx +10 -6
- package/src/components/FireCMSAppBar.tsx +23 -8
- package/src/components/ReferenceTable/ReferenceSelectionTable.tsx +1 -0
- package/src/components/SelectableTable/SelectableTable.tsx +1 -1
- package/src/components/SelectableTable/filters/BooleanFilterField.tsx +2 -3
- package/src/components/VirtualTable/VirtualTable.tsx +1 -1
- package/src/components/common/types.tsx +4 -6
- package/src/core/NavigationRoutes.tsx +3 -4
- package/src/core/Scaffold.tsx +5 -4
- package/src/hooks/data/save.ts +1 -1
- package/src/hooks/useValidateAuthenticator.tsx +2 -22
- package/src/internal/useBuildDataSource.ts +42 -47
- package/src/preview/PropertyPreview.tsx +2 -12
- package/src/types/datasource.ts +7 -4
- package/src/types/entities.ts +9 -1
- package/src/types/index.ts +0 -1
- package/src/types/properties.ts +5 -4
- package/src/util/entities.ts +1 -1
- package/dist/types/appcheck.d.ts +0 -26
- package/src/types/appcheck.ts +0 -29
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
|
|
3
3
|
import { Link as ReactLink } from "react-router-dom";
|
|
4
|
-
import { ErrorBoundary } from "../components";
|
|
4
|
+
import { ErrorBoundary, FireCMSLogo } from "../components";
|
|
5
5
|
import {
|
|
6
6
|
Avatar,
|
|
7
7
|
cn,
|
|
@@ -18,7 +18,8 @@ import { useAuthController, useLargeLayout, useModeController, useNavigationCont
|
|
|
18
18
|
import { User } from "../types";
|
|
19
19
|
|
|
20
20
|
export type FireCMSAppBarProps<ADDITIONAL_PROPS = object> = {
|
|
21
|
-
|
|
21
|
+
|
|
22
|
+
title: React.ReactNode;
|
|
22
23
|
/**
|
|
23
24
|
* A component that gets rendered on the upper side of the main toolbar
|
|
24
25
|
*/
|
|
@@ -36,6 +37,8 @@ export type FireCMSAppBarProps<ADDITIONAL_PROPS = object> = {
|
|
|
36
37
|
|
|
37
38
|
style?: React.CSSProperties;
|
|
38
39
|
|
|
40
|
+
logo?: string;
|
|
41
|
+
|
|
39
42
|
user?: User;
|
|
40
43
|
} & ADDITIONAL_PROPS;
|
|
41
44
|
|
|
@@ -57,6 +60,7 @@ export const FireCMSAppBar = function FireCMSAppBar({
|
|
|
57
60
|
includeDrawer,
|
|
58
61
|
className,
|
|
59
62
|
style,
|
|
63
|
+
logo,
|
|
60
64
|
user: userProp
|
|
61
65
|
}: FireCMSAppBarProps) {
|
|
62
66
|
const navigation = useNavigationController();
|
|
@@ -102,7 +106,7 @@ export const FireCMSAppBar = function FireCMSAppBar({
|
|
|
102
106
|
"w-[calc(100%-64px)]": includeDrawer && !(drawerOpen && largeLayout),
|
|
103
107
|
"w-[calc(100%-17rem)]": includeDrawer && (drawerOpen && largeLayout),
|
|
104
108
|
"duration-150": drawerOpen && largeLayout,
|
|
105
|
-
fixed: true
|
|
109
|
+
fixed: true
|
|
106
110
|
},
|
|
107
111
|
className)}>
|
|
108
112
|
|
|
@@ -110,16 +114,27 @@ export const FireCMSAppBar = function FireCMSAppBar({
|
|
|
110
114
|
|
|
111
115
|
{startAdornment}
|
|
112
116
|
|
|
117
|
+
|
|
113
118
|
{navigation && <div className="mr-8 hidden lg:block">
|
|
114
119
|
<ReactLink
|
|
115
120
|
className="visited:text-inherit visited:dark:text-inherit"
|
|
116
121
|
to={navigation?.basePath ?? "/"}
|
|
117
122
|
>
|
|
118
|
-
<
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
+
<div className={"flex flex-row gap-4"}>
|
|
124
|
+
{!includeDrawer && (logo
|
|
125
|
+
? <img src={logo}
|
|
126
|
+
alt="Logo"
|
|
127
|
+
className={cn("w-[32px] h-[32px]")}/>
|
|
128
|
+
: <FireCMSLogo width={"32px"} height={"32px"}/>)}
|
|
129
|
+
|
|
130
|
+
{typeof title === "string"
|
|
131
|
+
? <Typography variant="subtitle1"
|
|
132
|
+
noWrap
|
|
133
|
+
className={"ml-2 !font-medium"}>
|
|
134
|
+
{title}
|
|
135
|
+
</Typography>
|
|
136
|
+
: title}
|
|
137
|
+
</div>
|
|
123
138
|
</ReactLink>
|
|
124
139
|
</div>}
|
|
125
140
|
|
|
@@ -291,6 +291,7 @@ export function ReferenceSelectionTable<M extends Record<string, any>>(
|
|
|
291
291
|
displayedColumnIds={displayedColumnIds}
|
|
292
292
|
onEntityClick={onEntityClick}
|
|
293
293
|
tableController={tableController}
|
|
294
|
+
enablePopupIcon={false}
|
|
294
295
|
tableRowActionsBuilder={tableRowActionsBuilder}
|
|
295
296
|
title={<Typography variant={"subtitle2"}>
|
|
296
297
|
{collection.singularName ? `Select ${collection.singularName}` : `Select from ${collection.name}`}
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
} from "../../types";
|
|
11
11
|
import { CellRendererParams, VirtualTable, VirtualTableColumn } from "../VirtualTable";
|
|
12
12
|
import { enumToObjectEntries } from "../../util";
|
|
13
|
-
import { OnCellValueChange, OnColumnResizeParams } from "../common
|
|
13
|
+
import { OnCellValueChange, OnColumnResizeParams } from "../common";
|
|
14
14
|
import { FilterFormFieldProps } from "../VirtualTable/VirtualTableHeader";
|
|
15
15
|
import { ReferenceFilterField } from "./filters/ReferenceFilterField";
|
|
16
16
|
import { StringNumberFilterField } from "./filters/StringNumberFilterField";
|
|
@@ -32,7 +32,7 @@ export function BooleanFilterField({
|
|
|
32
32
|
const valueSet = !!value;
|
|
33
33
|
|
|
34
34
|
return (
|
|
35
|
-
<div className="w-[
|
|
35
|
+
<div className="w-[300px]">
|
|
36
36
|
<BooleanSwitchWithLabel
|
|
37
37
|
value={valueSetToTrue}
|
|
38
38
|
allowIndeterminate={true}
|
|
@@ -44,6 +44,5 @@ export function BooleanFilterField({
|
|
|
44
44
|
: `${title} is false`}
|
|
45
45
|
/>
|
|
46
46
|
</div>
|
|
47
|
-
)
|
|
48
|
-
;
|
|
47
|
+
);
|
|
49
48
|
}
|
|
@@ -404,7 +404,7 @@ const SafeLinkRenderer: React.FC<{
|
|
|
404
404
|
const urlRegex = /https?:\/\/[^\s]+/g;
|
|
405
405
|
const htmlContent = text.replace(urlRegex, (url) => {
|
|
406
406
|
// For each URL found, replace it with an HTML <a> tag
|
|
407
|
-
return `<a href="${url}" target="_blank">Link</a><br/>`;
|
|
407
|
+
return `<a href="${url}" class="underline" target="_blank">Link</a><br/>`;
|
|
408
408
|
});
|
|
409
409
|
|
|
410
410
|
return (
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CollectionSize,
|
|
1
|
+
import { CollectionSize, FireCMSContext, ResolvedProperty, SelectedCellProps } from "../../types";
|
|
2
2
|
|
|
3
3
|
export type EntityCollectionTableController<M extends Record<string, any>> = {
|
|
4
4
|
|
|
@@ -31,14 +31,12 @@ export type EntityCollectionTableController<M extends Record<string, any>> = {
|
|
|
31
31
|
* Props passed in a callback when the content of a cell in a table has been edited
|
|
32
32
|
* @group Collection components
|
|
33
33
|
*/
|
|
34
|
-
export interface OnCellValueChangeParams<T = any,
|
|
34
|
+
export interface OnCellValueChangeParams<T = any, D = any> {
|
|
35
35
|
value: T,
|
|
36
36
|
propertyKey: string,
|
|
37
|
-
|
|
37
|
+
data?: D,
|
|
38
38
|
onValueUpdated: () => void
|
|
39
|
-
setError: (e: Error) => void
|
|
40
|
-
fullPath: string
|
|
41
|
-
context: FireCMSContext
|
|
39
|
+
setError: (e: Error | undefined) => void
|
|
42
40
|
}
|
|
43
41
|
|
|
44
42
|
/**
|
|
@@ -13,7 +13,7 @@ export type NavigationRoutesProps = {
|
|
|
13
13
|
/**
|
|
14
14
|
* In case you need to override the home page
|
|
15
15
|
*/
|
|
16
|
-
|
|
16
|
+
homePage?: React.ReactNode;
|
|
17
17
|
|
|
18
18
|
customRoutes?: React.ReactNode[]
|
|
19
19
|
|
|
@@ -28,10 +28,9 @@ export type NavigationRoutesProps = {
|
|
|
28
28
|
* @constructor
|
|
29
29
|
* @group Components
|
|
30
30
|
*/
|
|
31
|
-
|
|
32
31
|
export const NavigationRoutes = React.memo<NavigationRoutesProps>(
|
|
33
32
|
function NavigationRoutes({
|
|
34
|
-
|
|
33
|
+
homePage = <DefaultHomePage/>,
|
|
35
34
|
customRoutes
|
|
36
35
|
}: NavigationRoutesProps) {
|
|
37
36
|
|
|
@@ -93,7 +92,7 @@ export const NavigationRoutes = React.memo<NavigationRoutesProps>(
|
|
|
93
92
|
|
|
94
93
|
const homeRoute = (
|
|
95
94
|
<Route path={"/"}
|
|
96
|
-
element={
|
|
95
|
+
element={homePage}/>
|
|
97
96
|
);
|
|
98
97
|
|
|
99
98
|
const notFoundRoute = <Route path={"*"}
|
package/src/core/Scaffold.tsx
CHANGED
|
@@ -17,7 +17,7 @@ export interface ScaffoldProps<ExtraDrawerProps = object, ExtraAppbarProps = obj
|
|
|
17
17
|
/**
|
|
18
18
|
* Name of the app, displayed as the main title and in the tab title
|
|
19
19
|
*/
|
|
20
|
-
name:
|
|
20
|
+
name: React.ReactNode;
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* Logo to be displayed in the drawer of the CMS
|
|
@@ -112,9 +112,10 @@ export const Scaffold = React.memo<PropsWithChildren<ScaffoldProps>>(
|
|
|
112
112
|
}}>
|
|
113
113
|
|
|
114
114
|
<FireCMSAppBar title={name}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
115
|
+
includeDrawer={includeDrawer}
|
|
116
|
+
logo={logo}
|
|
117
|
+
drawerOpen={computedDrawerOpen}
|
|
118
|
+
{...fireCMSAppBarProps}/>
|
|
118
119
|
|
|
119
120
|
<StyledDrawer
|
|
120
121
|
displayed={includeDrawer}
|
package/src/hooks/data/save.ts
CHANGED
|
@@ -17,7 +17,6 @@ import { resolveCollection } from "../../util";
|
|
|
17
17
|
export type SaveEntityWithCallbacksProps<M extends Record<string, any>> =
|
|
18
18
|
SaveEntityProps<M> &
|
|
19
19
|
{
|
|
20
|
-
callbacks?: EntityCallbacks<M>;
|
|
21
20
|
onSaveSuccess?: (updatedEntity: Entity<M>) => void,
|
|
22
21
|
onSaveFailure?: (e: Error) => void,
|
|
23
22
|
onPreSaveHookError?: (e: Error) => void,
|
|
@@ -145,6 +144,7 @@ export async function saveEntityWithCallbacks<M extends Record<string, any>, Use
|
|
|
145
144
|
onSaveSuccess(entity);
|
|
146
145
|
})
|
|
147
146
|
.catch((e) => {
|
|
147
|
+
console.error("!!!", e);
|
|
148
148
|
if (callbacks?.onSaveFailure) {
|
|
149
149
|
|
|
150
150
|
const resolvedCollection = resolveCollection<M>({
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
2
2
|
import equal from "react-fast-compare";
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { AuthController, Authenticator, DataSourceDelegate, StorageSource, User } from "../index";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* This hook is used internally for validating an authenticator.
|
|
8
8
|
*
|
|
9
9
|
* @param authController
|
|
10
10
|
* @param authentication
|
|
11
|
-
* @param getAppCheckToken
|
|
12
|
-
* @param appCheckForceRefresh
|
|
13
11
|
* @param storageSource
|
|
14
12
|
* @param dataSourceDelegate
|
|
15
13
|
*/
|
|
@@ -17,8 +15,6 @@ export function useValidateAuthenticator<UserType extends User = User, Controlle
|
|
|
17
15
|
disabled,
|
|
18
16
|
authController,
|
|
19
17
|
authenticator,
|
|
20
|
-
getAppCheckToken,
|
|
21
|
-
appCheckForceRefresh = false,
|
|
22
18
|
storageSource,
|
|
23
19
|
dataSourceDelegate
|
|
24
20
|
}:
|
|
@@ -26,8 +22,6 @@ export function useValidateAuthenticator<UserType extends User = User, Controlle
|
|
|
26
22
|
disabled?: boolean,
|
|
27
23
|
authController: Controller,
|
|
28
24
|
authenticator?: boolean | Authenticator<UserType, Controller>,
|
|
29
|
-
getAppCheckToken?: (forceRefresh: boolean) => Promise<AppCheckTokenResult> | undefined,
|
|
30
|
-
appCheckForceRefresh?: boolean,
|
|
31
25
|
dataSourceDelegate: DataSourceDelegate;
|
|
32
26
|
storageSource: StorageSource;
|
|
33
27
|
}): {
|
|
@@ -78,20 +72,6 @@ export function useValidateAuthenticator<UserType extends User = User, Controlle
|
|
|
78
72
|
const delegateUser = authController.user;
|
|
79
73
|
console.debug("Checking authentication for user", delegateUser);
|
|
80
74
|
|
|
81
|
-
if (getAppCheckToken) {
|
|
82
|
-
try {
|
|
83
|
-
if (!await getAppCheckToken(appCheckForceRefresh)) {
|
|
84
|
-
setNotAllowedError("App Check failed.");
|
|
85
|
-
authController.signOut();
|
|
86
|
-
} else {
|
|
87
|
-
console.debug("App Check success.");
|
|
88
|
-
}
|
|
89
|
-
} catch (e: any) {
|
|
90
|
-
setNotAllowedError(e.message);
|
|
91
|
-
authController.signOut();
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
75
|
if (authenticator instanceof Function && delegateUser && !equal(checkedUserRef.current?.uid, delegateUser.uid)) {
|
|
96
76
|
setAuthLoading(true);
|
|
97
77
|
try {
|
|
@@ -120,7 +100,7 @@ export function useValidateAuthenticator<UserType extends User = User, Controlle
|
|
|
120
100
|
setAuthVerified(true);
|
|
121
101
|
}
|
|
122
102
|
|
|
123
|
-
}, [disabled, authController, authenticator,
|
|
103
|
+
}, [disabled, authController, authenticator, dataSourceDelegate, storageSource]);
|
|
124
104
|
|
|
125
105
|
useEffect(() => {
|
|
126
106
|
checkAuthentication();
|
|
@@ -5,12 +5,10 @@ import {
|
|
|
5
5
|
DeleteEntityProps,
|
|
6
6
|
Entity,
|
|
7
7
|
EntityCollection,
|
|
8
|
-
EntityReference,
|
|
9
8
|
EntityValues,
|
|
10
9
|
FetchCollectionProps,
|
|
11
10
|
FetchEntityProps,
|
|
12
11
|
FilterValues,
|
|
13
|
-
GeoPoint,
|
|
14
12
|
ListenCollectionProps,
|
|
15
13
|
ListenEntityProps,
|
|
16
14
|
NavigationController,
|
|
@@ -207,13 +205,10 @@ export function useBuildDataSource({
|
|
|
207
205
|
|
|
208
206
|
const properties: ResolvedProperties<M> | undefined = resolvedCollection?.properties;
|
|
209
207
|
|
|
210
|
-
const firestoreValues = cmsToDelegateModel(
|
|
208
|
+
const firestoreValues = delegate.cmsToDelegateModel(
|
|
211
209
|
values,
|
|
212
|
-
delegate.buildReference,
|
|
213
|
-
delegate.buildGeoPoint,
|
|
214
|
-
delegate.buildDate,
|
|
215
|
-
delegate.buildDeleteFieldValue
|
|
216
210
|
);
|
|
211
|
+
|
|
217
212
|
const updatedFirestoreValues: EntityValues<M> = properties
|
|
218
213
|
? updateDateAutoValues(
|
|
219
214
|
{
|
|
@@ -316,48 +311,48 @@ export function useBuildDataSource({
|
|
|
316
311
|
sortBy
|
|
317
312
|
}
|
|
318
313
|
)
|
|
319
|
-
}, [delegate.isFilterCombinationValid])
|
|
314
|
+
}, [delegate.isFilterCombinationValid]),
|
|
320
315
|
|
|
321
316
|
};
|
|
322
317
|
|
|
323
318
|
}
|
|
324
319
|
|
|
325
|
-
/**
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
export function cmsToDelegateModel(data: any,
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
): any {
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
}
|
|
320
|
+
// /**
|
|
321
|
+
// * Recursive function that converts Firestore data types into CMS or plain
|
|
322
|
+
// * JS types.
|
|
323
|
+
// * FireCMS uses Javascript dates internally instead of Firestore timestamps.
|
|
324
|
+
// * This makes it easier to interact with the rest of the libraries and
|
|
325
|
+
// * bindings.
|
|
326
|
+
// * Also, Firestore references are replaced with {@link EntityReference}
|
|
327
|
+
// * @param data
|
|
328
|
+
// * @param buildReference
|
|
329
|
+
// * @param buildGeoPoint
|
|
330
|
+
// * @param buildDate
|
|
331
|
+
// * @param buildDelete
|
|
332
|
+
// * @group Firestore
|
|
333
|
+
// */
|
|
334
|
+
// export function cmsToDelegateModel(data: any,
|
|
335
|
+
// buildReference: (reference: EntityReference) => any,
|
|
336
|
+
// buildGeoPoint: (geoPoint: GeoPoint) => any,
|
|
337
|
+
// buildDate: (date: Date) => any,
|
|
338
|
+
// buildDelete: () => any
|
|
339
|
+
// ): any {
|
|
340
|
+
// if (data === undefined) {
|
|
341
|
+
// return buildDelete();
|
|
342
|
+
// } else if (data === null) {
|
|
343
|
+
// return null;
|
|
344
|
+
// } else if (Array.isArray(data)) {
|
|
345
|
+
// return data.map(v => cmsToDelegateModel(v, buildReference, buildGeoPoint, buildDate, buildDelete));
|
|
346
|
+
// } else if (data.isEntityReference && data.isEntityReference()) {
|
|
347
|
+
// return buildReference(data);
|
|
348
|
+
// } else if (data instanceof GeoPoint) {
|
|
349
|
+
// return buildGeoPoint(data);
|
|
350
|
+
// } else if (data instanceof Date) {
|
|
351
|
+
// return buildDate(data);
|
|
352
|
+
// } else if (data && typeof data === "object") {
|
|
353
|
+
// return Object.entries(data)
|
|
354
|
+
// .map(([key, v]) => ({ [key]: cmsToDelegateModel(v, buildReference, buildGeoPoint, buildDate, buildDelete) }))
|
|
355
|
+
// .reduce((a, b) => ({ ...a, ...b }), {});
|
|
356
|
+
// }
|
|
357
|
+
// return data;
|
|
358
|
+
// }
|
|
@@ -92,7 +92,7 @@ export const PropertyPreview = React.memo(function PropertyPreview<T extends CMS
|
|
|
92
92
|
size={props.size}
|
|
93
93
|
storagePathOrDownloadUrl={value}/>;
|
|
94
94
|
} else if (stringProperty.markdown) {
|
|
95
|
-
content = <Markdown source={value}/>;
|
|
95
|
+
content = <Markdown source={value} size={"small"}/>;
|
|
96
96
|
} else {
|
|
97
97
|
content = <StringPropertyPreview {...props}
|
|
98
98
|
property={stringProperty}
|
|
@@ -113,17 +113,7 @@ export const PropertyPreview = React.memo(function PropertyPreview<T extends CMS
|
|
|
113
113
|
content = <ArrayPropertyPreview {...props}
|
|
114
114
|
value={value}
|
|
115
115
|
property={property as ResolvedArrayProperty}/>;
|
|
116
|
-
}
|
|
117
|
-
// else if (arrayProperty.of.dataType === "map") {
|
|
118
|
-
// content =
|
|
119
|
-
// <ArrayOfMapsPreview propertyKey={propertyKey}
|
|
120
|
-
// property={property as ResolvedArrayProperty}
|
|
121
|
-
// value={value as Record<string, any>[]} // This might be wrong
|
|
122
|
-
// entity={entity}
|
|
123
|
-
// size={size}
|
|
124
|
-
// />;
|
|
125
|
-
// }
|
|
126
|
-
else if (arrayProperty.of.dataType === "reference") {
|
|
116
|
+
} else if (arrayProperty.of.dataType === "reference") {
|
|
127
117
|
content = <ArrayOfReferencesPreview {...props}
|
|
128
118
|
value={value}
|
|
129
119
|
property={property as ResolvedArrayProperty}/>;
|
package/src/types/datasource.ts
CHANGED
|
@@ -216,6 +216,7 @@ export interface DataSource {
|
|
|
216
216
|
* @param props
|
|
217
217
|
*/
|
|
218
218
|
isFilterCombinationValid?(props: FilterCombinationValidProps): boolean;
|
|
219
|
+
|
|
219
220
|
}
|
|
220
221
|
|
|
221
222
|
export type FilterCombinationValidProps = {
|
|
@@ -366,24 +367,26 @@ export interface DataSourceDelegate {
|
|
|
366
367
|
* Convert a FireCMS reference to a reference that can be used by the datasource
|
|
367
368
|
* @param reference
|
|
368
369
|
*/
|
|
369
|
-
buildReference: (reference: EntityReference) => any,
|
|
370
|
+
// buildReference: (reference: EntityReference) => any,
|
|
370
371
|
|
|
371
372
|
/**
|
|
372
373
|
* Convert a FireCMS GeoPoint to a GeoPoint that can be used by the datasource
|
|
373
374
|
* @param geoPoint
|
|
374
375
|
*/
|
|
375
|
-
buildGeoPoint: (geoPoint: GeoPoint) => any,
|
|
376
|
+
// buildGeoPoint: (geoPoint: GeoPoint) => any,
|
|
376
377
|
|
|
377
378
|
/**
|
|
378
379
|
* Get the object to generate the current time in the datasource
|
|
379
380
|
*/
|
|
380
381
|
currentTime(): any;
|
|
381
382
|
|
|
382
|
-
buildDate: (date: Date) => any;
|
|
383
|
+
// buildDate: (date: Date) => any;
|
|
383
384
|
|
|
384
|
-
buildDeleteFieldValue: () => any;
|
|
385
|
+
// buildDeleteFieldValue: () => any;
|
|
385
386
|
|
|
386
387
|
delegateToCMSModel: (data: any) => any;
|
|
387
388
|
|
|
389
|
+
cmsToDelegateModel: (data: any) => any;
|
|
390
|
+
|
|
388
391
|
setDateToMidnight: (input?: any) => any;
|
|
389
392
|
}
|
package/src/types/entities.ts
CHANGED
|
@@ -37,7 +37,7 @@ export type EntityValues<M extends object> = M;
|
|
|
37
37
|
/**
|
|
38
38
|
* Class used to create a reference to an entity in a different path
|
|
39
39
|
*/
|
|
40
|
-
export class EntityReference
|
|
40
|
+
export class EntityReference {
|
|
41
41
|
/**
|
|
42
42
|
* ID of the entity
|
|
43
43
|
*/
|
|
@@ -78,3 +78,11 @@ export class GeoPoint {
|
|
|
78
78
|
this.longitude = longitude;
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
|
+
|
|
82
|
+
export class Vector {
|
|
83
|
+
readonly value: number[];
|
|
84
|
+
|
|
85
|
+
constructor(value: number[]) {
|
|
86
|
+
this.value = value;
|
|
87
|
+
}
|
|
88
|
+
}
|
package/src/types/index.ts
CHANGED
|
@@ -23,7 +23,6 @@ export * from "./plugins";
|
|
|
23
23
|
export * from "./analytics";
|
|
24
24
|
export * from "./firecms";
|
|
25
25
|
export * from "./roles";
|
|
26
|
-
export * from "./appcheck";
|
|
27
26
|
export * from "./export_import";
|
|
28
27
|
export * from "./modify_collections";
|
|
29
28
|
export * from "./analytics_controller";
|
package/src/types/properties.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { FieldProps } from "./fields";
|
|
3
3
|
import { PropertyPreviewProps } from "../preview";
|
|
4
|
-
import { EntityReference, EntityValues, GeoPoint } from "./entities";
|
|
4
|
+
import { EntityReference, EntityValues, GeoPoint, Vector } from "./entities";
|
|
5
5
|
import { ResolvedArrayProperty, ResolvedStringProperty } from "./resolved_entities";
|
|
6
6
|
import { FilterValues } from "./collections";
|
|
7
7
|
import { ChipColorKey, ChipColorScheme } from "@firecms/ui";
|
|
@@ -15,9 +15,10 @@ export type DataType<T extends CMSType = CMSType> =
|
|
|
15
15
|
T extends boolean ? "boolean" :
|
|
16
16
|
T extends Date ? "date" :
|
|
17
17
|
T extends GeoPoint ? "geopoint" :
|
|
18
|
-
T extends
|
|
19
|
-
T extends
|
|
20
|
-
T extends
|
|
18
|
+
T extends Vector ? "vector" :
|
|
19
|
+
T extends EntityReference ? "reference" :
|
|
20
|
+
T extends Array<CMSType> ? "array" :
|
|
21
|
+
T extends Record<string, any> ? "map" : never;
|
|
21
22
|
|
|
22
23
|
/**
|
|
23
24
|
* @group Entity properties
|
package/src/util/entities.ts
CHANGED
|
@@ -139,7 +139,7 @@ export function sanitizeData<M extends Record<string, any>>
|
|
|
139
139
|
return result;
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
-
export function getReferenceFrom<M extends Record<string, any>>(entity: Entity<M>): EntityReference
|
|
142
|
+
export function getReferenceFrom<M extends Record<string, any>>(entity: Entity<M>): EntityReference {
|
|
143
143
|
return new EntityReference(entity.id, entity.path);
|
|
144
144
|
}
|
|
145
145
|
|
package/dist/types/appcheck.d.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { FirebaseApp } from "firebase/app";
|
|
2
|
-
/**
|
|
3
|
-
* @group Firebase
|
|
4
|
-
*/
|
|
5
|
-
export interface AppCheck {
|
|
6
|
-
firebaseApp?: FirebaseApp;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* @group Firebase
|
|
10
|
-
*/
|
|
11
|
-
export interface AppCheckOptions {
|
|
12
|
-
providerKey: string;
|
|
13
|
-
useEnterpriseRecaptcha: boolean;
|
|
14
|
-
isTokenAutoRefreshEnabled?: boolean;
|
|
15
|
-
debugToken?: string;
|
|
16
|
-
forceRefresh?: boolean;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* @group Firebase
|
|
20
|
-
*/
|
|
21
|
-
export declare interface AppCheckTokenResult {
|
|
22
|
-
/**
|
|
23
|
-
* The token string in JWT format.
|
|
24
|
-
*/
|
|
25
|
-
readonly token: string;
|
|
26
|
-
}
|
package/src/types/appcheck.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { FirebaseApp } from "firebase/app";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @group Firebase
|
|
5
|
-
*/
|
|
6
|
-
export interface AppCheck {
|
|
7
|
-
firebaseApp?: FirebaseApp;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* @group Firebase
|
|
12
|
-
*/
|
|
13
|
-
export interface AppCheckOptions {
|
|
14
|
-
providerKey: string;
|
|
15
|
-
useEnterpriseRecaptcha: boolean;
|
|
16
|
-
isTokenAutoRefreshEnabled?: boolean;
|
|
17
|
-
debugToken?: string;
|
|
18
|
-
forceRefresh?: boolean;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* @group Firebase
|
|
23
|
-
*/
|
|
24
|
-
export declare interface AppCheckTokenResult {
|
|
25
|
-
/**
|
|
26
|
-
* The token string in JWT format.
|
|
27
|
-
*/
|
|
28
|
-
readonly token: string;
|
|
29
|
-
}
|