@firecms/collection_editor 3.0.0 → 3.1.0-canary.1df3b2c

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 (91) hide show
  1. package/dist/ConfigControllerProvider.d.ts +6 -0
  2. package/dist/api/generateCollectionApi.d.ts +71 -0
  3. package/dist/api/index.d.ts +1 -0
  4. package/dist/index.d.ts +5 -1
  5. package/dist/index.es.js +9677 -5837
  6. package/dist/index.es.js.map +1 -1
  7. package/dist/index.umd.js +9653 -5813
  8. package/dist/index.umd.js.map +1 -1
  9. package/dist/types/collection_editor_controller.d.ts +14 -0
  10. package/dist/types/collection_inference.d.ts +8 -2
  11. package/dist/types/config_controller.d.ts +31 -1
  12. package/dist/ui/AddKanbanColumnAction.d.ts +11 -0
  13. package/dist/ui/KanbanSetupAction.d.ts +10 -0
  14. package/dist/ui/collection_editor/AICollectionGeneratorPopover.d.ts +33 -0
  15. package/dist/ui/collection_editor/AIModifiedPathsContext.d.ts +20 -0
  16. package/dist/ui/collection_editor/CollectionDetailsForm.d.ts +2 -3
  17. package/dist/ui/collection_editor/CollectionEditorDialog.d.ts +20 -0
  18. package/dist/ui/collection_editor/CollectionEditorWelcomeView.d.ts +3 -1
  19. package/dist/ui/collection_editor/CollectionJsonImportDialog.d.ts +7 -0
  20. package/dist/ui/collection_editor/CollectionYupValidation.d.ts +9 -13
  21. package/dist/ui/collection_editor/DisplaySettingsForm.d.ts +3 -0
  22. package/dist/ui/collection_editor/EntityActionsEditTab.d.ts +2 -1
  23. package/dist/ui/collection_editor/ExtendSettingsForm.d.ts +14 -0
  24. package/dist/ui/collection_editor/GeneralSettingsForm.d.ts +7 -0
  25. package/dist/ui/collection_editor/KanbanConfigSection.d.ts +4 -0
  26. package/dist/ui/collection_editor/PropertyEditView.d.ts +6 -1
  27. package/dist/ui/collection_editor/PropertyTree.d.ts +2 -1
  28. package/dist/ui/collection_editor/SubcollectionsEditTab.d.ts +2 -1
  29. package/dist/ui/collection_editor/ViewModeSwitch.d.ts +6 -0
  30. package/dist/ui/collection_editor/properties/EnumPropertyField.d.ts +2 -1
  31. package/dist/ui/collection_editor/properties/conditions/ConditionsEditor.d.ts +10 -0
  32. package/dist/ui/collection_editor/properties/conditions/ConditionsPanel.d.ts +2 -0
  33. package/dist/ui/collection_editor/properties/conditions/EnumConditionsEditor.d.ts +6 -0
  34. package/dist/ui/collection_editor/properties/conditions/index.d.ts +6 -0
  35. package/dist/ui/collection_editor/properties/conditions/property_paths.d.ts +19 -0
  36. package/dist/useCollectionEditorPlugin.d.ts +7 -1
  37. package/dist/utils/validateCollectionJson.d.ts +22 -0
  38. package/package.json +11 -11
  39. package/src/ConfigControllerProvider.tsx +81 -47
  40. package/src/api/generateCollectionApi.ts +119 -0
  41. package/src/api/index.ts +1 -0
  42. package/src/index.ts +28 -1
  43. package/src/types/collection_editor_controller.tsx +16 -3
  44. package/src/types/collection_inference.ts +15 -2
  45. package/src/types/config_controller.tsx +37 -1
  46. package/src/ui/AddKanbanColumnAction.tsx +203 -0
  47. package/src/ui/EditorCollectionActionStart.tsx +1 -2
  48. package/src/ui/HomePageEditorCollectionAction.tsx +41 -13
  49. package/src/ui/KanbanSetupAction.tsx +38 -0
  50. package/src/ui/MissingReferenceWidget.tsx +1 -1
  51. package/src/ui/NewCollectionButton.tsx +1 -1
  52. package/src/ui/PropertyAddColumnComponent.tsx +1 -1
  53. package/src/ui/collection_editor/AICollectionGeneratorPopover.tsx +225 -0
  54. package/src/ui/collection_editor/AIModifiedPathsContext.tsx +88 -0
  55. package/src/ui/collection_editor/CollectionDetailsForm.tsx +209 -258
  56. package/src/ui/collection_editor/CollectionEditorDialog.tsx +226 -173
  57. package/src/ui/collection_editor/CollectionEditorWelcomeView.tsx +130 -67
  58. package/src/ui/collection_editor/CollectionJsonImportDialog.tsx +171 -0
  59. package/src/ui/collection_editor/CollectionPropertiesEditorForm.tsx +190 -91
  60. package/src/ui/collection_editor/DisplaySettingsForm.tsx +333 -0
  61. package/src/ui/collection_editor/EntityActionsEditTab.tsx +106 -96
  62. package/src/ui/collection_editor/EntityActionsSelectDialog.tsx +6 -7
  63. package/src/ui/collection_editor/EntityCustomViewsSelectDialog.tsx +1 -3
  64. package/src/ui/collection_editor/EnumForm.tsx +147 -100
  65. package/src/ui/collection_editor/ExtendSettingsForm.tsx +93 -0
  66. package/src/ui/collection_editor/GeneralSettingsForm.tsx +335 -0
  67. package/src/ui/collection_editor/GetCodeDialog.tsx +57 -36
  68. package/src/ui/collection_editor/KanbanConfigSection.tsx +207 -0
  69. package/src/ui/collection_editor/LayoutModeSwitch.tsx +22 -41
  70. package/src/ui/collection_editor/PropertyEditView.tsx +205 -141
  71. package/src/ui/collection_editor/PropertyFieldPreview.tsx +1 -1
  72. package/src/ui/collection_editor/PropertyTree.tsx +130 -58
  73. package/src/ui/collection_editor/SubcollectionsEditTab.tsx +171 -162
  74. package/src/ui/collection_editor/UnsavedChangesDialog.tsx +0 -2
  75. package/src/ui/collection_editor/ViewModeSwitch.tsx +41 -0
  76. package/src/ui/collection_editor/properties/BlockPropertyField.tsx +0 -2
  77. package/src/ui/collection_editor/properties/BooleanPropertyField.tsx +1 -0
  78. package/src/ui/collection_editor/properties/DateTimePropertyField.tsx +117 -35
  79. package/src/ui/collection_editor/properties/EnumPropertyField.tsx +28 -21
  80. package/src/ui/collection_editor/properties/MapPropertyField.tsx +0 -2
  81. package/src/ui/collection_editor/properties/MarkdownPropertyField.tsx +115 -39
  82. package/src/ui/collection_editor/properties/ReferencePropertyField.tsx +1 -5
  83. package/src/ui/collection_editor/properties/StoragePropertyField.tsx +23 -2
  84. package/src/ui/collection_editor/properties/conditions/ConditionsEditor.tsx +861 -0
  85. package/src/ui/collection_editor/properties/conditions/ConditionsPanel.tsx +28 -0
  86. package/src/ui/collection_editor/properties/conditions/EnumConditionsEditor.tsx +599 -0
  87. package/src/ui/collection_editor/properties/conditions/index.ts +6 -0
  88. package/src/ui/collection_editor/properties/conditions/property_paths.ts +92 -0
  89. package/src/ui/collection_editor/properties/validation/ValidationPanel.tsx +1 -1
  90. package/src/useCollectionEditorPlugin.tsx +32 -17
  91. package/src/utils/validateCollectionJson.ts +380 -0
