@firecms/core 3.0.0-canary.186 → 3.0.0-canary.188

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 (37) hide show
  1. package/dist/core/EntityEditView.d.ts +4 -15
  2. package/dist/core/EntityForm.d.ts +43 -0
  3. package/dist/form/components/FormEntry.d.ts +6 -0
  4. package/dist/form/components/FormLayout.d.ts +5 -0
  5. package/dist/form/components/index.d.ts +2 -0
  6. package/dist/form/field_bindings/ArrayCustomShapedFieldBinding.d.ts +1 -1
  7. package/dist/form/field_bindings/MapFieldBinding.d.ts +1 -1
  8. package/dist/form/field_bindings/MarkdownEditorFieldBinding.d.ts +1 -1
  9. package/dist/index.es.js +12124 -11823
  10. package/dist/index.es.js.map +1 -1
  11. package/dist/index.umd.js +12100 -11799
  12. package/dist/index.umd.js.map +1 -1
  13. package/dist/types/fields.d.ts +11 -0
  14. package/dist/types/navigation.d.ts +1 -0
  15. package/dist/types/plugins.d.ts +1 -1
  16. package/dist/types/properties.d.ts +1 -1
  17. package/package.json +5 -5
  18. package/src/components/EntityCollectionTable/internal/popup_field/PopupFormField.tsx +4 -2
  19. package/src/core/EntityEditView.tsx +210 -1049
  20. package/src/core/EntityForm.tsx +956 -0
  21. package/src/core/NavigationRoutes.tsx +16 -12
  22. package/src/form/components/FormEntry.tsx +22 -0
  23. package/src/form/components/FormLayout.tsx +16 -0
  24. package/src/form/components/StorageUploadProgress.tsx +1 -1
  25. package/src/form/components/index.tsx +2 -0
  26. package/src/form/field_bindings/ArrayCustomShapedFieldBinding.tsx +0 -2
  27. package/src/form/field_bindings/MapFieldBinding.tsx +0 -2
  28. package/src/form/field_bindings/MarkdownEditorFieldBinding.tsx +8 -5
  29. package/src/form/field_bindings/StorageUploadFieldBinding.tsx +5 -3
  30. package/src/preview/components/UrlComponentPreview.tsx +17 -18
  31. package/src/routes/FireCMSRoute.tsx +7 -2
  32. package/src/types/fields.tsx +16 -0
  33. package/src/types/navigation.ts +1 -0
  34. package/src/types/plugins.tsx +1 -1
  35. package/src/types/properties.ts +1 -1
  36. package/src/util/entity_cache.ts +9 -1
  37. package/src/util/useStorageUploadController.tsx +39 -21
@@ -1,6 +1,7 @@
1
1
  import { CMSType, Property, PropertyOrBuilder } from "./properties";
2
2
  import { ResolvedEntityCollection, ResolvedProperty } from "./resolved_entities";
3
3
  import { FormexController } from "@firecms/formex";
4
+ import { Entity } from "./entities";
4
5
  /**
5
6
  * When building a custom field you need to create a React component that takes
6
7
  * this interface as props.
@@ -132,6 +133,16 @@ export interface FormContext<M extends Record<string, any> = any> {
132
133
  * Path this entity is located at
133
134
  */
134
135
  path?: string;
136
+ status: "new" | "existing" | "copy";
137
+ entity?: Entity<M>;
138
+ savingError?: Error;
139
+ openEntityMode: "side_panel" | "full_screen";
140
+ /**
141
+ * If pending close is set to true, the form will close when the user
142
+ * saves the entity
143
+ * @param pendingClose
144
+ */
145
+ setPendingClose?: (pendingClose: boolean) => void;
135
146
  /**
136
147
  * This is the underlying formex controller that powers the form
137
148
  */
