@firecms/core 3.4.0-canary.d20cc85 → 3.4.0-canary.e2466ba

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 (64) hide show
  1. package/dist/components/EntityCollectionView/EntityCollectionView.d.ts +3 -2
  2. package/dist/components/EntityCollectionView/EntityCollectionViewActions.d.ts +3 -1
  3. package/dist/components/EntityCollectionView/EntityCollectionViewStartActions.d.ts +3 -1
  4. package/dist/components/common/useDataSourceTableController.d.ts +4 -2
  5. package/dist/components/common/useTableSearchHelper.d.ts +3 -1
  6. package/dist/core/EntityEditView.d.ts +2 -0
  7. package/dist/core/EntityEditViewFormActions.d.ts +1 -1
  8. package/dist/form/EntityForm.d.ts +2 -0
  9. package/dist/form/EntityFormActions.d.ts +2 -0
  10. package/dist/hooks/data/delete.d.ts +1 -1
  11. package/dist/hooks/data/useCollectionFetch.d.ts +1 -1
  12. package/dist/hooks/data/useEntityFetch.d.ts +4 -1
  13. package/dist/index.es.js +663 -451
  14. package/dist/index.es.js.map +1 -1
  15. package/dist/index.umd.js +663 -451
  16. package/dist/index.umd.js.map +1 -1
  17. package/dist/types/collections.d.ts +7 -0
  18. package/dist/types/datasource.d.ts +8 -0
  19. package/dist/types/entity_actions.d.ts +6 -0
  20. package/dist/types/entity_callbacks.d.ts +21 -0
  21. package/dist/types/navigation.d.ts +34 -5
  22. package/dist/types/plugins.d.ts +13 -0
  23. package/dist/types/side_entity_controller.d.ts +3 -2
  24. package/dist/util/navigation_utils.d.ts +84 -2
  25. package/dist/util/parent_references_from_path.d.ts +15 -0
  26. package/dist/util/paths.d.ts +28 -0
  27. package/dist/util/permissions.d.ts +10 -4
  28. package/package.json +3 -3
  29. package/src/components/DeleteEntityDialog.tsx +2 -0
  30. package/src/components/EntityCollectionView/EntityCollectionBoardView.tsx +8 -0
  31. package/src/components/EntityCollectionView/EntityCollectionView.tsx +38 -14
  32. package/src/components/EntityCollectionView/EntityCollectionViewActions.tsx +6 -2
  33. package/src/components/EntityCollectionView/EntityCollectionViewStartActions.tsx +4 -0
  34. package/src/components/EntityCollectionView/useBoardDataController.tsx +7 -2
  35. package/src/components/EntityPreview.tsx +4 -1
  36. package/src/components/ReferenceTable/ReferenceSelectionTable.tsx +8 -2
  37. package/src/components/common/default_entity_actions.tsx +16 -0
  38. package/src/components/common/useDataSourceTableController.tsx +11 -5
  39. package/src/components/common/useTableSearchHelper.ts +5 -0
  40. package/src/core/EntityEditView.tsx +6 -10
  41. package/src/core/EntityEditViewFormActions.tsx +3 -2
  42. package/src/core/EntitySidePanel.tsx +4 -2
  43. package/src/form/EntityForm.tsx +16 -2
  44. package/src/form/EntityFormActions.tsx +2 -0
  45. package/src/hooks/data/delete.ts +8 -2
  46. package/src/hooks/data/save.ts +4 -1
  47. package/src/hooks/data/useCollectionFetch.tsx +9 -2
  48. package/src/hooks/data/useEntityFetch.tsx +15 -3
  49. package/src/hooks/useBuildNavigationController.tsx +23 -8
  50. package/src/hooks/useResolvedNavigationFrom.tsx +1 -1
  51. package/src/internal/useBuildDataSource.ts +13 -12
  52. package/src/preview/components/ReferencePreview.tsx +4 -1
  53. package/src/routes/FireCMSRoute.tsx +9 -4
  54. package/src/types/collections.ts +8 -0
  55. package/src/types/datasource.ts +8 -0
  56. package/src/types/entity_actions.tsx +6 -0
  57. package/src/types/entity_callbacks.ts +24 -0
  58. package/src/types/navigation.ts +35 -5
  59. package/src/types/plugins.tsx +13 -0
  60. package/src/types/side_entity_controller.tsx +3 -2
  61. package/src/util/navigation_utils.ts +197 -2
  62. package/src/util/parent_references_from_path.ts +32 -1
  63. package/src/util/paths.ts +40 -3
  64. package/src/util/permissions.ts +22 -10
