@firecms/core 3.0.0-alpha.15 → 3.0.0-alpha.17

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 (28) hide show
  1. package/dist/components/Chip.d.ts +1 -0
  2. package/dist/core/Scaffold.d.ts +1 -1
  3. package/dist/core/components/CircularProgressCenter.d.ts +4 -1
  4. package/dist/core/components/EntityCollectionTable/EntityCollectionTableProps.d.ts +1 -1
  5. package/dist/core/components/EntityCollectionTable/index.d.ts +1 -1
  6. package/dist/core/components/EntityCollectionTable/internal/popup_field/PopupFormField.d.ts +3 -3
  7. package/dist/core/components/EntityCollectionTable/types.d.ts +1 -9
  8. package/dist/core/components/EntityCollectionTable/useEntityCollectionTableController.d.ts +21 -0
  9. package/dist/core/components/FieldConfigBadge.d.ts +2 -2
  10. package/dist/core/components/HomePage/{FireCMSHomePage.d.ts → DefaultHomePage.d.ts} +1 -1
  11. package/dist/core/components/HomePage/index.d.ts +1 -1
  12. package/dist/core/form_field_configs.d.ts +6 -4
  13. package/dist/core/util/collections.d.ts +1 -13
  14. package/dist/core/util/navigation_from_path.d.ts +1 -1
  15. package/dist/core/util/property_utils.d.ts +2 -2
  16. package/dist/core/util/resolutions.d.ts +2 -1
  17. package/dist/index.es.js +11639 -11544
  18. package/dist/index.es.js.map +1 -1
  19. package/dist/index.umd.js +14 -14
  20. package/dist/index.umd.js.map +1 -1
  21. package/dist/types/collections.d.ts +5 -18
  22. package/dist/types/field_config.d.ts +16 -18
  23. package/dist/types/firecms.d.ts +9 -1
  24. package/dist/types/firecms_context.d.ts +9 -0
  25. package/dist/types/plugins.d.ts +2 -2
  26. package/dist/types/properties.d.ts +6 -0
  27. package/package.json +3 -8
  28. package/dist/core/components/EntityCollectionTable/useCollectionTableController.d.ts +0 -13
@@ -1,3 +1,4 @@
1
+ import React from "react";
1
2
  import { ChipColorKey, ChipColorScheme } from "../types";
