@firecms/core 3.0.0-beta.5 → 3.0.0-beta.6
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/ClearFilterSortButton.d.ts +5 -0
- package/dist/components/EntityCollectionTable/EntityCollectionRowActions.d.ts +11 -11
- package/dist/components/EntityCollectionTable/EntityCollectionTableProps.d.ts +1 -1
- package/dist/components/EntityCollectionTable/internal/CollectionTableToolbar.d.ts +1 -4
- package/dist/components/EntityCollectionView/EntityCollectionView.d.ts +11 -1
- package/dist/components/EntityCollectionView/EntityCollectionViewStartActions.d.ts +11 -0
- package/dist/components/SelectableTable/SelectableTable.d.ts +1 -1
- package/dist/components/common/types.d.ts +1 -1
- package/dist/form/components/ErrorFocus.d.ts +1 -1
- package/dist/hooks/useValidateAuthenticator.d.ts +2 -6
- package/dist/index.es.js +3516 -3381
- 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/collections.d.ts +5 -1
- 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/navigation.d.ts +1 -1
- package/dist/types/plugins.d.ts +3 -1
- package/dist/types/properties.d.ts +2 -2
- package/dist/util/entities.d.ts +1 -1
- package/dist/util/navigation_utils.d.ts +2 -2
- package/dist/util/resolutions.d.ts +5 -5
- package/package.json +22 -19
- package/src/components/ClearFilterSortButton.tsx +41 -0
- package/src/components/EntityCollectionTable/EntityCollectionTable.tsx +10 -11
- package/src/components/EntityCollectionTable/EntityCollectionTableProps.tsx +1 -1
- package/src/components/EntityCollectionTable/PropertyTableCell.tsx +16 -19
- package/src/components/EntityCollectionTable/internal/CollectionTableToolbar.tsx +27 -32
- package/src/components/EntityCollectionTable/internal/EntityTableCell.tsx +11 -6
- package/src/components/EntityCollectionView/EntityCollectionView.tsx +28 -5
- package/src/components/EntityCollectionView/EntityCollectionViewStartActions.tsx +68 -0
- package/src/components/EntityView.tsx +1 -1
- package/src/components/HomePage/DefaultHomePage.tsx +1 -1
- package/src/components/SelectableTable/SelectableTable.tsx +1 -1
- package/src/components/SelectableTable/filters/BooleanFilterField.tsx +2 -3
- package/src/components/SelectableTable/filters/DateTimeFilterField.tsx +22 -7
- package/src/components/SelectableTable/filters/ReferenceFilterField.tsx +24 -5
- package/src/components/SelectableTable/filters/StringNumberFilterField.tsx +35 -15
- package/src/components/VirtualTable/VirtualTable.tsx +28 -20
- package/src/components/common/types.tsx +1 -1
- package/src/core/FireCMS.tsx +1 -2
- package/src/core/field_configs.tsx +1 -2
- package/src/hooks/data/save.ts +1 -0
- package/src/hooks/useBuildLocalConfigurationPersistence.tsx +9 -10
- package/src/hooks/useBuildModeController.tsx +11 -5
- package/src/hooks/useBuildNavigationController.tsx +76 -19
- package/src/hooks/useProjectLog.tsx +3 -3
- package/src/hooks/useValidateAuthenticator.tsx +2 -22
- package/src/internal/useBuildDataSource.ts +42 -47
- package/src/internal/useBuildSideEntityController.tsx +16 -13
- package/src/preview/PropertyPreview.tsx +2 -12
- package/src/types/collections.ts +5 -1
- package/src/types/datasource.ts +7 -4
- package/src/types/entities.ts +9 -1
- package/src/types/index.ts +0 -1
- package/src/types/navigation.ts +1 -1
- package/src/types/plugins.tsx +4 -3
- package/src/types/properties.ts +5 -4
- package/src/util/entities.ts +1 -1
- package/src/util/navigation_utils.ts +6 -6
- package/dist/internal/useLocaleConfig.d.ts +0 -1
- package/dist/types/appcheck.d.ts +0 -26
- package/src/internal/useLocaleConfig.tsx +0 -18
- package/src/types/appcheck.ts +0 -29
package/src/types/navigation.ts
CHANGED
|
@@ -56,7 +56,7 @@ export type NavigationController<EC extends EntityCollection = EntityCollection<
|
|
|
56
56
|
* Get the collection configuration for a given path.
|
|
57
57
|
* The collection is resolved from the given path or alias.
|
|
58
58
|
*/
|
|
59
|
-
getCollection: (
|
|
59
|
+
getCollection: (pathOrId: string,
|
|
60
60
|
entityId?: string,
|
|
61
61
|
includeUserOverride?: boolean) => EC | undefined;
|
|
62
62
|
/**
|
package/src/types/plugins.tsx
CHANGED
|
@@ -7,14 +7,13 @@ import { FieldProps, FormContext } from "./fields";
|
|
|
7
7
|
import { CMSType, Property } from "./properties";
|
|
8
8
|
import { EntityStatus } from "./entities";
|
|
9
9
|
import { ResolvedProperty } from "./resolved_entities";
|
|
10
|
-
import { CMSView } from "./navigation";
|
|
11
10
|
|
|
12
11
|
/**
|
|
13
12
|
* Interface used to define plugins for FireCMS.
|
|
14
13
|
* NOTE: This is a work in progress and the API is not stable yet.
|
|
15
14
|
* @group Core
|
|
16
15
|
*/
|
|
17
|
-
export type FireCMSPlugin<PROPS = any, FORM_PROPS = any, EC extends EntityCollection = EntityCollection, COL_ACTIONS_PROPS = any> = {
|
|
16
|
+
export type FireCMSPlugin<PROPS = any, FORM_PROPS = any, EC extends EntityCollection = EntityCollection, COL_ACTIONS_PROPS = any, COL_ACTIONS_START__PROPS = any> = {
|
|
18
17
|
|
|
19
18
|
/**
|
|
20
19
|
* Key of the plugin. This is used to identify the plugin in the CMS.
|
|
@@ -94,9 +93,11 @@ export type FireCMSPlugin<PROPS = any, FORM_PROPS = any, EC extends EntityCollec
|
|
|
94
93
|
* toolbar.
|
|
95
94
|
*/
|
|
96
95
|
CollectionActions?: React.ComponentType<CollectionActionsProps<any, any, EC> & COL_ACTIONS_PROPS> | React.ComponentType<CollectionActionsProps<any, any, EC> & COL_ACTIONS_PROPS>[];
|
|
97
|
-
|
|
98
96
|
collectionActionsProps?: COL_ACTIONS_PROPS;
|
|
99
97
|
|
|
98
|
+
CollectionActionsStart?: React.ComponentType<CollectionActionsProps<any, any, EC> & COL_ACTIONS_START__PROPS> | React.ComponentType<CollectionActionsProps<any, any, EC> & COL_ACTIONS_START__PROPS>[];
|
|
99
|
+
collectionActionsStartProps?: COL_ACTIONS_START__PROPS;
|
|
100
|
+
|
|
100
101
|
showTextSearchBar?: (props: {
|
|
101
102
|
context: FireCMSContext,
|
|
102
103
|
path: string,
|
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
|
|
|
@@ -60,14 +60,14 @@ export function resolveCollectionPathIds(path: string, allCollections: EntityCol
|
|
|
60
60
|
/**
|
|
61
61
|
* Find the corresponding view at any depth for a given path.
|
|
62
62
|
* Note that path or segments of the paths can be collection aliases.
|
|
63
|
-
* @param
|
|
63
|
+
* @param pathOrId
|
|
64
64
|
* @param collections
|
|
65
65
|
*/
|
|
66
|
-
export function getCollectionByPathOrId(
|
|
66
|
+
export function getCollectionByPathOrId(pathOrId: string, collections: EntityCollection[]): EntityCollection | undefined {
|
|
67
67
|
|
|
68
|
-
const subpaths = removeInitialAndTrailingSlashes(
|
|
68
|
+
const subpaths = removeInitialAndTrailingSlashes(pathOrId).split("/");
|
|
69
69
|
if (subpaths.length % 2 === 0) {
|
|
70
|
-
throw Error(`
|
|
70
|
+
throw Error(`getCollectionByPathOrId: Collection paths must have an odd number of segments: ${pathOrId}`);
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
const subpathCombinations = getCollectionPathsCombinations(subpaths);
|
|
@@ -80,10 +80,10 @@ export function getCollectionByPathOrId(pathOrAlias: string, collections: Entity
|
|
|
80
80
|
|
|
81
81
|
if (navigationEntry) {
|
|
82
82
|
|
|
83
|
-
if (subpathCombination ===
|
|
83
|
+
if (subpathCombination === pathOrId) {
|
|
84
84
|
result = navigationEntry;
|
|
85
85
|
} else if (navigationEntry.subcollections) {
|
|
86
|
-
const newPath =
|
|
86
|
+
const newPath = pathOrId.replace(subpathCombination, "").split("/").slice(2).join("/");
|
|
87
87
|
if (newPath.length > 0)
|
|
88
88
|
result = getCollectionByPathOrId(newPath, navigationEntry.subcollections);
|
|
89
89
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function useLocaleConfig(locale?: string): void;
|
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
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import * as locales from "date-fns/locale";
|
|
2
|
-
// @ts-ignore
|
|
3
|
-
import { registerLocale, setDefaultLocale } from "react-datepicker";
|
|
4
|
-
import { useEffect } from "react";
|
|
5
|
-
|
|
6
|
-
export function useLocaleConfig(locale?: string) {
|
|
7
|
-
useEffect(() => {
|
|
8
|
-
if (!locale) {
|
|
9
|
-
return;
|
|
10
|
-
}
|
|
11
|
-
// @ts-ignore
|
|
12
|
-
const dateFnsLocale = locales[locale];
|
|
13
|
-
if (dateFnsLocale) {
|
|
14
|
-
registerLocale(locale, dateFnsLocale);
|
|
15
|
-
setDefaultLocale(locale);
|
|
16
|
-
}
|
|
17
|
-
}, [locale])
|
|
18
|
-
}
|
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
|
-
}
|