@firecms/core 3.0.0-beta.4.pre.2 → 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 (109) hide show
  1. package/README.md +1 -1
  2. package/dist/components/ClearFilterSortButton.d.ts +5 -0
  3. package/dist/components/EntityCollectionTable/EntityCollectionRowActions.d.ts +11 -11
  4. package/dist/components/EntityCollectionTable/EntityCollectionTableProps.d.ts +1 -1
  5. package/dist/components/EntityCollectionTable/internal/CollectionTableToolbar.d.ts +1 -4
  6. package/dist/components/EntityCollectionView/EntityCollectionView.d.ts +11 -1
  7. package/dist/components/EntityCollectionView/EntityCollectionViewStartActions.d.ts +11 -0
  8. package/dist/components/EntityPreview.d.ts +2 -2
  9. package/dist/components/SelectableTable/SelectableTable.d.ts +1 -1
  10. package/dist/components/common/types.d.ts +1 -1
  11. package/dist/contexts/AuthControllerContext.d.ts +1 -1
  12. package/dist/form/components/ErrorFocus.d.ts +1 -1
  13. package/dist/hooks/data/delete.d.ts +2 -2
  14. package/dist/hooks/data/save.d.ts +1 -1
  15. package/dist/hooks/data/useDataSource.d.ts +1 -1
  16. package/dist/hooks/data/useEntityFetch.d.ts +3 -3
  17. package/dist/hooks/index.d.ts +1 -0
  18. package/dist/hooks/useBuildNavigationController.d.ts +1 -2
  19. package/dist/hooks/useProjectLog.d.ts +2 -2
  20. package/dist/hooks/useValidateAuthenticator.d.ts +21 -0
  21. package/dist/index.es.js +3948 -3737
  22. package/dist/index.es.js.map +1 -1
  23. package/dist/index.umd.js +5 -5
  24. package/dist/index.umd.js.map +1 -1
  25. package/dist/internal/useBuildDataSource.d.ts +1 -16
  26. package/dist/internal/useRestoreScroll.d.ts +1 -1
  27. package/dist/preview/PropertyPreviewProps.d.ts +1 -4
  28. package/dist/types/auth.d.ts +30 -1
  29. package/dist/types/collections.d.ts +8 -4
  30. package/dist/types/datasource.d.ts +3 -6
  31. package/dist/types/entities.d.ts +5 -1
  32. package/dist/types/entity_callbacks.d.ts +2 -2
  33. package/dist/types/index.d.ts +1 -1
  34. package/dist/types/navigation.d.ts +4 -4
  35. package/dist/types/plugins.d.ts +5 -3
  36. package/dist/types/properties.d.ts +2 -2
  37. package/dist/types/roles.d.ts +31 -0
  38. package/dist/types/storage.d.ts +11 -3
  39. package/dist/types/user.d.ts +5 -0
  40. package/dist/util/collections.d.ts +1 -1
  41. package/dist/util/entities.d.ts +1 -1
  42. package/dist/util/navigation_utils.d.ts +2 -2
  43. package/dist/util/resolutions.d.ts +5 -5
  44. package/dist/util/useTraceUpdate.d.ts +1 -0
  45. package/package.json +23 -20
  46. package/src/components/ClearFilterSortButton.tsx +41 -0
  47. package/src/components/EntityCollectionTable/EntityCollectionTable.tsx +10 -11
  48. package/src/components/EntityCollectionTable/EntityCollectionTableProps.tsx +1 -1
  49. package/src/components/EntityCollectionTable/PropertyTableCell.tsx +16 -19
  50. package/src/components/EntityCollectionTable/fields/TableReferenceField.tsx +1 -1
  51. package/src/components/EntityCollectionTable/internal/CollectionTableToolbar.tsx +27 -32
  52. package/src/components/EntityCollectionTable/internal/EntityTableCell.tsx +11 -6
  53. package/src/components/EntityCollectionView/EntityCollectionView.tsx +28 -5
  54. package/src/components/EntityCollectionView/EntityCollectionViewStartActions.tsx +68 -0
  55. package/src/components/EntityPreview.tsx +5 -2
  56. package/src/components/EntityView.tsx +1 -1
  57. package/src/components/HomePage/DefaultHomePage.tsx +2 -2
  58. package/src/components/HomePage/NavigationCard.tsx +1 -1
  59. package/src/components/ReferenceWidget.tsx +1 -1
  60. package/src/components/SelectableTable/SelectableTable.tsx +1 -1
  61. package/src/components/SelectableTable/filters/BooleanFilterField.tsx +2 -3
  62. package/src/components/SelectableTable/filters/DateTimeFilterField.tsx +23 -8
  63. package/src/components/SelectableTable/filters/ReferenceFilterField.tsx +24 -5
  64. package/src/components/SelectableTable/filters/StringNumberFilterField.tsx +35 -15
  65. package/src/components/VirtualTable/VirtualTable.tsx +28 -20
  66. package/src/components/VirtualTable/fields/VirtualTableDateField.tsx +1 -1
  67. package/src/components/common/types.tsx +1 -1
  68. package/src/contexts/AuthControllerContext.tsx +1 -1
  69. package/src/core/FireCMS.tsx +2 -3
  70. package/src/core/field_configs.tsx +1 -2
  71. package/src/form/EntityForm.tsx +1 -1
  72. package/src/form/field_bindings/DateTimeFieldBinding.tsx +1 -1
  73. package/src/hooks/data/delete.ts +3 -3
  74. package/src/hooks/data/save.ts +2 -1
  75. package/src/hooks/data/useDataSource.tsx +1 -1
  76. package/src/hooks/data/useEntityFetch.tsx +3 -3
  77. package/src/hooks/index.tsx +2 -0
  78. package/src/hooks/useBuildLocalConfigurationPersistence.tsx +9 -10
  79. package/src/hooks/useBuildModeController.tsx +11 -5
  80. package/src/hooks/useBuildNavigationController.tsx +136 -59
  81. package/src/hooks/useProjectLog.tsx +8 -6
  82. package/src/hooks/useValidateAuthenticator.tsx +115 -0
  83. package/src/internal/useBuildDataSource.ts +42 -47
  84. package/src/internal/useBuildSideEntityController.tsx +18 -12
  85. package/src/preview/PropertyPreview.tsx +2 -12
  86. package/src/preview/PropertyPreviewProps.tsx +1 -11
  87. package/src/preview/components/BooleanPreview.tsx +4 -2
  88. package/src/preview/components/ReferencePreview.tsx +1 -1
  89. package/src/types/auth.tsx +40 -1
  90. package/src/types/collections.ts +8 -4
  91. package/src/types/datasource.ts +8 -5
  92. package/src/types/entities.ts +9 -1
  93. package/src/types/entity_callbacks.ts +2 -2
  94. package/src/types/index.ts +1 -1
  95. package/src/types/navigation.ts +6 -6
  96. package/src/types/plugins.tsx +6 -5
  97. package/src/types/properties.ts +5 -4
  98. package/src/types/roles.ts +41 -0
  99. package/src/types/storage.ts +12 -3
  100. package/src/types/user.ts +7 -0
  101. package/src/util/collections.ts +1 -1
  102. package/src/util/entities.ts +1 -1
  103. package/src/util/navigation_utils.ts +6 -6
  104. package/src/util/strings.ts +2 -2
  105. package/src/util/useTraceUpdate.tsx +2 -1
  106. package/dist/internal/useLocaleConfig.d.ts +0 -1
  107. package/dist/types/appcheck.d.ts +0 -26
  108. package/src/internal/useLocaleConfig.tsx +0 -18
  109. package/src/types/appcheck.ts +0 -29
