@firecms/core 3.3.0 → 3.4.0-canary.63041d0
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/app/useApp.d.ts +1 -0
- package/dist/components/EntityCollectionTable/column_utils.d.ts +4 -3
- package/dist/components/EntityCollectionTable/internal/CollectionTableToolbar.d.ts +6 -1
- package/dist/components/EntityCollectionView/EntityCollectionView.d.ts +7 -0
- package/dist/components/EntityCollectionView/FiltersDialog.d.ts +2 -1
- package/dist/components/EntityPreview.d.ts +3 -1
- package/dist/components/SelectableTable/filters/filter_text_input.d.ts +30 -0
- package/dist/components/SelectableTable/filters/filter_text_input.test.d.ts +1 -0
- package/dist/components/common/table_url_params.d.ts +24 -0
- package/dist/components/common/useDataSourceTableController.d.ts +7 -1
- package/dist/components/common/useTableSearchHelper.d.ts +7 -1
- package/dist/core/DefaultDrawer.d.ts +10 -3
- package/dist/core/EntityEditView.d.ts +7 -1
- package/dist/core/field_configs.d.ts +1 -1
- package/dist/form/field_bindings/GeopointFieldBinding.d.ts +5 -0
- package/dist/form/index.d.ts +1 -0
- package/dist/hooks/data/save.d.ts +1 -1
- package/dist/hooks/data/useEntityFetch.d.ts +6 -1
- package/dist/index.es.js +2790 -1270
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +2788 -1268
- package/dist/index.umd.js.map +1 -1
- package/dist/locales/pl.d.ts +2 -0
- package/dist/preview/index.d.ts +1 -0
- package/dist/preview/property_previews/GeopointPropertyPreview.d.ts +4 -0
- package/dist/types/collections.d.ts +24 -0
- package/dist/types/datasource.d.ts +42 -0
- package/dist/types/properties.d.ts +17 -1
- package/dist/types/side_entity_controller.d.ts +6 -0
- package/dist/types/translations.d.ts +6 -0
- package/dist/util/__tests__/collections.test.d.ts +1 -0
- package/dist/util/__tests__/urls.test.d.ts +1 -0
- package/dist/util/collections.d.ts +1 -1
- package/dist/util/entities.d.ts +1 -0
- package/dist/util/geopoint.d.ts +22 -0
- package/dist/util/index.d.ts +2 -0
- package/dist/util/navigation_blocking.d.ts +22 -0
- package/dist/util/navigation_from_path.d.ts +17 -0
- package/dist/util/navigation_utils.d.ts +23 -1
- package/dist/util/urls.d.ts +22 -0
- package/package.json +16 -9
- package/src/app/Scaffold.tsx +34 -44
- package/src/app/useApp.tsx +1 -0
- package/src/components/EntityCollectionTable/EntityCollectionTable.tsx +3 -1
- package/src/components/EntityCollectionTable/column_utils.tsx +11 -19
- package/src/components/EntityCollectionTable/fields/TableReferenceField.tsx +1 -1
- package/src/components/EntityCollectionTable/internal/CollectionTableToolbar.tsx +7 -0
- package/src/components/EntityCollectionView/EntityCollectionView.tsx +19 -1
- package/src/components/EntityCollectionView/EntityCollectionViewStartActions.tsx +4 -1
- package/src/components/EntityCollectionView/FiltersDialog.tsx +39 -28
- package/src/components/EntityPreview.tsx +41 -40
- package/src/components/ReferenceWidget.tsx +1 -1
- package/src/components/SelectableTable/filters/ReferenceFilterField.tsx +2 -2
- package/src/components/SelectableTable/filters/StringNumberFilterField.tsx +33 -7
- package/src/components/SelectableTable/filters/filter_text_input.test.ts +184 -0
- package/src/components/SelectableTable/filters/filter_text_input.ts +71 -0
- package/src/components/VirtualTable/VirtualTable.tsx +19 -8
- package/src/components/common/table_url_params.ts +172 -0
- package/src/components/common/useDataSourceTableController.tsx +98 -159
- package/src/components/common/useTableSearchHelper.ts +21 -2
- package/src/contexts/SnackbarProvider.tsx +14 -1
- package/src/core/DefaultDrawer.tsx +150 -64
- package/src/core/DrawerNavigationGroup.tsx +27 -29
- package/src/core/DrawerNavigationItem.tsx +10 -12
- package/src/core/EntityEditView.tsx +75 -32
- package/src/core/EntitySidePanel.tsx +2 -0
- package/src/core/field_configs.tsx +15 -0
- package/src/form/EntityForm.tsx +1 -1
- package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +1 -1
- package/src/form/field_bindings/GeopointFieldBinding.tsx +139 -0
- package/src/form/index.tsx +1 -0
- package/src/hooks/data/save.ts +2 -0
- package/src/hooks/data/useEntityFetch.tsx +9 -0
- package/src/hooks/useValidateAuthenticator.tsx +4 -0
- package/src/i18n/FireCMSi18nProvider.tsx +2 -0
- package/src/internal/useBuildDataSource.ts +11 -0
- package/src/internal/useBuildSideEntityController.tsx +8 -1
- package/src/locales/de.ts +7 -2
- package/src/locales/en.ts +7 -2
- package/src/locales/es.ts +7 -2
- package/src/locales/fr.ts +7 -2
- package/src/locales/hi.ts +7 -2
- package/src/locales/it.ts +7 -2
- package/src/locales/pl.ts +735 -0
- package/src/locales/pt.ts +7 -2
- package/src/preview/PropertyPreview.tsx +12 -0
- package/src/preview/components/StorageThumbnail.tsx +24 -2
- package/src/preview/index.ts +1 -0
- package/src/preview/property_previews/GeopointPropertyPreview.tsx +23 -0
- package/src/routes/FireCMSRoute.tsx +47 -25
- package/src/types/collections.ts +26 -0
- package/src/types/datasource.ts +42 -0
- package/src/types/properties.ts +17 -0
- package/src/types/side_entity_controller.tsx +6 -0
- package/src/types/translations.ts +6 -0
- package/src/util/__tests__/collections.test.ts +32 -0
- package/src/util/__tests__/urls.test.ts +131 -0
- package/src/util/collections.ts +1 -1
- package/src/util/entities.ts +13 -0
- package/src/util/geopoint.ts +81 -0
- package/src/util/index.ts +2 -0
- package/src/util/navigation_blocking.ts +45 -0
- package/src/util/navigation_from_path.ts +41 -6
- package/src/util/navigation_utils.ts +40 -2
- package/src/util/parent_references_from_path.ts +4 -2
- package/src/util/previews.ts +8 -1
- package/src/util/resolutions.ts +8 -0
- package/src/util/urls.ts +52 -0
package/dist/app/useApp.d.ts
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { ResolvedProperties, ResolvedProperty } from "../../types";
|
|
3
3
|
import { VirtualTableColumn } from "../VirtualTable";
|
|
4
4
|
export declare function buildIdColumn(largeLayout?: boolean): VirtualTableColumn;
|
|
5
5
|
export interface PropertiesToColumnsParams<M extends Record<string, any>> {
|
|
6
6
|
properties: ResolvedProperties<M>;
|
|
7
7
|
sortable?: boolean;
|
|
8
|
-
|
|
8
|
+
forcedFilters?: (keyof M)[];
|
|
9
|
+
allowedFilters?: (keyof M)[];
|
|
9
10
|
AdditionalHeaderWidget?: React.ComponentType<{
|
|
10
11
|
property: ResolvedProperty;
|
|
11
12
|
propertyKey: string;
|
|
12
13
|
onHover: boolean;
|
|
13
14
|
}>;
|
|
14
15
|
}
|
|
15
|
-
export declare function propertiesToColumns<M extends Record<string, any>>({ properties, sortable,
|
|
16
|
+
export declare function propertiesToColumns<M extends Record<string, any>>({ properties, sortable, forcedFilters, AdditionalHeaderWidget, allowedFilters }: PropertiesToColumnsParams<M>): VirtualTableColumn[];
|
|
@@ -11,6 +11,11 @@ interface CollectionTableToolbarProps {
|
|
|
11
11
|
onTextSearchClick?: () => void;
|
|
12
12
|
onTextSearch?: (searchString?: string) => void;
|
|
13
13
|
textSearchLoading?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Search term the search bar should start with, typically the one restored from the
|
|
16
|
+
* URL query params by the table controller.
|
|
17
|
+
*/
|
|
18
|
+
initialSearchString?: string;
|
|
14
19
|
}
|
|
15
|
-
export declare function CollectionTableToolbar({ actions, actionsStart, loading, onTextSearch, onTextSearchClick, textSearchLoading, title, viewModeToggle }: CollectionTableToolbarProps): React.JSX.Element;
|
|
20
|
+
export declare function CollectionTableToolbar({ actions, actionsStart, loading, onTextSearch, onTextSearchClick, textSearchLoading, initialSearchString, title, viewModeToggle }: CollectionTableToolbarProps): React.JSX.Element;
|
|
16
21
|
export {};
|
|
@@ -13,6 +13,13 @@ export type EntityCollectionViewProps<M extends Record<string, any>> = {
|
|
|
13
13
|
* Full path using navigation ids.
|
|
14
14
|
*/
|
|
15
15
|
fullIdPath?: string;
|
|
16
|
+
/**
|
|
17
|
+
* `fullPath` split at its real segment boundaries, e.g. `["nodes", "node/42", "edges"]`.
|
|
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 "/".
|
|
21
|
+
*/
|
|
22
|
+
pathSegments?: string[];
|
|
16
23
|
/**
|
|
17
24
|
* If this is a subcollection, specify the parent collection ids.
|
|
18
25
|
*/
|
|
@@ -7,9 +7,10 @@ export interface FiltersDialogProps {
|
|
|
7
7
|
filterValues: FilterValues<any> | undefined;
|
|
8
8
|
setFilterValues: (filterValues?: FilterValues<any>) => void;
|
|
9
9
|
forceFilter?: FilterValues<any>;
|
|
10
|
+
allowedFilters?: string[];
|
|
10
11
|
}
|
|
11
12
|
/**
|
|
12
13
|
* Dialog that displays all filterable properties from a collection
|
|
13
14
|
* and allows setting filter values for each.
|
|
14
15
|
*/
|
|
15
|
-
export declare function FiltersDialog({ open, onOpenChange, properties, filterValues, setFilterValues, forceFilter }: FiltersDialogProps): React.JSX.Element;
|
|
16
|
+
export declare function FiltersDialog({ open, onOpenChange, properties, filterValues, setFilterValues, forceFilter, allowedFilters }: FiltersDialogProps): React.JSX.Element;
|
|
@@ -29,4 +29,6 @@ export type EntityPreviewContainerProps = {
|
|
|
29
29
|
style?: React.CSSProperties;
|
|
30
30
|
onClick?: (e: React.SyntheticEvent) => void;
|
|
31
31
|
};
|
|
32
|
-
export declare
|
|
32
|
+
export declare function EntityPreviewContainer({ children, hover, onClick, size, style, className, fullwidth, ref }: EntityPreviewContainerProps & {
|
|
33
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
34
|
+
}): React.JSX.Element;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export type FilterTextInputParseResult = {
|
|
2
|
+
/**
|
|
3
|
+
* Whether the filter value should be updated with `value`.
|
|
4
|
+
* It is `false` for intermediate inputs that are not a valid value yet,
|
|
5
|
+
* like "-" or "0.", so that the text typed by the user can be kept as it is
|
|
6
|
+
* while the current filter value is left untouched.
|
|
7
|
+
*/
|
|
8
|
+
updateValue: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Parsed value, only relevant when `updateValue` is `true`.
|
|
11
|
+
* `undefined` means the filter should be cleared.
|
|
12
|
+
*/
|
|
13
|
+
value?: string | number;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Turn the raw text of a filter input into the value used by the filter.
|
|
17
|
+
*
|
|
18
|
+
* The text shown to the user is never derived back from the parsed value, so
|
|
19
|
+
* intermediate states like "0.", ".0" or "-" survive while typing. Numbers are
|
|
20
|
+
* only committed to the filter once the text is a complete number, which makes
|
|
21
|
+
* values such as 0.01 reachable by typing them character by character.
|
|
22
|
+
*
|
|
23
|
+
* Note that `0` is a perfectly valid filter value, only an empty input clears
|
|
24
|
+
* the filter.
|
|
25
|
+
*/
|
|
26
|
+
export declare function parseFilterTextInput(text: string, dataType: "string" | "number"): FilterTextInputParseResult;
|
|
27
|
+
/**
|
|
28
|
+
* Text a filter input should display for a given filter value.
|
|
29
|
+
*/
|
|
30
|
+
export declare function filterValueToText(value: unknown): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { FilterValues } from "../../types";
|
|
2
|
+
/**
|
|
3
|
+
* Internal helpers used by `useDataSourceTableController` to persist the state of a
|
|
4
|
+
* collection table (filters, sort and text search) in the URL query string.
|
|
5
|
+
*
|
|
6
|
+
* These functions are intentionally NOT re-exported by the package barrel files:
|
|
7
|
+
* they are pure and live in their own module only so that they can be unit tested.
|
|
8
|
+
* `encodeFilterAndSort` and `parseFilterAndSort` must stay exact inverses of each
|
|
9
|
+
* other, otherwise state written to the URL is silently dropped on reload.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Serialise the state of a collection table into a URL query string,
|
|
13
|
+
* without the leading `?`. Returns an empty string when there is no state to persist.
|
|
14
|
+
*/
|
|
15
|
+
export declare function encodeFilterAndSort(filterValues?: FilterValues<string>, sortBy?: [string, "asc" | "desc"] | undefined, searchString?: string): string;
|
|
16
|
+
/**
|
|
17
|
+
* Restore the state of a collection table from a URL query string.
|
|
18
|
+
* The inverse of {@link encodeFilterAndSort}.
|
|
19
|
+
*/
|
|
20
|
+
export declare function parseFilterAndSort<M>(search: string): {
|
|
21
|
+
filterValues: FilterValues<string> | undefined;
|
|
22
|
+
sortBy?: [Extract<keyof M, string>, "asc" | "desc"];
|
|
23
|
+
searchString?: string;
|
|
24
|
+
};
|
|
@@ -5,6 +5,12 @@ export type DataSourceTableControllerProps<M extends Record<string, any> = any>
|
|
|
5
5
|
* Full path where the data of this table is located
|
|
6
6
|
*/
|
|
7
7
|
fullPath: string;
|
|
8
|
+
/**
|
|
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 "/".
|
|
12
|
+
*/
|
|
13
|
+
pathSegments?: string[];
|
|
8
14
|
/**
|
|
9
15
|
* The collection that is represented by this config.
|
|
10
16
|
*/
|
|
@@ -40,4 +46,4 @@ export type DataSourceTableControllerProps<M extends Record<string, any> = any>
|
|
|
40
46
|
* @param forceFilterFromProps
|
|
41
47
|
* @param updateUrl
|
|
42
48
|
*/
|
|
43
|
-
export declare function useDataSourceTableController<M extends Record<string, any> = any, USER extends User = User>({ fullPath, collection, scrollRestoration, entitiesDisplayedFirst, lastDeleteTimestamp, forceFilter: forceFilterFromProps, updateUrl }: DataSourceTableControllerProps<M>): EntityTableController<M>;
|
|
49
|
+
export declare function useDataSourceTableController<M extends Record<string, any> = any, USER extends User = User>({ fullPath, pathSegments, collection, scrollRestoration, entitiesDisplayedFirst, lastDeleteTimestamp, forceFilter: forceFilterFromProps, updateUrl }: DataSourceTableControllerProps<M>): EntityTableController<M>;
|
|
@@ -3,8 +3,14 @@ export interface UseTableSearchHelperParams<M extends Record<string, any>> {
|
|
|
3
3
|
collection: EntityCollection<M>;
|
|
4
4
|
fullPath: string;
|
|
5
5
|
parentCollectionIds?: string[];
|
|
6
|
+
/**
|
|
7
|
+
* Search term that is already being applied without the user having gone through the
|
|
8
|
+
* search bar, e.g. one restored from the URL query params. When set, text search is
|
|
9
|
+
* initialised automatically instead of waiting for a click on the search bar.
|
|
10
|
+
*/
|
|
11
|
+
initialSearchString?: string;
|
|
6
12
|
}
|
|
7
|
-
export declare function useTableSearchHelper<M extends Record<string, any>>({ collection, fullPath, parentCollectionIds }: UseTableSearchHelperParams<M>): {
|
|
13
|
+
export declare function useTableSearchHelper<M extends Record<string, any>>({ collection, fullPath, parentCollectionIds, initialSearchString }: UseTableSearchHelperParams<M>): {
|
|
8
14
|
textSearchLoading: boolean;
|
|
9
15
|
textSearchInitialised: boolean;
|
|
10
16
|
onTextSearchClick: (() => void) | undefined;
|
|
@@ -8,11 +8,18 @@ export declare function DefaultDrawer({ className, style, }: {
|
|
|
8
8
|
style?: React.CSSProperties;
|
|
9
9
|
}): React.JSX.Element;
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
11
|
+
* Collapse/expand toggle rendered at the bottom of the drawer.
|
|
12
|
+
* Uses double-chevron icons to indicate direction. Reads the drawer state
|
|
13
|
+
* from {@link useApp} so it can be dropped into any drawer.
|
|
14
|
+
*
|
|
15
|
+
* @group Core
|
|
16
|
+
*/
|
|
17
|
+
export declare function DrawerToggle(): React.JSX.Element;
|
|
18
|
+
/**
|
|
19
|
+
* This is the logo displayed in the drawer.
|
|
20
|
+
* A compact logo aligned to the left of the drawer header.
|
|
13
21
|
*
|
|
14
22
|
* @param logo
|
|
15
|
-
|
|
16
23
|
*/
|
|
17
24
|
export declare function DrawerLogo({ logo }: {
|
|
18
25
|
logo?: string;
|
|
@@ -32,6 +32,12 @@ export interface EntityEditViewProps<M extends Record<string, any>> {
|
|
|
32
32
|
* The navigation path to the entity.
|
|
33
33
|
*/
|
|
34
34
|
fullIdPath?: string;
|
|
35
|
+
/**
|
|
36
|
+
* `path` split at its real segment boundaries, e.g. `["nodes", "node/42", "edges"]`.
|
|
37
|
+
* Forwarded to the datasource, and extended for any subcollection rendered inside this
|
|
38
|
+
* view, so a parent entity id containing "/" stays unambiguous.
|
|
39
|
+
*/
|
|
40
|
+
pathSegments?: string[];
|
|
35
41
|
collection: EntityCollection<M>;
|
|
36
42
|
entityId?: string;
|
|
37
43
|
databaseId?: string;
|
|
@@ -50,7 +56,7 @@ export interface EntityEditViewProps<M extends Record<string, any>> {
|
|
|
50
56
|
* an entity is opened.
|
|
51
57
|
*/
|
|
52
58
|
export declare function EntityEditView<M extends Record<string, any>, USER extends User>({ entityId, ...props }: EntityEditViewProps<M>): React.JSX.Element;
|
|
53
|
-
export declare function EntityEditViewInner<M extends Record<string, any>>({ path, fullIdPath, entityId, selectedTab: selectedTabProp, collection, parentCollectionIds, onValuesModified, onSaved, onTabChange, entity, initialDirtyValues, dataLoading, layout, barActions, status, setStatus, formProps, canEdit }: EntityEditViewProps<M> & {
|
|
59
|
+
export declare function EntityEditViewInner<M extends Record<string, any>>({ path, fullIdPath, pathSegments, entityId, selectedTab: selectedTabProp, collection, parentCollectionIds, onValuesModified, onSaved, onTabChange, entity, initialDirtyValues, dataLoading, layout, barActions, status, setStatus, formProps, canEdit }: EntityEditViewProps<M> & {
|
|
54
60
|
entity?: Entity<M>;
|
|
55
61
|
initialDirtyValues?: Partial<M>;
|
|
56
62
|
dataLoading: boolean;
|
|
@@ -3,5 +3,5 @@ export declare function isDefaultFieldConfigId(id: string): boolean;
|
|
|
3
3
|
export declare const DEFAULT_FIELD_CONFIGS: Record<string, PropertyConfig<any>>;
|
|
4
4
|
export declare function getDefaultFieldConfig(property: Property | ResolvedProperty): PropertyConfig | undefined;
|
|
5
5
|
export declare function getFieldConfig(property: Property | ResolvedProperty, propertyConfigs: Record<string, PropertyConfig<any>>): PropertyConfig | undefined;
|
|
6
|
-
export declare function getDefaultFieldId(property: Property | ResolvedProperty): "reference" | "date_time" | "text_field" | "multiline" | "markdown" | "url" | "email" | "user_select" | "select" | "multi_select" | "number_input" | "number_select" | "multi_number_select" | "file_upload" | "multi_file_upload" | "group" | "key_value" | "reference_as_string" | "multi_references" | "switch" | "repeat" | "custom_array" | "block" | undefined;
|
|
6
|
+
export declare function getDefaultFieldId(property: Property | ResolvedProperty): "reference" | "date_time" | "geopoint" | "text_field" | "multiline" | "markdown" | "url" | "email" | "user_select" | "select" | "multi_select" | "number_input" | "number_select" | "multi_number_select" | "file_upload" | "multi_file_upload" | "group" | "key_value" | "reference_as_string" | "multi_references" | "switch" | "repeat" | "custom_array" | "block" | undefined;
|
|
7
7
|
export declare function getFieldId(property: Property | ResolvedProperty): string | undefined;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { FieldProps, GeoPoint } from "../../types";
|
|
3
|
+
type GeopointFieldBindingProps = FieldProps<GeoPoint>;
|
|
4
|
+
export declare function GeopointFieldBinding({ propertyKey, value, setValue, error, showError, disabled, autoFocus, property, includeDescription, size }: GeopointFieldBindingProps): React.JSX.Element;
|
|
5
|
+
export {};
|
package/dist/form/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export { StorageUploadFieldBinding } from "./field_bindings/StorageUploadFieldBi
|
|
|
7
7
|
export { TextFieldBinding } from "./field_bindings/TextFieldBinding";
|
|
8
8
|
export { SwitchFieldBinding } from "./field_bindings/SwitchFieldBinding";
|
|
9
9
|
export { DateTimeFieldBinding } from "./field_bindings/DateTimeFieldBinding";
|
|
10
|
+
export { GeopointFieldBinding } from "./field_bindings/GeopointFieldBinding";
|
|
10
11
|
export { ReferenceFieldBinding } from "./field_bindings/ReferenceFieldBinding";
|
|
11
12
|
export { ReferenceAsStringFieldBinding } from "./field_bindings/ReferenceAsStringFieldBinding";
|
|
12
13
|
export { MapFieldBinding } from "./field_bindings/MapFieldBinding";
|
|
@@ -34,7 +34,7 @@ export type SaveEntityWithCallbacksProps<M extends Record<string, any>> = SaveEn
|
|
|
34
34
|
* @see useDataSource
|
|
35
35
|
* @group Hooks and utilities
|
|
36
36
|
*/
|
|
37
|
-
export declare function saveEntityWithCallbacks<M extends Record<string, any>, USER extends User>({ collection, path, entityId, values, previousValues, status, dataSource, context, onSaveSuccess, onSaveFailure, onPreSaveHookError, onSaveSuccessHookError }: SaveEntityWithCallbacksProps<M> & {
|
|
37
|
+
export declare function saveEntityWithCallbacks<M extends Record<string, any>, USER extends User>({ collection, path, pathSegments, entityId, values, previousValues, status, dataSource, context, onSaveSuccess, onSaveFailure, onPreSaveHookError, onSaveSuccessHookError }: SaveEntityWithCallbacksProps<M> & {
|
|
38
38
|
collection: EntityCollection<M, USER>;
|
|
39
39
|
dataSource: DataSource;
|
|
40
40
|
context: FireCMSContext;
|
|
@@ -4,6 +4,11 @@ import { Entity, EntityCollection, User } from "../../types";
|
|
|
4
4
|
*/
|
|
5
5
|
export interface EntityFetchProps<M extends Record<string, any>, USER extends User = User> {
|
|
6
6
|
path: string;
|
|
7
|
+
/**
|
|
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.
|
|
10
|
+
*/
|
|
11
|
+
pathSegments?: string[];
|
|
7
12
|
entityId?: string;
|
|
8
13
|
databaseId?: string;
|
|
9
14
|
collection: EntityCollection<M, USER>;
|
|
@@ -26,4 +31,4 @@ export interface EntityFetchResult<M extends Record<string, any>> {
|
|
|
26
31
|
* @param useCache
|
|
27
32
|
* @group Hooks and utilities
|
|
28
33
|
*/
|
|
29
|
-
export declare function useEntityFetch<M extends Record<string, any>, USER extends User>({ path: inputPath, entityId, collection, databaseId, useCache }: EntityFetchProps<M, USER>): EntityFetchResult<M>;
|
|
34
|
+
export declare function useEntityFetch<M extends Record<string, any>, USER extends User>({ path: inputPath, pathSegments: inputPathSegments, entityId, collection, databaseId, useCache }: EntityFetchProps<M, USER>): EntityFetchResult<M>;
|