@@ -12,13 +12,27 @@ export interface CollectionEditorController {
12
12
  parentCollectionIds: string[];
13
13
  parentCollection?: PersistedCollection;
14
14
  existingEntities?: Entity<any>[];
15
+ /**
16
+ * Initial view to open: "general", "display", or "properties"
17
+ */
18
+ initialView?: "general" | "display" | "properties";
19
+ /**
20
+ * If true, expand the Kanban configuration section
21
+ */
22
+ expandKanban?: boolean;
15
23
  }) => void;
16
24
  createCollection: (props: {
17
25
  initialValues?: {
18
26
  group?: string;
19
27
  path?: string;
20
28
  name?: string;
29
+ databaseId?: string;
21
30
  };
31
+ /**
32
+ * A collection to duplicate from. If provided, the new collection will be
33
+ * pre-populated with the same properties (but with empty name, path, and id).
34
+ */
35
+ copyFrom?: PersistedCollection;
22
36
  parentCollectionIds: string[];
23
37
  parentCollection?: PersistedCollection;
24
38
  redirect: boolean;
@@ -1,5 +1,11 @@
1
- import { EntityCollection } from "@firecms/core";
1
+ import { EntityCollection, FilterValues } from "@firecms/core";
2
2
  /**
3
3
  * This function is used to infer the configuration of a collection given its path.
4
+ * @param path - The path of the collection
5
+ * @param collectionGroup - Whether this is a collection group query
6
+ * @param parentCollectionPaths - Array of parent collection paths for subcollections
7
+ * @param databaseId - Optional database ID for multi-database setups
8
+ * @param initialFilter - Optional filter values from the collection configuration
9
+ * @param initialSort - Optional sort configuration from the collection
4
10
  */
5
- export type CollectionInference = (path: string, collectionGroup: boolean, parentCollectionPaths: string[], databaseId?: string) => Promise<Partial<EntityCollection> | null>;
11
+ export type CollectionInference = (path: string, collectionGroup: boolean, parentCollectionPaths: string[], databaseId?: string, initialFilter?: FilterValues<string>, initialSort?: [string, "asc" | "desc"]) => Promise<Partial<EntityCollection> | null>;
@@ -1,5 +1,9 @@
1
- import { CMSType, NavigationGroupMapping, Property } from "@firecms/core";
1
+ import { CMSType, EntityCollection, NavigationGroupMapping, Property } from "@firecms/core";
2
2
  import { PersistedCollection } from "./persisted_collection";
3
+ export interface CollectionsSetupInfo {
4
+ status: "ongoing" | "complete" | "error";
5
+ error: string | null;
6
+ }
3
7
  /**
4
8
  * Use this controller to access the configuration that is stored externally,
5
9
  * and not defined in code.
@@ -7,6 +11,11 @@ import { PersistedCollection } from "./persisted_collection";
7
11
  export interface CollectionsConfigController {
8
12
  loading: boolean;
9
13
  collections?: PersistedCollection[];
14
+ /**
15
+ * Status information about the automatic collections setup process.
16
+ * Stored in the project config document at `collectionsSetup`.
17
+ */
18
+ collectionsSetup?: CollectionsSetupInfo;
10
19
  getCollection: (id: string) => PersistedCollection;
11
20
  saveCollection: <M extends {
12
21
  [Key: string]: CMSType;
@@ -17,6 +26,14 @@ export interface CollectionsConfigController {
17
26
  saveProperty: (params: SavePropertyParams) => Promise<void>;
18
27
  deleteProperty: (params: DeletePropertyParams) => Promise<void>;
19
28
  deleteCollection: (props: DeleteCollectionParams) => Promise<void>;
29
+ /**
30
+ * Update the properties order of a collection (used for column reordering).
31
+ */
32
+ updatePropertiesOrder: (params: UpdatePropertiesOrderParams) => Promise<void>;
33
+ /**
34
+ * Update the Kanban columns order for a collection.
35
+ */
36
+ updateKanbanColumnsOrder: (params: UpdateKanbanColumnsOrderParams) => Promise<void>;
20
37
  navigationEntries: NavigationGroupMapping[];
21
38
  saveNavigationEntries: (entries: NavigationGroupMapping[]) => Promise<void>;
22
39
  }
@@ -51,3 +68,16 @@ export type DeleteCollectionParams = {
51
68
  id: string;
52
69
  parentCollectionIds?: string[];
53
70
  };
71
+ export type UpdatePropertiesOrderParams = {
72
+ fullPath: string;
73
+ parentCollectionIds: string[];
74
+ collection: EntityCollection<any>;
75
+ newPropertiesOrder: string[];
76
+ };
77
+ export type UpdateKanbanColumnsOrderParams = {
78
+ fullPath: string;
79
+ parentCollectionIds: string[];
80
+ collection: EntityCollection<any>;
81
+ kanbanColumnProperty: string;
82
+ newColumnsOrder: string[];
83
+ };
@@ -0,0 +1,11 @@
1
+ import { EntityCollection } from "@firecms/core";
2
+ /**
3
+ * Component rendered at the end of the Kanban board to add new columns (enum values).
4
+ * Opens a dialog to input a new enum value for the column property.
5
+ */
6
+ export declare function AddKanbanColumnAction({ collection, fullPath, parentCollectionIds, columnProperty }: {
7
+ collection: EntityCollection;
8
+ fullPath: string;
9
+ parentCollectionIds: string[];
10
+ columnProperty: string;
11
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,10 @@
1
+ import { EntityCollection } from "@firecms/core";
2
+ /**
3
+ * Component rendered when Kanban view is missing orderProperty configuration.
4
+ * Provides a CTA button to open the collection editor to configure Kanban.
5
+ */
6
+ export declare function KanbanSetupAction({ collection, fullPath, parentCollectionIds }: {
7
+ collection: EntityCollection;
8
+ fullPath: string;
9
+ parentCollectionIds: string[];
10
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,33 @@
1
+ import React from "react";
2
+ import { EntityCollection } from "@firecms/core";
3
+ import { CollectionGenerationCallback, CollectionOperation } from "../../api/generateCollectionApi";
4
+ import { PersistedCollection } from "../../types/persisted_collection";
5
+ export interface AICollectionGeneratorPopoverProps {
6
+ /**
7
+ * Current collection being edited (if modifying an existing collection)
8
+ */
9
+ existingCollection?: PersistedCollection;
10
+ /**
11
+ * Callback when a collection is generated or modified.
12
+ * Includes the collection and optionally the operations that were applied.
13
+ */
14
+ onGenerated: (collection: EntityCollection, operations?: CollectionOperation[]) => void;
15
+ /**
16
+ * Callback function for generating/modifying collections.
17
+ * The plugin is API-agnostic - the consumer provides the implementation.
18
+ */
19
+ generateCollection: CollectionGenerationCallback;
20
+ /**
21
+ * Optional custom trigger button. If not provided, a default AI button is used.
22
+ */
23
+ trigger?: React.ReactNode;
24
+ /**
25
+ * Size of the button
26
+ */
27
+ size?: "small" | "medium" | "large";
28
+ /**
29
+ * Whether to show the label text
30
+ */
31
+ showLabel?: boolean;
32
+ }
33
+ export declare function AICollectionGeneratorPopover({ existingCollection, onGenerated, generateCollection, trigger, size, showLabel }: AICollectionGeneratorPopoverProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,20 @@
1
+ import React from "react";
2
+ import { CollectionOperation } from "../../api/generateCollectionApi";
3
+ export interface AIModifiedPathsContextType {
4
+ /** Set of paths that were modified by AI */
5
+ modifiedPaths: Set<string>;
6
+ /** Counter that increments each time AI modifies the collection - use in keys to force remount */
7
+ generationCounter: number;
8
+ /** Add paths from operations */
9
+ addModifiedPaths: (operations: CollectionOperation[]) => void;
10
+ /** Clear a specific path (when user edits that field) */
11
+ clearPath: (path: string) => void;
12
+ /** Clear all paths (on save or cancel) */
13
+ clearAllPaths: () => void;
14
+ /** Check if a path is modified */
15
+ isPathModified: (path: string) => boolean;
16
+ }
17
+ export declare function AIModifiedPathsProvider({ children }: {
18
+ children: React.ReactNode;
19
+ }): import("react/jsx-runtime").JSX.Element;
20
+ export declare function useAIModifiedPaths(): AIModifiedPathsContextType | null;
@@ -1,6 +1,5 @@
1
- import React from "react";
2
1
  import { EntityCollection } from "@firecms/core";
3
- export declare function CollectionDetailsForm({ isNewCollection, reservedGroups, existingPaths, existingIds, groups, parentCollection, children }: {
2
+ export declare function CollectionDetailsForm({ isNewCollection, reservedGroups, existingPaths, existingIds, groups, parentCollection, expandKanban }: {
4
3
  isNewCollection: boolean;
5
4
  reservedGroups?: string[];
6
5
  existingPaths?: string[];
@@ -8,5 +7,5 @@ export declare function CollectionDetailsForm({ isNewCollection, reservedGroups,
8
7
  groups: string[] | null;
9
8
  parentCollection?: EntityCollection;
10
9
  parentCollectionIds?: string[];
11
- children?: React.ReactNode;
10
+ expandKanban?: boolean;
12
11
  }): import("react/jsx-runtime").JSX.Element;
@@ -3,6 +3,7 @@ import { Entity, EntityCollection, User } from "@firecms/core";
3
3
  import { CollectionsConfigController } from "../../types/config_controller";
4
4
  import { CollectionInference } from "../../types/collection_inference";
5
5
  import { PersistedCollection } from "../../types/persisted_collection";
6
+ import { CollectionGenerationCallback } from "../../api/generateCollectionApi";
6
7
  export interface CollectionEditorDialogProps {
7
8
  open: boolean;
8
9
  isNewCollection: boolean;
@@ -11,6 +12,11 @@ export interface CollectionEditorDialogProps {
11
12
  path?: string;
12
13
  name?: string;
13
14
  };
15
+ /**
16
+ * A collection to duplicate from. If provided, the new collection will be
17
+ * pre-populated with the same properties (but with empty name, path, and id).
18
+ */
19
+ copyFrom?: PersistedCollection;
14
20
  editedCollectionId?: string;
15
21
  fullPath?: string;
16
22
  parentCollectionIds?: string[];
@@ -28,6 +34,20 @@ export interface CollectionEditorDialogProps {
28
34
  getData?: (path: string, parentPaths: string[]) => Promise<object[]>;
29
35
  parentCollection?: PersistedCollection;
30
36
  existingEntities?: Entity<any>[];
37
+ /**
38
+ * Initial view to open when editing: "general", "display", or "properties".
39
+ * For new collections, this is ignored.
40
+ */
41
+ initialView?: "general" | "display" | "properties";
42
+ /**
43
+ * If true, auto-expand the Kanban configuration section.
44
+ */
45
+ expandKanban?: boolean;
46
+ /**
47
+ * Callback function for generating/modifying collections.
48
+ * The plugin is API-agnostic - the consumer provides the implementation.
49
+ */
50
+ generateCollection?: CollectionGenerationCallback;
31
51
  }
32
52
  export declare function CollectionEditorDialog(props: CollectionEditorDialogProps): import("react/jsx-runtime").JSX.Element;
33
53
  export declare function CollectionEditor(props: CollectionEditorDialogProps & {
@@ -1,10 +1,12 @@
1
1
  import React from "react";
2
2
  import { EntityCollection } from "@firecms/core";
3
- export declare function CollectionEditorWelcomeView({ path, parentCollection, onContinue, existingCollectionPaths }: {
3
+ import { CollectionGenerationCallback } from "../../api/generateCollectionApi";
4
+ export declare function CollectionEditorWelcomeView({ path, parentCollection, onContinue, existingCollectionPaths, generateCollection }: {
4
5
  path: string;
5
6
  parentCollection?: EntityCollection;
6
7
  onContinue: (importData?: object[], propertiesOrder?: string[]) => void;
7
8
  existingCollectionPaths?: string[];
9
+ generateCollection?: CollectionGenerationCallback;
8
10
  }): import("react/jsx-runtime").JSX.Element;
9
11
  export declare function TemplateButton({ title, subtitle, icon, onClick }: {
10
12
  title: string;
@@ -0,0 +1,7 @@
1
+ import { EntityCollection } from "@firecms/core";
2
+ export interface CollectionJsonImportDialogProps {
3
+ open: boolean;
4
+ onClose: () => void;
5
+ onImport: (collection: EntityCollection) => void;
6
+ }
7
+ export declare function CollectionJsonImportDialog({ open, onClose, onImport }: CollectionJsonImportDialogProps): import("react/jsx-runtime").JSX.Element;
@@ -1,14 +1,10 @@
1
1
  import * as Yup from "yup";
2
- export declare const YupSchema: Yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
3
- id: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
4
- name: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
5
- path: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
6
- }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
7
- id: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
8
- name: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
9
- path: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
10
- }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
11
- id: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
12
- name: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
13
- path: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
14
- }>>>;
2
+ export declare const YupSchema: Yup.ObjectSchema<{
3
+ id: string;
4
+ name: string;
5
+ path: string;
6
+ }, Yup.AnyObject, {
7
+ id: undefined;
8
+ name: undefined;
9
+ path: undefined;
10
+ }, "">;
@@ -0,0 +1,3 @@
1
+ export declare function DisplaySettingsForm({ expandKanban }: {
2
+ expandKanban?: boolean;
3
+ }): import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,5 @@
1
1
  import { PersistedCollection } from "../../types/persisted_collection";
2
- export declare function EntityActionsEditTab({ collection, }: {
2
+ export declare function EntityActionsEditTab({ collection, embedded }: {
3
3
  collection: PersistedCollection;
4
+ embedded?: boolean;
4
5
  }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,14 @@
1
+ import { EntityCollection, User } from "@firecms/core";
2
+ import { CollectionsConfigController } from "../../types/config_controller";
3
+ import { CollectionInference } from "../../types/collection_inference";
4
+ import { PersistedCollection } from "../../types/persisted_collection";
5
+ export declare function ExtendSettingsForm({ collection, parentCollection, configController, collectionInference, getUser, parentCollectionIds, isMergedCollection, onResetToCode }: {
6
+ collection: PersistedCollection;
7
+ parentCollection?: EntityCollection;
8
+ configController: CollectionsConfigController;
9
+ collectionInference?: CollectionInference;
10
+ getUser?: (uid: string) => User | null;
11
+ parentCollectionIds?: string[];
12
+ isMergedCollection?: boolean;
13
+ onResetToCode?: () => void;
14
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,7 @@
1
+ import { EntityCollection } from "@firecms/core";
2
+ export declare function GeneralSettingsForm({ isNewCollection, existingPaths, existingIds, parentCollection }: {
3
+ isNewCollection: boolean;
4
+ existingPaths?: string[];
5
+ existingIds?: string[];
6
+ parentCollection?: EntityCollection;
7
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,4 @@
1
+ export declare function KanbanConfigSection({ className, forceExpanded }: {
2
+ className?: string;
3
+ forceExpanded?: boolean;
4
+ }): import("react/jsx-runtime").JSX.Element;
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import { FormexController } from "@firecms/formex";
3
- import { Property, PropertyConfig } from "@firecms/core";
3
+ import { Properties, Property, PropertyConfig } from "@firecms/core";
4
4
  export type PropertyWithId = Property & {
5
5
  id?: string;
6
6
  };
@@ -32,6 +32,11 @@ export type PropertyFormProps = {
32
32
  getController?: (formex: FormexController<PropertyWithId>) => void;
33
33
  propertyConfigs: Record<string, PropertyConfig>;
34
34
  collectionEditable: boolean;
35
+ /**
36
+ * Collection properties for populating the conditions field selector.
37
+ * Includes nested map properties.
38
+ */
39
+ collectionProperties?: Properties;
35
40
  };
36
41
  export declare const PropertyForm: React.NamedExoticComponent<PropertyFormProps>;
37
42
  export declare function PropertyFormDialog({ open, onCancel, onOkClicked, onPropertyChanged, getData, collectionEditable, ...formProps }: PropertyFormProps & {
@@ -16,7 +16,7 @@ export declare const PropertyTree: React.MemoExoticComponent<(<M extends {
16
16
  inferredPropertyKeys?: string[];
17
17
  collectionEditable: boolean;
18
18
  }) => import("react/jsx-runtime").JSX.Element)>;
19
- export declare function PropertyTreeEntry({ id, propertyKey, namespace, propertyOrBuilder, additionalField, selectedPropertyKey, errors, onPropertyClick, onPropertyMove, onPropertyRemove, inferredPropertyKeys, collectionEditable }: {
19
+ export declare function PropertyTreeEntry({ id, propertyKey, namespace, propertyOrBuilder, additionalField, selectedPropertyKey, errors, propertiesOrder, onPropertyClick, onPropertyMove, onPropertyRemove, inferredPropertyKeys, collectionEditable }: {
20
20
  id: string;
21
21
  propertyKey: string;
22
22
  namespace?: string;
@@ -24,6 +24,7 @@ export declare function PropertyTreeEntry({ id, propertyKey, namespace, property
24
24
  additionalField?: AdditionalFieldDelegate<any>;
25
25
  selectedPropertyKey?: string;
26
26
  errors: Record<string, any>;
27
+ propertiesOrder: string[];
27
28
  onPropertyClick?: (propertyKey: string, namespace?: string) => void;
28
29
  onPropertyMove?: (propertiesOrder: string[], namespace?: string) => void;
29
30
  onPropertyRemove?: (propertyKey: string, namespace?: string) => void;
@@ -2,11 +2,12 @@ import { EntityCollection, User } from "@firecms/core";
2
2
  import { CollectionsConfigController } from "../../types/config_controller";
3
3
  import { PersistedCollection } from "../../types/persisted_collection";
4
4
  import { CollectionInference } from "../../types/collection_inference";
5
- export declare function SubcollectionsEditTab({ collection, parentCollection, configController, collectionInference, getUser, parentCollectionIds }: {
5
+ export declare function SubcollectionsEditTab({ collection, parentCollection, configController, collectionInference, getUser, parentCollectionIds, embedded }: {
6
6
  collection: PersistedCollection;
7
7
  parentCollection?: EntityCollection;
8
8
  configController: CollectionsConfigController;
9
9
  collectionInference?: CollectionInference;
10
10
  getUser?: (uid: string) => User | null;
11
11
  parentCollectionIds?: string[];
12
+ embedded?: boolean;
12
13
  }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import { ViewMode } from "@firecms/core";
2
+ export declare function ViewModeSwitch({ value, onChange, className }: {
3
+ value: ViewMode;
4
+ onChange: (value: ViewMode) => void;
5
+ className?: string;
6
+ }): import("react/jsx-runtime").JSX.Element;
@@ -1,8 +1,9 @@
1
- export declare function EnumPropertyField({ multiselect, updateIds, disabled, showErrors, allowDataInference, getData }: {
1
+ export declare function EnumPropertyField({ multiselect, updateIds, disabled, showErrors, allowDataInference, getData, propertyNamespace }: {
2
2
  multiselect: boolean;
3
3
  updateIds: boolean;
4
4
  disabled: boolean;
5
5
  showErrors: boolean;
6
6
  allowDataInference?: boolean;
7
7
  getData?: () => Promise<object[]>;
8
+ propertyNamespace?: string;
8
9
  }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,10 @@
1
+ import { Properties } from "@firecms/core";
2
+ export interface ConditionsEditorProps {
3
+ disabled: boolean;
4
+ /**
5
+ * Optional collection properties for populating the field selector.
6
+ * If not provided, a basic set of common fields is used.
7
+ */
8
+ collectionProperties?: Properties;
9
+ }
10
+ export declare function ConditionsEditor({ disabled, collectionProperties }: ConditionsEditorProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import { PropsWithChildren } from "react";
2
+ export declare function ConditionsPanel({ children }: PropsWithChildren<{}>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import { Properties } from "@firecms/core";
2
+ export interface EnumConditionsEditorProps {
3
+ disabled: boolean;
4
+ collectionProperties?: Properties;
5
+ }
6
+ export declare function EnumConditionsEditor({ disabled, collectionProperties }: EnumConditionsEditorProps): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,6 @@
1
+ export { ConditionsPanel } from "./ConditionsPanel";
2
+ export { ConditionsEditor } from "./ConditionsEditor";
3
+ export type { ConditionsEditorProps } from "./ConditionsEditor";
4
+ export { EnumConditionsEditor } from "./EnumConditionsEditor";
5
+ export type { EnumConditionsEditorProps } from "./EnumConditionsEditor";
6
+ export { getPropertyPaths, getGroupedPropertyPaths } from "./property_paths";
@@ -0,0 +1,19 @@
1
+ import { Properties } from "@firecms/core";
2
+ /**
3
+ * Recursively extract all property paths from a Properties object.
4
+ * For nested map properties, creates dot-notation paths like "address.city".
5
+ * Skips PropertyBuilder functions (callbacks) as they cannot be statically analyzed.
6
+ *
7
+ * @param properties - The properties object to extract paths from
8
+ * @param prefix - Optional prefix for nested paths (used in recursion)
9
+ * @returns Array of property path strings
10
+ */
11
+ export declare function getPropertyPaths(properties: Properties | undefined, prefix?: string): string[];
12
+ /**
13
+ * Get property paths grouped by top-level property for UI display.
14
+ * Skips PropertyBuilder functions.
15
+ *
16
+ * @param properties - The properties object
17
+ * @returns Object with top-level keys mapping to their nested paths
18
+ */
19
+ export declare function getGroupedPropertyPaths(properties: Properties | undefined): Record<string, string[]>;
@@ -4,6 +4,7 @@ import { CollectionEditorPermissionsBuilder } from "./types/config_permissions";
4
4
  import { PersistedCollection } from "./types/persisted_collection";
5
5
  import { CollectionInference } from "./types/collection_inference";
6
6
  import { CollectionsConfigController } from "./types/config_controller";
7
+ import { CollectionGenerationCallback } from "./api/generateCollectionApi";
7
8
  export interface CollectionConfigControllerProps<EC extends PersistedCollection = PersistedCollection, USER extends User = User> {
8
9
  /**
9
10
  * Firebase app where the configuration is saved.
@@ -31,6 +32,11 @@ export interface CollectionConfigControllerProps<EC extends PersistedCollection
31
32
  getUser?: (uid: string) => USER | null;
32
33
  onAnalyticsEvent?: (event: string, params?: object) => void;
33
34
  includeIntroView?: boolean;
35
+ /**
36
+ * Callback function for generating/modifying collections.
37
+ * The plugin is API-agnostic - the consumer provides the implementation.
38
+ */
39
+ generateCollection?: CollectionGenerationCallback;
34
40
  }
35
41
  /**
36
42
  * Use this hook to initialise the Collection Editor plugin.
@@ -43,5 +49,5 @@ export interface CollectionConfigControllerProps<EC extends PersistedCollection
43
49
  * @param getUser
44
50
  * @param collectionInference
45
51
  */
46
- export declare function useCollectionEditorPlugin<EC extends PersistedCollection = PersistedCollection, USER extends User = User>({ collectionConfigController, configPermissions, reservedGroups, extraView, getUser, collectionInference, getData, onAnalyticsEvent, includeIntroView, pathSuggestions }: CollectionConfigControllerProps<EC, USER>): FireCMSPlugin<any, any, PersistedCollection>;
52
+ export declare function useCollectionEditorPlugin<EC extends PersistedCollection = PersistedCollection, USER extends User = User>({ collectionConfigController, configPermissions, reservedGroups, extraView, getUser, collectionInference, getData, onAnalyticsEvent, includeIntroView, pathSuggestions, generateCollection }: CollectionConfigControllerProps<EC, USER>): FireCMSPlugin<any, any, PersistedCollection>;
47
53
  export declare function IntroWidget(): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,22 @@
1
+ import { EntityCollection } from "@firecms/core";
2
+ /**
3
+ * Validation error with path and message
4
+ */
5
+ export interface CollectionValidationError {
6
+ path: string;
7
+ message: string;
8
+ }
9
+ /**
10
+ * Result of collection JSON validation
11
+ */
12
+ export interface CollectionValidationResult {
13
+ valid: boolean;
14
+ errors: CollectionValidationError[];
15
+ collection?: EntityCollection;
16
+ }
17
+ /**
18
+ * Validates a JSON string representing a collection configuration.
19
+ * Returns detailed validation errors if the JSON is invalid or doesn't match
20
+ * the expected collection schema.
21
+ */
22
+ export declare function validateCollectionJson(jsonString: string): CollectionValidationResult;
package/package.json CHANGED
@@ -1,18 +1,18 @@
1
1
  {
2
2
  "name": "@firecms/collection_editor",
3
3
  "type": "module",
4
- "version": "3.0.0",
4
+ "version": "3.1.0-canary.1df3b2c",
5
5
  "main": "./dist/index.umd.js",
6
6
  "module": "./dist/index.es.js",
7
7
  "types": "./dist/index.d.ts",
8
8
  "source": "src/index.ts",
9
9
  "dependencies": {
10
- "@firecms/data_export": "^3.0.0",
11
- "@firecms/data_import": "^3.0.0",
12
- "@firecms/data_import_export": "^3.0.0",
13
- "@firecms/formex": "^3.0.0",
14
- "@firecms/schema_inference": "^3.0.0",
15
- "@firecms/ui": "^3.0.0",
10
+ "@firecms/data_export": "^3.1.0-canary.1df3b2c",
11
+ "@firecms/data_import": "^3.1.0-canary.1df3b2c",
12
+ "@firecms/data_import_export": "^3.1.0-canary.1df3b2c",
13
+ "@firecms/formex": "^3.1.0-canary.1df3b2c",
14
+ "@firecms/schema_inference": "^3.1.0-canary.1df3b2c",
15
+ "@firecms/ui": "^3.1.0-canary.1df3b2c",
16
16
  "json5": "^2.2.3",
17
17
  "prism-react-renderer": "^2.4.1"
18
18
  },
@@ -24,15 +24,15 @@
24
24
  },
25
25
  "exports": {
26
26
  ".": {
27
+ "types": "./dist/index.d.ts",
27
28
  "import": "./dist/index.es.js",
28
- "require": "./dist/index.umd.js",
29
- "types": "./dist/index.d.ts"
29
+ "require": "./dist/index.umd.js"
30
30
  },
31
31
  "./package.json": "./package.json"
32
32
  },
33
33
  "scripts": {
34
34
  "dev": "vite",
35
- "test": "jest",
35
+ "test": "jest --passWithNoTests",
36
36
  "build": "vite build && tsc --emitDeclarationOnly -p tsconfig.prod.json",
37
37
  "clean": "rm -rf dist && find ./src -name '*.js' -type f | xargs rm -f"
38
38
  },
@@ -69,5 +69,5 @@
69
69
  "publishConfig": {
70
70
  "access": "public"
71
71
  },
72
- "gitHead": "d106a7fde537c4330ae4ba5471c74d4536dea710"
72
+ "gitHead": "5074584b15be0d0507a4dadc148f03d82e9fe495"
73
73
  }