package/README.md CHANGED
@@ -49,7 +49,7 @@ FireCMS is based on this great technologies:
49
49
  The easiest way to get going is to check our quickstart guide! You will just
50
50
  need to follow some quick steps:
51
51
 
52
- https://firecms.co/docs/quickstart
52
+ https://firecms.co/docs
53
53
 
54
54
  ### Demo
55
55
 
@@ -0,0 +1,5 @@
1
+ import { EntityTableController } from "../types";
2
+ export declare function ClearFilterSortButton({ tableController, enabled }: {
3
+ enabled: boolean;
4
+ tableController: EntityTableController;
5
+ }): import("react/jsx-runtime").JSX.Element | null;
@@ -15,17 +15,17 @@ import { CollectionSize, Entity, EntityAction, EntityCollection, SelectionContro
15
15
  */
16
16
  export declare const EntityCollectionRowActions: ({ entity, collection, fullPath, width, frozen, isSelected, selectionEnabled, size, highlightEntity, onCollectionChange, unhighlightEntity, actions, hideId, selectionController, }: {
17
17
  entity: Entity<any>;
18
- collection?: EntityCollection<any, import("src/types/user").User> | undefined;
19
- fullPath?: string | undefined;
18
+ collection?: EntityCollection<any>;
19
+ fullPath?: string;
20
20
  width: number;
21
- frozen?: boolean | undefined;
21
+ frozen?: boolean;
22
22
  size: CollectionSize;
23
- isSelected?: boolean | undefined;
24
- selectionEnabled?: boolean | undefined;
25
- actions?: EntityAction[] | undefined;
26
- hideId?: boolean | undefined;
27
- onCollectionChange?: (() => void) | undefined;
28
- selectionController?: SelectionController | undefined;
29
- highlightEntity?: ((entity: Entity<any>) => void) | undefined;
30
- unhighlightEntity?: ((entity: Entity<any>) => void) | undefined;
23
+ isSelected?: boolean;
24
+ selectionEnabled?: boolean;
25
+ actions?: EntityAction[];
26
+ hideId?: boolean;
27
+ onCollectionChange?: () => void;
28
+ selectionController?: SelectionController;
29
+ highlightEntity?: (entity: Entity<any>) => void;
30
+ unhighlightEntity?: (entity: Entity<any>) => void;
31
31
  }) => import("react/jsx-runtime").JSX.Element;
@@ -65,7 +65,7 @@ export type EntityCollectionTableProps<M extends Record<string, any>, UserType e
65
65
  * {@link EntityTableController}
66
66
  */
67
67
  tableController: EntityTableController<M>;
68
- displayedColumnIds: PropertyColumnConfig[];
68
+ displayedColumnIds?: PropertyColumnConfig[];
69
69
  forceFilter?: FilterValues<Extract<keyof M, string>>;
70
70
  textSearchEnabled?: boolean;
71
71
  inlineEditing?: boolean;
@@ -2,17 +2,14 @@ import React from "react";
2
2
  import { CollectionSize } from "../../../types";
3
3
  interface CollectionTableToolbarProps {
4
4
  size: CollectionSize;
5
- filterIsSet: boolean;
6
5
  loading: boolean;
7
- forceFilter?: boolean;
8
6
  actionsStart?: React.ReactNode;
9
7
  actions?: React.ReactNode;
10
8
  title?: React.ReactNode;
11
9
  onTextSearchClick?: () => void;
12
10
  onTextSearch?: (searchString?: string) => void;
13
11
  onSizeChanged: (size: CollectionSize) => void;
14
- clearFilter?: () => void;
15
12
  textSearchLoading?: boolean;
16
13
  }
17
- export declare function CollectionTableToolbar(props: CollectionTableToolbarProps): import("react/jsx-runtime").JSX.Element;
14
+ export declare function CollectionTableToolbar({ actions, actionsStart, loading, onSizeChanged, onTextSearch, onTextSearchClick, size, textSearchLoading, title }: CollectionTableToolbarProps): import("react/jsx-runtime").JSX.Element;
18
15
  export {};
@@ -4,8 +4,18 @@ import { EntityCollection } from "../../types";
4
4
  * @group Components
5
5
  */
6
6
  export type EntityCollectionViewProps<M extends Record<string, any>> = {
7
- fullPath: string;
7
+ /**
8
+ * Complete path where this collection is located.
9
+ * It defaults to the collection path if not provided.
10
+ */
11
+ fullPath?: string;
12
+ /**
13
+ * If this is a subcollection, specify the parent collection ids.
14
+ */
8
15
  parentCollectionIds?: string[];
16
+ /**
17
+ * Whether this is a subcollection or not.
18
+ */
9
19
  isSubCollection?: boolean;
10
20
  className?: string;
11
21
  } & EntityCollection<M>;
@@ -0,0 +1,11 @@
1
+ import { EntityCollection, EntityTableController, SelectionController } from "../../types";
2
+ export type EntityCollectionViewStartActionsProps<M extends Record<string, any>> = {
3
+ collection: EntityCollection<M>;
4
+ path: string;
5
+ relativePath: string;
6
+ parentCollectionIds: string[];
7
+ selectionController: SelectionController<M>;
8
+ tableController: EntityTableController<M>;
9
+ collectionEntitiesCount: number;
10
+ };
11
+ export declare function EntityCollectionViewStartActions<M extends Record<string, any>>({ collection, relativePath, parentCollectionIds, path, selectionController, tableController, collectionEntitiesCount }: EntityCollectionViewStartActionsProps<M>): import("react/jsx-runtime").JSX.Element;
@@ -17,13 +17,13 @@ export type EntityPreviewProps = {
17
17
  * It is used by default in reference fields and whenever a reference is displayed.
18
18
  */
19
19
  export declare function EntityPreview({ actions, disabled, hover, collection: collectionProp, previewProperties, onClick, size, includeEntityNavigation, entity }: EntityPreviewProps): import("react/jsx-runtime").JSX.Element;
20
- type EntityPreviewContainerProps = {
20
+ export type EntityPreviewContainerProps = {
21
21
  children: React.ReactNode;
22
22
  hover?: boolean;
23
+ fullwidth?: boolean;
23
24
  size: PreviewSize;
24
25
  className?: string;
25
26
  style?: React.CSSProperties;
26
27
  onClick?: (e: React.SyntheticEvent) => void;
27
28
  };
28
29
  export declare const EntityPreviewContainer: React.FC<EntityPreviewContainerProps>;
29
- export {};
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import { CollectionSize, Entity, EntityTableController, FilterValues } from "../../types";
3
3
  import { CellRendererParams, VirtualTableColumn } from "../VirtualTable";
4
- import { OnCellValueChange, OnColumnResizeParams } from "../common/types";
4
+ import { OnCellValueChange, OnColumnResizeParams } from "../common";
5
5
  export type SelectableTableProps<M extends Record<string, any>> = {
6
6
  /**
7
7
  * Callback when a cell value changes.
@@ -33,7 +33,7 @@ export interface OnCellValueChangeParams<T = any, M extends Record<string, any>
33
33
  propertyKey: string;
34
34
  entity: Entity<M>;
35
35
  onValueUpdated: () => void;
36
- setError: (e: Error) => void;
36
+ setError: (e: Error | undefined) => void;
37
37
  fullPath: string;
38
38
  context: FireCMSContext;
39
39
  }
@@ -1,3 +1,3 @@
1
1
  import React from "react";
2
2
  import { AuthController } from "../types";
3
- export declare const AuthControllerContext: React.Context<AuthController>;
3
+ export declare const AuthControllerContext: React.Context<AuthController<any, any>>;
@@ -1,4 +1,4 @@
1
1
  import React from "react";
2
2
  export declare const ErrorFocus: ({ containerRef }: {
3
- containerRef?: React.RefObject<HTMLDivElement> | undefined;
3
+ containerRef?: React.RefObject<HTMLDivElement>;
4
4
  }) => null;
@@ -2,8 +2,8 @@ import { DataSource, DeleteEntityProps, Entity, EntityCallbacks, FireCMSContext,
2
2
  /**
3
3
  * @group Hooks and utilities
4
4
  */
5
- export type DeleteEntityWithCallbacksProps<M extends Record<string, any>> = DeleteEntityProps<M> & {
6
- callbacks?: EntityCallbacks<M>;
5
+ export type DeleteEntityWithCallbacksProps<M extends Record<string, any>, UserType extends User = User> = DeleteEntityProps<M> & {
6
+ callbacks?: EntityCallbacks<M, UserType>;
7
7
  onDeleteSuccess?: (entity: Entity<M>) => void;
8
8
  onDeleteFailure?: (entity: Entity<M>, e: Error) => void;
9
9
  onPreDeleteHookError?: (entity: Entity<M>, e: Error) => void;
@@ -36,7 +36,7 @@ export type SaveEntityWithCallbacksProps<M extends Record<string, any>> = SaveEn
36
36
  * @group Hooks and utilities
37
37
  */
38
38
  export declare function saveEntityWithCallbacks<M extends Record<string, any>, UserType extends User>({ collection, path, entityId, values, previousValues, status, dataSource, context, onSaveSuccess, onSaveFailure, onPreSaveHookError, onSaveSuccessHookError }: SaveEntityWithCallbacksProps<M> & {
39
- collection: EntityCollection<M>;
39
+ collection: EntityCollection<M, UserType>;
40
40
  dataSource: DataSource;
41
41
  context: FireCMSContext<UserType>;
42
42
  }): Promise<void>;
@@ -3,4 +3,4 @@ import { DataSource, EntityCollection } from "../../types";
3
3
  * Use this hook to get the datasource being used
4
4
  * @group Hooks and utilities
5
5
  */
6
- export declare const useDataSource: (collection?: EntityCollection) => DataSource;
6
+ export declare const useDataSource: (collection?: EntityCollection<any, any>) => DataSource;
@@ -2,10 +2,10 @@ import { Entity, EntityCollection, User } from "../../types";
2
2
  /**
3
3
  * @group Hooks and utilities
4
4
  */
5
- export interface EntityFetchProps<M extends Record<string, any>> {
5
+ export interface EntityFetchProps<M extends Record<string, any>, UserType extends User = User> {
6
6
  path: string;
7
7
  entityId?: string;
8
- collection: EntityCollection<M>;
8
+ collection: EntityCollection<M, UserType>;
9
9
  useCache?: boolean;
10
10
  }
11
11
  /**
@@ -25,4 +25,4 @@ export interface EntityFetchResult<M extends Record<string, any>> {
25
25
  * @param useCache
26
26
  * @group Hooks and utilities
27
27
  */
28
- export declare function useEntityFetch<M extends Record<string, any>, UserType extends User>({ path: inputPath, entityId, collection, useCache }: EntityFetchProps<M>): EntityFetchResult<M>;
28
+ export declare function useEntityFetch<M extends Record<string, any>, UserType extends User>({ path: inputPath, entityId, collection, useCache }: EntityFetchProps<M, UserType>): EntityFetchResult<M>;
@@ -20,3 +20,4 @@ export * from "./useCustomizationController";
20
20
  export * from "./useBuildNavigationController";
21
21
  export * from "./useBuildLocalConfigurationPersistence";
22
22
  export * from "./useBuildModeController";
23
+ export * from "./useValidateAuthenticator";
@@ -1,5 +1,5 @@
1
1
  import { AuthController, CMSView, CMSViewsBuilder, DataSourceDelegate, EntityCollection, EntityCollectionsBuilder, NavigationController, PermissionsBuilder, User, UserConfigurationPersistence } from "../types";
2
- type BuildNavigationContextProps<EC extends EntityCollection, UserType extends User> = {
2
+ export type BuildNavigationContextProps<EC extends EntityCollection, UserType extends User> = {
3
3
  basePath?: string;
4
4
  baseCollectionPath?: string;
5
5
  authController: AuthController<UserType>;
@@ -21,4 +21,3 @@ type BuildNavigationContextProps<EC extends EntityCollection, UserType extends U
21
21
  };
22
22
  export declare function useBuildNavigationController<EC extends EntityCollection, UserType extends User>(props: BuildNavigationContextProps<EC, UserType>): NavigationController;
23
23
  export declare function getSidePanelKey(path: string, entityId?: string): string;
24
- export {};
@@ -1,8 +1,8 @@
1
- import { AuthController } from "../types";
1
+ import { AuthController, FireCMSPlugin } from "../types";
2
2
  export declare const DEFAULT_SERVER_DEV = "https://api-kdoe6pj3qq-ey.a.run.app";
3
3
  export declare const DEFAULT_SERVER = "https://api-drplyi3b6q-ey.a.run.app";
4
4
  export type AccessResponse = {
5
5
  blocked?: boolean;
6
6
  message?: string;
7
7
  };
8
- export declare function useProjectLog(authController: AuthController): AccessResponse | null;
8
+ export declare function useProjectLog(authController: AuthController, plugins?: FireCMSPlugin<any, any, any>[]): AccessResponse | null;
@@ -0,0 +1,21 @@
1
+ import { AuthController, Authenticator, DataSourceDelegate, StorageSource, User } from "../index";
2
+ /**
3
+ * This hook is used internally for validating an authenticator.
4
+ *
5
+ * @param authController
6
+ * @param authentication
7
+ * @param storageSource
8
+ * @param dataSourceDelegate
9
+ */
10
+ export declare function useValidateAuthenticator<UserType extends User = User, Controller extends AuthController<UserType> = AuthController<UserType>>({ disabled, authController, authenticator, storageSource, dataSourceDelegate }: {
11
+ disabled?: boolean;
12
+ authController: Controller;
13
+ authenticator?: boolean | Authenticator<UserType, Controller>;
14
+ dataSourceDelegate: DataSourceDelegate;
15
+ storageSource: StorageSource;
16
+ }): {
17
+ canAccessMainView: boolean;
18
+ authLoading: boolean;
19
+ notAllowedError: any;
20
+ authVerified: boolean;
21
+ };