@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.
Files changed (67) hide show
  1. package/dist/components/ClearFilterSortButton.d.ts +5 -0
  2. package/dist/components/EntityCollectionTable/EntityCollectionRowActions.d.ts +11 -11
  3. package/dist/components/EntityCollectionTable/EntityCollectionTableProps.d.ts +1 -1
  4. package/dist/components/EntityCollectionTable/internal/CollectionTableToolbar.d.ts +1 -4
  5. package/dist/components/EntityCollectionView/EntityCollectionView.d.ts +11 -1
  6. package/dist/components/EntityCollectionView/EntityCollectionViewStartActions.d.ts +11 -0
  7. package/dist/components/SelectableTable/SelectableTable.d.ts +1 -1
  8. package/dist/components/common/types.d.ts +1 -1
  9. package/dist/form/components/ErrorFocus.d.ts +1 -1
  10. package/dist/hooks/useValidateAuthenticator.d.ts +2 -6
  11. package/dist/index.es.js +3516 -3381
  12. package/dist/index.es.js.map +1 -1
  13. package/dist/index.umd.js +5 -5
  14. package/dist/index.umd.js.map +1 -1
  15. package/dist/internal/useBuildDataSource.d.ts +1 -16
  16. package/dist/types/collections.d.ts +5 -1
  17. package/dist/types/datasource.d.ts +2 -5
  18. package/dist/types/entities.d.ts +5 -1
  19. package/dist/types/index.d.ts +0 -1
  20. package/dist/types/navigation.d.ts +1 -1
  21. package/dist/types/plugins.d.ts +3 -1
  22. package/dist/types/properties.d.ts +2 -2
  23. package/dist/util/entities.d.ts +1 -1
  24. package/dist/util/navigation_utils.d.ts +2 -2
  25. package/dist/util/resolutions.d.ts +5 -5
  26. package/package.json +22 -19
  27. package/src/components/ClearFilterSortButton.tsx +41 -0
  28. package/src/components/EntityCollectionTable/EntityCollectionTable.tsx +10 -11
  29. package/src/components/EntityCollectionTable/EntityCollectionTableProps.tsx +1 -1
  30. package/src/components/EntityCollectionTable/PropertyTableCell.tsx +16 -19
  31. package/src/components/EntityCollectionTable/internal/CollectionTableToolbar.tsx +27 -32
  32. package/src/components/EntityCollectionTable/internal/EntityTableCell.tsx +11 -6
  33. package/src/components/EntityCollectionView/EntityCollectionView.tsx +28 -5
  34. package/src/components/EntityCollectionView/EntityCollectionViewStartActions.tsx +68 -0
  35. package/src/components/EntityView.tsx +1 -1
  36. package/src/components/HomePage/DefaultHomePage.tsx +1 -1
  37. package/src/components/SelectableTable/SelectableTable.tsx +1 -1
  38. package/src/components/SelectableTable/filters/BooleanFilterField.tsx +2 -3
  39. package/src/components/SelectableTable/filters/DateTimeFilterField.tsx +22 -7
  40. package/src/components/SelectableTable/filters/ReferenceFilterField.tsx +24 -5
  41. package/src/components/SelectableTable/filters/StringNumberFilterField.tsx +35 -15
  42. package/src/components/VirtualTable/VirtualTable.tsx +28 -20
  43. package/src/components/common/types.tsx +1 -1
  44. package/src/core/FireCMS.tsx +1 -2
  45. package/src/core/field_configs.tsx +1 -2
  46. package/src/hooks/data/save.ts +1 -0
  47. package/src/hooks/useBuildLocalConfigurationPersistence.tsx +9 -10
  48. package/src/hooks/useBuildModeController.tsx +11 -5
  49. package/src/hooks/useBuildNavigationController.tsx +76 -19
  50. package/src/hooks/useProjectLog.tsx +3 -3
  51. package/src/hooks/useValidateAuthenticator.tsx +2 -22
  52. package/src/internal/useBuildDataSource.ts +42 -47
  53. package/src/internal/useBuildSideEntityController.tsx +16 -13
  54. package/src/preview/PropertyPreview.tsx +2 -12
  55. package/src/types/collections.ts +5 -1
  56. package/src/types/datasource.ts +7 -4
  57. package/src/types/entities.ts +9 -1
  58. package/src/types/index.ts +0 -1
  59. package/src/types/navigation.ts +1 -1
  60. package/src/types/plugins.tsx +4 -3
  61. package/src/types/properties.ts +5 -4
  62. package/src/util/entities.ts +1 -1
  63. package/src/util/navigation_utils.ts +6 -6
  64. package/dist/internal/useLocaleConfig.d.ts +0 -1
  65. package/dist/types/appcheck.d.ts +0 -26
  66. package/src/internal/useLocaleConfig.tsx +0 -18
  67. package/src/types/appcheck.ts +0 -29
@@ -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: (pathOrAlias: string,
59
+ getCollection: (pathOrId: string,
60
60
  entityId?: string,
61
61
  includeUserOverride?: boolean) => EC | undefined;
62
62
  /**
@@ -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,
@@ -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 EntityReference ? "reference" :
19
- T extends Array<CMSType> ? "array" :
20
- T extends Record<string, any> ? "map" : never;
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
@@ -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<M> {
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 pathOrAlias
63
+ * @param pathOrId
64
64
  * @param collections
65
65
  */
66
- export function getCollectionByPathOrId(pathOrAlias: string, collections: EntityCollection[]): EntityCollection | undefined {
66
+ export function getCollectionByPathOrId(pathOrId: string, collections: EntityCollection[]): EntityCollection | undefined {
67
67
 
68
- const subpaths = removeInitialAndTrailingSlashes(pathOrAlias).split("/");
68
+ const subpaths = removeInitialAndTrailingSlashes(pathOrId).split("/");
69
69
  if (subpaths.length % 2 === 0) {
70
- throw Error(`getCollectionByPathOrAlias: Collection paths must have an odd number of segments: ${pathOrAlias}`);
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 === pathOrAlias) {
83
+ if (subpathCombination === pathOrId) {
84
84
  result = navigationEntry;
85
85
  } else if (navigationEntry.subcollections) {
86
- const newPath = pathOrAlias.replace(subpathCombination, "").split("/").slice(2).join("/");
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;
@@ -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
- }
@@ -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
- }