@@ -4,6 +4,7 @@ import { EntityReference } from "./entities";
4
4
  /**
5
5
  * Controller that includes the resolved navigation and utility methods and
6
6
  * attributes.
7
+ * This controller holds the state of the navigation including the collections.
7
8
  * @group Models
8
9
  */
9
10
  export type NavigationController<EC extends EntityCollection = EntityCollection<any>> = {
@@ -162,7 +162,7 @@ export interface PluginFormActionProps<USER extends User = User, EC extends Enti
162
162
  formContext?: FormContext<any>;
163
163
  context: FireCMSContext<USER>;
164
164
  currentEntityId?: string;
165
- layout: "side_panel" | "full_screen";
165
+ openEntityMode: "side_panel" | "full_screen";
166
166
  }
167
167
  export type PluginFieldBuilderParams<T extends CMSType = CMSType, M extends Record<string, any> = any, EC extends EntityCollection<M> = EntityCollection<M>> = {
168
168
  fieldConfigId: string;
@@ -283,7 +283,7 @@ export interface StringProperty extends BaseProperty<string> {
283
283
  enumValues?: EnumValues;
284
284
  /**
285
285
  * You can specify a `Storage` configuration. It is used to
286
- * indicate that this string refers to a path in Google Cloud Storage.
286
+ * indicate that this string refers to a path in your storage provider.
287
287
  */
288
288
  storage?: StorageConfig;
289
289
  /**
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@firecms/core",
3
3
  "type": "module",
4
- "version": "3.0.0-canary.186",
4
+ "version": "3.0.0-canary.188",
5
5
  "description": "Awesome Firebase/Firestore-based headless open-source CMS",
6
6
  "funding": {
7
7
  "url": "https://github.com/sponsors/firecmsco"
@@ -50,9 +50,9 @@
50
50
  "./package.json": "./package.json"
51
51
  },
52
52
  "dependencies": {
53
- "@firecms/editor": "^3.0.0-canary.186",
54
- "@firecms/formex": "^3.0.0-canary.186",
55
- "@firecms/ui": "^3.0.0-canary.186",
53
+ "@firecms/editor": "^3.0.0-canary.188",
54
+ "@firecms/formex": "^3.0.0-canary.188",
55
+ "@firecms/ui": "^3.0.0-canary.188",
56
56
  "@hello-pangea/dnd": "^17.0.0",
57
57
  "@radix-ui/react-portal": "^1.1.3",
58
58
  "clsx": "^2.1.1",
@@ -104,7 +104,7 @@
104
104
  "dist",
105
105
  "src"
106
106
  ],
107
- "gitHead": "968beff28cddecbacc6740dc5e75288bf423746e",
107
+ "gitHead": "12b6a7c4cb3e88d900d169f4903cc8fbfb7c08ba",
108
108
  "publishConfig": {
109
109
  "access": "public"
110
110
  },
@@ -23,7 +23,7 @@ import { Button, CloseIcon, DialogActions, IconButton, Typography } from "@firec
23
23
  import { PropertyFieldBinding } from "../../../../form";
24
24
  import { useCustomizationController, useDataSource, useFireCMSContext } from "../../../../hooks";
25
25
  import { OnCellValueChangeParams } from "../../../common";
26
- import { yupToFormErrors } from "../../../../core/EntityEditView";
26
+ import { yupToFormErrors } from "../../../../core/EntityForm";
27
27
 
28
28
  interface PopupFormFieldProps<M extends Record<string, any>> {
29
29
  customFieldValidator?: CustomFieldValidator;
@@ -278,7 +278,9 @@ export function PopupFormFieldInternal<M extends Record<string, any>>({
278
278
  path,
279
279
  setFieldValue,
280
280
  save: saveValue,
281
- formex
281
+ formex,
282
+ status: "existing",
283
+ openEntityMode: "side_panel",
282
284
  };
283
285
 
284
286
  const property: ResolvedProperty<any> | undefined = propertyKey && getPropertyInPath(collection?.properties ?? {} as ResolvedProperties, propertyKey as string);