@firecms/core 3.0.0-alpha.27 → 3.0.0-alpha.28
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/Popover.d.ts +3 -1
- package/dist/core/builders.d.ts +3 -3
- package/dist/core/components/EntityCollectionTable/filters/ReferenceFilterField.d.ts +3 -3
- package/dist/core/components/FieldConfigBadge.d.ts +3 -3
- package/dist/core/components/VirtualTable/VirtualTableHeader.d.ts +2 -2
- package/dist/core/form_field_configs.d.ts +3 -3
- package/dist/core/util/property_utils.d.ts +5 -5
- package/dist/core/util/references.d.ts +2 -2
- package/dist/core/util/resolutions.d.ts +5 -5
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/useBuildDataSource.d.ts +23 -0
- package/dist/index.es.js +6877 -6634
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +14 -14
- package/dist/index.umd.js.map +1 -1
- package/dist/types/datasource.d.ts +120 -11
- package/dist/types/fields.d.ts +1 -1
- package/dist/types/firecms.d.ts +3 -3
- package/dist/types/firecms_context.d.ts +3 -3
- package/dist/types/index.d.ts +1 -1
- package/dist/types/properties.d.ts +1 -1
- package/dist/types/{field_config.d.ts → property_config.d.ts} +3 -4
- package/package.json +2 -2
- package/src/components/Popover.tsx +10 -3
- package/src/components/TextareaAutosize.tsx +2 -1
- package/src/core/builders.ts +5 -5
- package/src/core/components/EntityCollectionTable/EntityCollectionTable.tsx +4 -4
- package/src/core/components/EntityCollectionTable/filters/ReferenceFilterField.tsx +11 -6
- package/src/core/components/EntityCollectionTable/internal/PropertyTableCell.tsx +2 -2
- package/src/core/components/EntityCollectionTable/internal/popup_field/PopupFormField.tsx +6 -2
- package/src/core/components/EntityCollectionView/EntityCollectionView.tsx +1 -1
- package/src/core/components/FieldConfigBadge.tsx +4 -4
- package/src/core/components/VirtualTable/VirtualTableHeader.tsx +21 -18
- package/src/core/form_field_configs.tsx +5 -5
- package/src/core/util/property_utils.tsx +5 -5
- package/src/core/util/references.ts +2 -2
- package/src/core/util/resolutions.ts +16 -11
- package/src/form/EntityForm.tsx +1 -1
- package/src/form/PropertyFieldBinding.tsx +4 -4
- package/src/form/field_bindings/KeyValueFieldBinding.tsx +1 -1
- package/src/form/field_bindings/ReadOnlyFieldBinding.tsx +4 -6
- package/src/hooks/index.tsx +1 -0
- package/src/hooks/useBuildDataSource.ts +351 -0
- package/src/preview/property_previews/StringPropertyPreview.tsx +4 -2
- package/src/types/datasource.ts +174 -10
- package/src/types/fields.tsx +1 -1
- package/src/types/firecms.tsx +3 -3
- package/src/types/firecms_context.tsx +3 -3
- package/src/types/index.ts +1 -1
- package/src/types/properties.ts +1 -1
- package/src/types/{field_config.tsx → property_config.tsx} +3 -4
|
@@ -15,5 +15,7 @@ export interface PopoverProps {
|
|
|
15
15
|
hideWhenDetached?: boolean;
|
|
16
16
|
avoidCollisions?: boolean;
|
|
17
17
|
enabled?: boolean;
|
|
18
|
+
modal?: boolean;
|
|
19
|
+
className?: string;
|
|
18
20
|
}
|
|
19
|
-
export declare function Popover({ trigger, children, open, onOpenChange, side, sideOffset, align, alignOffset, arrowPadding, sticky, hideWhenDetached, avoidCollisions, enabled }: PopoverProps): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export declare function Popover({ trigger, children, open, onOpenChange, side, sideOffset, align, alignOffset, arrowPadding, sticky, hideWhenDetached, avoidCollisions, enabled, modal, className }: PopoverProps): import("react/jsx-runtime").JSX.Element;
|
package/dist/core/builders.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AdditionalFieldDelegate, ArrayProperty, BooleanProperty, CMSType, DateProperty, EntityCallbacks, EntityCollection, EnumValueConfig, EnumValues,
|
|
1
|
+
import { AdditionalFieldDelegate, ArrayProperty, BooleanProperty, CMSType, DateProperty, EntityCallbacks, EntityCollection, EnumValueConfig, EnumValues, PropertyConfig, GeopointProperty, MapProperty, NumberProperty, PropertiesOrBuilders, PropertyBuilder, PropertyOrBuilder, ReferenceProperty, StringProperty, User } from "../types";
|
|
2
2
|
/**
|
|
3
3
|
* Identity function we use to defeat the type system of Typescript and build
|
|
4
4
|
* collection views with all its properties
|
|
@@ -58,7 +58,7 @@ export declare function buildAdditionalFieldDelegate<M extends Record<string, an
|
|
|
58
58
|
/**
|
|
59
59
|
* Identity function we use to defeat the type system of Typescript and build
|
|
60
60
|
* additional field delegates views with all its properties
|
|
61
|
-
* @param
|
|
61
|
+
* @param propertyConfig
|
|
62
62
|
* @category Builder
|
|
63
63
|
*/
|
|
64
|
-
export declare function buildFieldConfig<T extends CMSType = CMSType>(
|
|
64
|
+
export declare function buildFieldConfig<T extends CMSType = CMSType>(propertyConfig: PropertyConfig<T>): PropertyConfig<T>;
|
|
@@ -7,8 +7,8 @@ interface ReferenceFilterFieldProps {
|
|
|
7
7
|
path?: string;
|
|
8
8
|
title?: string;
|
|
9
9
|
previewProperties?: string[];
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
hidden: boolean;
|
|
11
|
+
setHidden: (hidden: boolean) => void;
|
|
12
12
|
}
|
|
13
|
-
export declare function ReferenceFilterField({ name, value, setValue, isArray, path, title, previewProperties,
|
|
13
|
+
export declare function ReferenceFilterField({ name, value, setValue, isArray, path, title, previewProperties, setHidden }: ReferenceFilterFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
14
14
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function FieldConfigBadge({
|
|
3
|
-
|
|
1
|
+
import { PropertyConfig } from "../../types";
|
|
2
|
+
export declare function FieldConfigBadge({ propertyConfig }: {
|
|
3
|
+
propertyConfig: PropertyConfig | undefined;
|
|
4
4
|
}): React.ReactNode;
|
|
@@ -5,8 +5,8 @@ export type FilterFormFieldProps<CustomProps> = {
|
|
|
5
5
|
filterValue: [VirtualTableWhereFilterOp, any] | undefined;
|
|
6
6
|
setFilterValue: (filterValue?: [VirtualTableWhereFilterOp, any]) => void;
|
|
7
7
|
column: VirtualTableColumn<CustomProps>;
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
hidden: boolean;
|
|
9
|
+
setHidden: (hidden: boolean) => void;
|
|
10
10
|
};
|
|
11
11
|
type VirtualTableHeaderProps<M extends Record<string, any>> = {
|
|
12
12
|
resizeHandleRef: RefObject<HTMLDivElement>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PropertyConfig, Property, ResolvedProperty } from "../types";
|
|
2
2
|
export declare function isDefaultFieldConfigId(id: string): boolean;
|
|
3
|
-
export declare const DEFAULT_FIELD_CONFIGS: Record<string,
|
|
4
|
-
export declare function getFieldConfig(property: Property | ResolvedProperty, customFields: Record<string,
|
|
3
|
+
export declare const DEFAULT_FIELD_CONFIGS: Record<string, PropertyConfig<any>>;
|
|
4
|
+
export declare function getFieldConfig(property: Property | ResolvedProperty, customFields: Record<string, PropertyConfig<any>>): PropertyConfig | undefined;
|
|
5
5
|
export declare function getDefaultFieldId(property: Property | ResolvedProperty): "reference" | "date_time" | "email" | "url" | "group" | "switch" | "block" | "file_upload" | "repeat" | "select" | "text_field" | "multiline" | "markdown" | "multi_select" | "number_input" | "number_select" | "multi_number_select" | "multi_file_upload" | "multi_references" | "key_value" | "custom_array" | undefined;
|
|
6
6
|
export declare function getFieldId(property: Property | ResolvedProperty): string | undefined;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { EntityCollection,
|
|
3
|
-
export declare function isReferenceProperty(propertyOrBuilder: PropertyOrBuilder, fields: Record<string,
|
|
2
|
+
import { EntityCollection, PropertyConfig, PropertiesOrBuilders, PropertyOrBuilder, ResolvedProperty } from "../../types";
|
|
3
|
+
export declare function isReferenceProperty(propertyOrBuilder: PropertyOrBuilder, fields: Record<string, PropertyConfig>): boolean | null;
|
|
4
4
|
export declare function getIdIcon(size: "small" | "medium" | "large"): React.ReactNode;
|
|
5
|
-
export declare function getIconForWidget(widget:
|
|
6
|
-
export declare function getIconForProperty(property: PropertyOrBuilder | ResolvedProperty, size?: "small" | "medium" | "large", fields?: Record<string,
|
|
7
|
-
export declare function getColorForProperty(property: PropertyOrBuilder, fields: Record<string,
|
|
5
|
+
export declare function getIconForWidget(widget: PropertyConfig | undefined, size: "small" | "medium" | "large"): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare function getIconForProperty(property: PropertyOrBuilder | ResolvedProperty, size?: "small" | "medium" | "large", fields?: Record<string, PropertyConfig>): React.ReactNode;
|
|
7
|
+
export declare function getColorForProperty(property: PropertyOrBuilder, fields: Record<string, PropertyConfig>): string;
|
|
8
8
|
/**
|
|
9
9
|
* Get a property in a property tree from a path like
|
|
10
10
|
* `address.street`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { EntityCollection,
|
|
2
|
-
export declare function getReferencePreviewKeys(targetCollection: EntityCollection<any>, fields: Record<string,
|
|
1
|
+
import { EntityCollection, PropertyConfig } from "../../types";
|
|
2
|
+
export declare function getReferencePreviewKeys(targetCollection: EntityCollection<any>, fields: Record<string, PropertyConfig>, previewProperties?: string[], limit?: number): string[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ArrayProperty, CMSType, EntityCollection, EntityCustomView, EntityValues, EnumValueConfig, EnumValues,
|
|
1
|
+
import { ArrayProperty, CMSType, EntityCollection, EntityCustomView, EntityValues, EnumValueConfig, EnumValues, PropertyConfig, NumberProperty, PropertiesOrBuilders, PropertyOrBuilder, ResolvedArrayProperty, ResolvedEntityCollection, ResolvedNumberProperty, ResolvedProperties, ResolvedProperty, ResolvedStringProperty, StringProperty, UserConfigurationPersistence } from "../../types";
|
|
2
2
|
export declare const resolveCollection: <M extends Record<string, any>>({ collection, path, entityId, values, previousValues, userConfigPersistence, fields }: {
|
|
3
3
|
collection: EntityCollection<M, string, import("../../types").User> | ResolvedEntityCollection<M>;
|
|
4
4
|
path: string;
|
|
@@ -6,7 +6,7 @@ export declare const resolveCollection: <M extends Record<string, any>>({ collec
|
|
|
6
6
|
values?: Partial<M> | undefined;
|
|
7
7
|
previousValues?: Partial<M> | undefined;
|
|
8
8
|
userConfigPersistence?: UserConfigurationPersistence | undefined;
|
|
9
|
-
fields?: Record<string,
|
|
9
|
+
fields?: Record<string, PropertyConfig> | undefined;
|
|
10
10
|
}) => ResolvedEntityCollection<M>;
|
|
11
11
|
/**
|
|
12
12
|
* Resolve property builders, enums and arrays.
|
|
@@ -24,7 +24,7 @@ export declare function resolveProperty<T extends CMSType = CMSType, M extends R
|
|
|
24
24
|
entityId?: string;
|
|
25
25
|
index?: number;
|
|
26
26
|
fromBuilder?: boolean;
|
|
27
|
-
fields?: Record<string,
|
|
27
|
+
fields?: Record<string, PropertyConfig<any>>;
|
|
28
28
|
}): ResolvedProperty<T> | null;
|
|
29
29
|
export declare function resolveArrayProperty<T extends any[], M>({ propertyKey, property, propertyValue, ...props }: {
|
|
30
30
|
propertyKey?: string;
|
|
@@ -36,7 +36,7 @@ export declare function resolveArrayProperty<T extends any[], M>({ propertyKey,
|
|
|
36
36
|
entityId?: string;
|
|
37
37
|
index?: number;
|
|
38
38
|
fromBuilder?: boolean;
|
|
39
|
-
fields?: Record<string,
|
|
39
|
+
fields?: Record<string, PropertyConfig>;
|
|
40
40
|
}): ResolvedArrayProperty;
|
|
41
41
|
/**
|
|
42
42
|
* Resolve enums and arrays for properties
|
|
@@ -52,7 +52,7 @@ export declare function resolveProperties<M extends Record<string, any>>({ prope
|
|
|
52
52
|
entityId?: string;
|
|
53
53
|
index?: number;
|
|
54
54
|
fromBuilder?: boolean;
|
|
55
|
-
fields?: Record<string,
|
|
55
|
+
fields?: Record<string, PropertyConfig>;
|
|
56
56
|
}): ResolvedProperties<M>;
|
|
57
57
|
/**
|
|
58
58
|
* Resolve enum aliases for a string or number property
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { DataSource, DataSourceDelegate, EntityReference, GeoPoint, PropertyConfig } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* Use this hook to build a {@link DataSource} based on Firestore
|
|
4
|
+
* @param firebaseApp
|
|
5
|
+
* @param textSearchController
|
|
6
|
+
* @param collectionRegistry
|
|
7
|
+
* @category Firebase
|
|
8
|
+
*/
|
|
9
|
+
export declare function useBuildDataSource({ delegate, customFields }: {
|
|
10
|
+
delegate: DataSourceDelegate;
|
|
11
|
+
customFields: Record<string, PropertyConfig>;
|
|
12
|
+
}): DataSource;
|
|
13
|
+
/**
|
|
14
|
+
* Recursive function that converts Firestore data types into CMS or plain
|
|
15
|
+
* JS types.
|
|
16
|
+
* FireCMS uses Javascript dates internally instead of Firestore timestamps.
|
|
17
|
+
* This makes it easier to interact with the rest of the libraries and
|
|
18
|
+
* bindings.
|
|
19
|
+
* Also, Firestore references are replaced with {@link EntityReference}
|
|
20
|
+
* @param data
|
|
21
|
+
* @category Firestore
|
|
22
|
+
*/
|
|
23
|
+
export declare function cmsToDelegateModel(data: any, buildReference: (reference: EntityReference) => any, buildGeoPoint: (geoPoint: GeoPoint) => any, buildDate: (date: Date) => any, buildDelete: () => any): any;
|