@@ -16,8 +16,9 @@ export type EntityCollectionViewProps<M extends Record<string, any>> = {
16
16
  /**
17
17
  * `fullPath` split at its real segment boundaries, e.g. `["nodes", "node/42", "edges"]`.
18
18
  * Forwarded to the datasource so a parent entity id containing "/" stays unambiguous.
19
- * Defaults to splitting `fullPath`, which is correct for any backend whose ids cannot
20
- * contain "/".
19
+ *
20
+ * Optional, and never derived by splitting `fullPath` — a guess would be wrong in
21
+ * exactly the case the field exists for. Absent means "not known here", not "no slashes".
21
22
  */
22
23
  pathSegments?: string[];
23
24
  /**
@@ -3,6 +3,8 @@ import { EntityCollection, EntityTableController, SelectionController } from "..
3
3
  export type EntityCollectionViewActionsProps<M extends Record<string, any>> = {
4
4
  collection: EntityCollection<M>;
5
5
  path: string;
6
+ /** `path` split at its real segment boundaries, when known. Never derived from `path`. */
7
+ pathSegments?: string[];
6
8
  relativePath: string;
7
9
  parentCollectionIds: string[];
8
10
  selectionEnabled: boolean;
@@ -12,4 +14,4 @@ export type EntityCollectionViewActionsProps<M extends Record<string, any>> = {
12
14
  tableController: EntityTableController<M>;
13
15
  collectionEntitiesCount?: number;
14
16
  };
15
- export declare function EntityCollectionViewActions<M extends Record<string, any>>({ collection, relativePath, parentCollectionIds, onNewClick, onMultipleDeleteClick, selectionEnabled, path, selectionController, tableController, collectionEntitiesCount, }: EntityCollectionViewActionsProps<M>): React.JSX.Element;
17
+ export declare function EntityCollectionViewActions<M extends Record<string, any>>({ collection, relativePath, parentCollectionIds, onNewClick, onMultipleDeleteClick, selectionEnabled, path, pathSegments, selectionController, tableController, collectionEntitiesCount, }: EntityCollectionViewActionsProps<M>): React.JSX.Element;
@@ -3,6 +3,8 @@ import { EntityCollection, EntityTableController, ResolvedProperty, SelectionCon
3
3
  export type EntityCollectionViewStartActionsProps<M extends Record<string, any>> = {
4
4
  collection: EntityCollection<M>;
5
5
  path: string;
6
+ /** `path` split at its real segment boundaries, when known. Never derived from `path`. */
7
+ pathSegments?: string[];
6
8
  relativePath: string;
7
9
  parentCollectionIds: string[];
8
10
  selectionController: SelectionController<M>;
@@ -13,4 +15,4 @@ export type EntityCollectionViewStartActionsProps<M extends Record<string, any>>
13
15
  */
14
16
  resolvedProperties?: Record<string, ResolvedProperty>;
15
17
  };
16
- export declare function EntityCollectionViewStartActions<M extends Record<string, any>>({ collection, relativePath, parentCollectionIds, path, selectionController, tableController, collectionEntitiesCount, resolvedProperties }: EntityCollectionViewStartActionsProps<M>): React.JSX.Element;
18
+ export declare function EntityCollectionViewStartActions<M extends Record<string, any>>({ collection, relativePath, parentCollectionIds, path, pathSegments, selectionController, tableController, collectionEntitiesCount, resolvedProperties }: EntityCollectionViewStartActionsProps<M>): React.JSX.Element;
@@ -7,8 +7,10 @@ export type DataSourceTableControllerProps<M extends Record<string, any> = any>
7
7
  fullPath: string;
8
8
  /**
9
9
  * `fullPath` split at its real segment boundaries. Passed through to the datasource so
10
- * a parent entity id containing "/" stays unambiguous. Defaults to splitting
11
- * `fullPath`, which is correct for any backend whose ids cannot contain "/".
10
+ * a parent entity id containing "/" stays unambiguous.
11
+ *
12
+ * Optional, and never derived by splitting `fullPath` — a guess would be wrong in
13
+ * exactly the case the field exists for. Absent means "not known here", not "no slashes".
12
14
  */
13
15
  pathSegments?: string[];
14
16
  /**
@@ -2,6 +2,8 @@ import { EntityCollection } from "../../types";
2
2
  export interface UseTableSearchHelperParams<M extends Record<string, any>> {
3
3
  collection: EntityCollection<M>;
4
4
  fullPath: string;
5
+ /** `fullPath` split at its real segment boundaries, when known. Never derived from it. */
6
+ pathSegments?: string[];
5
7
  parentCollectionIds?: string[];
6
8
  /**
7
9
  * Search term that is already being applied without the user having gone through the
@@ -10,7 +12,7 @@ export interface UseTableSearchHelperParams<M extends Record<string, any>> {
10
12
  */
11
13
  initialSearchString?: string;
12
14
  }
13
- export declare function useTableSearchHelper<M extends Record<string, any>>({ collection, fullPath, parentCollectionIds, initialSearchString }: UseTableSearchHelperParams<M>): {
15
+ export declare function useTableSearchHelper<M extends Record<string, any>>({ collection, fullPath, pathSegments, parentCollectionIds, initialSearchString }: UseTableSearchHelperParams<M>): {
14
16
  textSearchLoading: boolean;
15
17
  textSearchInitialised: boolean;
16
18
  onTextSearchClick: (() => void) | undefined;
@@ -7,6 +7,8 @@ export type OnUpdateParams = {
7
7
  entity: Entity<any>;
8
8
  status: EntityStatus;
9
9
  path: string;
10
+ /** `path` split at its real segment boundaries, when known. Never derived from `path`. */
11
+ pathSegments?: string[];
10
12
  entityId?: string;
11
13
  selectedTab?: string;
12
14
  collection: EntityCollection<any>;
@@ -1,3 +1,3 @@
1
1
  import React from "react";
2
2
  import { EntityFormActionsProps } from "../form/EntityFormActions";
3
- export declare function EntityEditViewFormActions({ collection, path, entity, layout, savingError, formex, disabled, status, pluginActions, openEntityMode, showDefaultActions, navigateBack, formContext }: EntityFormActionsProps): React.JSX.Element;
3
+ export declare function EntityEditViewFormActions({ collection, path, pathSegments, entity, layout, savingError, formex, disabled, status, pluginActions, openEntityMode, showDefaultActions, navigateBack, formContext }: EntityFormActionsProps): React.JSX.Element;
@@ -7,6 +7,8 @@ export type OnUpdateParams = {
7
7
  entity: Entity<any>;
8
8
  status: EntityStatus;
9
9
  path: string;
10
+ /** `path` split at its real segment boundaries, when known. Never derived from `path`. */
11
+ pathSegments?: string[];
10
12
  entityId?: string;
11
13
  selectedTab?: string;
12
14
  collection: EntityCollection<any>;
@@ -6,6 +6,8 @@ export interface EntityFormActionsProps {
6
6
  fullIdPath?: string;
7
7
  collection: ResolvedEntityCollection;
8
8
  path: string;
9
+ /** `path` split at its real segment boundaries, when known. Never derived from `path`. */
10
+ pathSegments?: string[];
9
11
  entity?: Entity;
10
12
  layout: "bottom" | "side";
11
13
  savingError?: Error;
@@ -30,7 +30,7 @@ export type DeleteEntityWithCallbacksProps<M extends Record<string, any>, USER e
30
30
  * @param context
31
31
  * @group Hooks and utilities
32
32
  */
33
- export declare function deleteEntityWithCallbacks<M extends Record<string, any>, USER extends User>({ dataSource, entity, collection, callbacks, onDeleteSuccess, onDeleteFailure, onPreDeleteHookError, onDeleteSuccessHookError, context }: DeleteEntityWithCallbacksProps<M> & {
33
+ export declare function deleteEntityWithCallbacks<M extends Record<string, any>, USER extends User>({ dataSource, entity, pathSegments, collection, callbacks, onDeleteSuccess, onDeleteFailure, onPreDeleteHookError, onDeleteSuccessHookError, context }: DeleteEntityWithCallbacksProps<M> & {
34
34
  collection: ResolvedEntityCollection<M>;
35
35
  dataSource: DataSource;
36
36
  context: FireCMSContext<USER>;
@@ -53,4 +53,4 @@ export interface CollectionFetchResult<M extends Record<string, any>> {
53
53
  * @param searchString
54
54
  * @group Hooks and utilities
55
55
  */
56
- export declare function useCollectionFetch<M extends Record<string, any>, USER extends User>({ path: inputPath, pathSegments, collection, filterValues, sortBy, itemCount, searchString }: CollectionFetchProps<M>): CollectionFetchResult<M>;
56
+ export declare function useCollectionFetch<M extends Record<string, any>, USER extends User>({ path: inputPath, pathSegments: inputPathSegments, collection, filterValues, sortBy, itemCount, searchString }: CollectionFetchProps<M>): CollectionFetchResult<M>;
@@ -6,7 +6,10 @@ export interface EntityFetchProps<M extends Record<string, any>, USER extends Us
6
6
  path: string;
7
7
  /**
8
8
  * `path` split at its real segment boundaries. Forwarded to the datasource so a parent
9
- * entity id containing "/" stays unambiguous. Defaults to splitting the resolved path.
9
+ * entity id containing "/" stays unambiguous.
10
+ *
11
+ * Optional, and never derived by splitting `path` — a guess would be wrong in exactly
12
+ * the case the field exists for. Absent means "not known here", not "no slashes".
10
13
  */
11
14
  pathSegments?: string[];
12
15
  entityId?: string;