2
3
  export interface ChipProps {
3
4
  className?: string;
@@ -17,7 +17,7 @@ export interface ScaffoldProps<ExtraDrawerProps = object, ExtraAppbarProps = obj
17
17
  includeDrawer?: boolean;
18
18
  /**
19
19
  * In case you need to override the view that gets rendered as a drawer
20
- * @see FireCMSDrawer
20
+ * @see DefaultDrawer
21
21
  */
22
22
  Drawer?: React.ComponentType<DrawerProps<ExtraDrawerProps>>;
23
23
  /**
@@ -1,8 +1,11 @@
1
1
  import { CircularProgressProps } from "../../components";
2
2
  /**
3
3
  *
4
+ * @param text
4
5
  * @param props
5
6
  * @constructor
6
7
  * @ignore
7
8
  */
8
- export declare function CircularProgressCenter(props: CircularProgressProps): import("react/jsx-runtime").JSX.Element;
9
+ export declare function CircularProgressCenter({ text, ...props }: CircularProgressProps & {
10
+ text?: string;
11
+ }): import("react/jsx-runtime").JSX.Element;
@@ -68,7 +68,7 @@ export type EntityCollectionTableProps<M extends Record<string, any>, Additional
68
68
  actions?: React.ReactNode;
69
69
  /**
70
70
  * Controller holding the logic for the table
71
- * {@link useCollectionTableController}
71
+ * {@link useEntityCollectionTableController}
72
72
  * {@link TableController}
73
73
  */
74
74
  tableController: TableController<M>;
@@ -1,4 +1,4 @@
1
1
  export { EntityCollectionTable } from "./EntityCollectionTable";
2
2
  export type { EntityCollectionTableProps, OnColumnResizeParams } from "./EntityCollectionTableProps";
3
3
  export type { UniqueFieldValidator, OnCellValueChange, OnCellValueChangeParams } from "./types";
4
- export * from "./useCollectionTableController";
4
+ export * from "./useEntityCollectionTableController";
@@ -6,12 +6,12 @@ interface PopupFormFieldProps<M extends Record<string, any>> {
6
6
  customFieldValidator?: CustomFieldValidator;
7
7
  path: string;
8
8
  tableKey: string;
9
- propertyKey?: keyof M;
9
+ propertyKey?: Extract<keyof M, string>;
10
10
  collection?: EntityCollection<M>;
11
11
  cellRect?: DOMRect;
12
12
  open: boolean;
13
13
  onClose: () => void;
14
- columnIndex?: number;
14
+ container: HTMLElement | null;
15
15
  /**
16
16
  * Callback when the value of a cell has been edited
17
17
  * @param params
@@ -19,5 +19,5 @@ interface PopupFormFieldProps<M extends Record<string, any>> {
19
19
  onCellValueChange?: (params: OnCellValueChangeParams<any, M>) => Promise<void>;
20
20
  }
21
21
  export declare function PopupFormField<M extends Record<string, any>>(props: PopupFormFieldProps<M>): import("react/jsx-runtime").JSX.Element | null;
22
- export declare function PopupFormFieldInternal<M extends Record<string, any>>({ tableKey, entity: entityProp, customFieldValidator, propertyKey, collection: inputCollection, path, cellRect, open, onClose, columnIndex, onCellValueChange }: PopupFormFieldProps<M>): import("react/jsx-runtime").JSX.Element;
22
+ export declare function PopupFormFieldInternal<M extends Record<string, any>>({ tableKey, entity: entityProp, customFieldValidator, propertyKey, collection: inputCollection, path, cellRect, open, onClose, onCellValueChange, container }: PopupFormFieldProps<M>): import("react/jsx-runtime").JSX.Element;
23
23
  export {};
@@ -1,4 +1,4 @@
1
- import { CollectionSize, Entity, EntityCollection, FireCMSContext, ResolvedProperty, User } from "../../../types";
1
+ import { CollectionSize, Entity, EntityCollection, FireCMSContext, ResolvedProperty, SelectedCellProps, User } from "../../../types";
2
2
  export type EntityCollectionTableProviderProps<M extends Record<string, any>, AdditionalKey extends string, UserType extends User> = {
3
3
  /**
4
4
  * Absolute collection path
@@ -59,14 +59,6 @@ export interface OnCellValueChangeParams<T, M extends Record<string, any>> {
59
59
  fullPath: string;
60
60
  context: FireCMSContext;
61
61
  }
62
- export type SelectedCellProps<M extends Record<string, any>> = {
63
- propertyKey: keyof M;
64
- columnIndex: number;
65
- cellRect: DOMRect;
66
- width: number;
67
- height: number;
68
- entity: Entity<M>;
69
- };
70
62
  /**
71
63
  * @category Collection components
72
64
  */
@@ -0,0 +1,21 @@
1
+ import { Entity, EntityCollection, FilterValues, TableController, User } from "../../../types";
2
+ export type EntityCollectionTableControllerProps<M extends Record<string, any> = any> = {
3
+ fullPath: string;
4
+ collection: EntityCollection<M>;
5
+ /**
6
+ * List of entities that will be displayed on top, no matter the ordering.
7
+ * This is used for reference fields selection
8
+ */
9
+ entitiesDisplayedFirst?: Entity<M>[];
10
+ lastDeleteTimestamp?: number;
11
+ forceFilter?: FilterValues<string>;
12
+ };
13
+ /**
14
+ * Use this hook to build a controller for the {@link EntityCollectionTable}
15
+ * @param fullPath
16
+ * @param collection
17
+ * @param entitiesDisplayedFirst
18
+ * @param lastDeleteTimestamp
19
+ * @param forceFilterFromProps
20
+ */
21
+ export declare function useEntityCollectionTableController<M extends Record<string, any> = any, UserType extends User = User>({ fullPath, collection, entitiesDisplayedFirst, lastDeleteTimestamp, forceFilter: forceFilterFromProps }: EntityCollectionTableControllerProps<M>): TableController<M>;
@@ -1,4 +1,4 @@
1
1
  import { FieldConfig } from "../../types";
2
- export declare function FieldConfigBadge({ widget }: {
3
- widget: FieldConfig | undefined;
2
+ export declare function FieldConfigBadge({ fieldConfig }: {
3
+ fieldConfig: FieldConfig | undefined;
4
4
  }): React.ReactNode;
@@ -5,7 +5,7 @@ import React from "react";
5
5
  * @constructor
6
6
  * @category Components
7
7
  */
8
- export declare function FireCMSHomePage({ additionalChildrenStart, additionalChildrenEnd }: {
8
+ export declare function DefaultHomePage({ additionalChildrenStart, additionalChildrenEnd }: {
9
9
  additionalChildrenStart?: React.ReactNode;
10
10
  additionalChildrenEnd?: React.ReactNode;
11
11
  }): import("react/jsx-runtime").JSX.Element;
@@ -1,3 +1,3 @@
1
- export * from "./FireCMSHomePage";
1
+ export * from "./DefaultHomePage";
2
2
  export * from "./NavigationCollectionCard";
3
3
  export * from "./NavigationGroup";
@@ -1,4 +1,6 @@
1
- import { FieldConfig, FieldConfigId, Property, ResolvedProperty } from "../types";
2
- export declare const DEFAULT_FIELD_CONFIGS: Record<FieldConfigId, FieldConfig<any>>;
3
- export declare function getFieldConfig(property: Property | ResolvedProperty): FieldConfig | undefined;
4
- export declare function getFieldId(property: Property | ResolvedProperty): FieldConfigId | undefined;
1
+ import { FieldConfig, Property, ResolvedProperty } from "../types";
2
+ export declare function isDefaultFieldConfigId(id: string): boolean;
3
+ export declare const DEFAULT_FIELD_CONFIGS: Record<string, FieldConfig<any>>;
4
+ export declare function getFieldConfig(property: Property | ResolvedProperty, customFields: Record<string, FieldConfig<any>>): FieldConfig | undefined;
5
+ export declare function getDefaultFieldId(property: Property | ResolvedProperty): "reference" | "date_time" | "group" | "switch" | "email" | "url" | "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
+ export declare function getFieldId(property: Property | ResolvedProperty): string | undefined;
@@ -1,15 +1,3 @@
1
- import { DefaultSelectedViewBuilder, DefaultSelectedViewParams, EntityCollection, PropertiesOrBuilders } from "../../types";
2
- /**
3
- *
4
- * @param target
5
- * @param source
6
- */
7
- export declare function mergeCollections(target: EntityCollection, source: EntityCollection): EntityCollection;
8
- /**
9
- *
10
- * @param fetchedCollections
11
- * @param baseCollections
12
- */
13
- export declare function joinCollectionLists(fetchedCollections: EntityCollection[], baseCollections: EntityCollection[] | undefined): EntityCollection[];
1
+ import { DefaultSelectedViewBuilder, DefaultSelectedViewParams, PropertiesOrBuilders } from "../../types";
14
2
  export declare function sortProperties<M extends Record<string, any>>(properties: PropertiesOrBuilders<M>, propertiesOrder?: (keyof M)[]): PropertiesOrBuilders<M>;
15
3
  export declare function resolveDefaultSelectedView(defaultSelectedView: string | DefaultSelectedViewBuilder | undefined, params: DefaultSelectedViewParams): string | undefined;
@@ -19,6 +19,6 @@ export interface NavigationViewEntityCustomInternal<M extends Record<string, any
19
19
  export declare function getNavigationEntriesFromPathInternal(props: {
20
20
  path: string;
21
21
  collections: EntityCollection[] | undefined;
22
- customViews?: EntityCustomView<any>[];
23
22
  currentFullPath?: string;
23
+ contextEntityViews?: EntityCustomView<any>[];
24
24
  }): NavigationViewInternal[];
@@ -3,8 +3,8 @@ import { FieldConfig, PropertiesOrBuilders, PropertyOrBuilder, ResolvedProperty
3
3
  export declare function isReferenceProperty(propertyOrBuilder: PropertyOrBuilder, fields: Record<string, FieldConfig>): boolean | null;
4
4
  export declare function getIdIcon(size: "small" | "medium" | "large"): React.ReactNode;
5
5
  export declare function getIconForWidget(widget: FieldConfig | undefined, size: "small" | "medium" | "large"): import("react/jsx-runtime").JSX.Element;
6
- export declare function getIconForProperty(property: PropertyOrBuilder | ResolvedProperty, size?: "small" | "medium" | "large"): React.ReactNode;
7
- export declare function getColorForProperty(property: PropertyOrBuilder): string;
6
+ export declare function getIconForProperty(property: PropertyOrBuilder | ResolvedProperty, size?: "small" | "medium" | "large", fields?: Record<string, FieldConfig>): React.ReactNode;
7
+ export declare function getColorForProperty(property: PropertyOrBuilder, fields: Record<string, FieldConfig>): string;
8
8
  /**
9
9
  * Get a property in a property tree from a path like
10
10
  * `address.street`
@@ -1,4 +1,4 @@
1
- import { ArrayProperty, CMSType, EntityCollection, EntityValues, EnumValueConfig, EnumValues, FieldConfig, NumberProperty, PropertiesOrBuilders, PropertyOrBuilder, ResolvedArrayProperty, ResolvedEntityCollection, ResolvedNumberProperty, ResolvedProperties, ResolvedProperty, ResolvedStringProperty, StringProperty, UserConfigurationPersistence } from "../../types";
1
+ import { ArrayProperty, CMSType, EntityCollection, EntityCustomView, EntityValues, EnumValueConfig, EnumValues, FieldConfig, 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;
@@ -61,3 +61,4 @@ export declare function resolveProperties<M extends Record<string, any>>({ prope
61
61
  */
62
62
  export declare function resolvePropertyEnum(property: StringProperty | NumberProperty, fromBuilder?: boolean): ResolvedStringProperty | ResolvedNumberProperty;
63
63
  export declare function resolveEnumValues(input: EnumValues): EnumValueConfig[] | undefined;
64
+ export declare function resolveEntityView(entityView: string | EntityCustomView<any>, contextEntityViews?: EntityCustomView<any>[]): EntityCustomView<any> | undefined;