@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,5 @@
1
1
  import React from "react";
2
- import { Entity, EntityCollection, EntityStatus, EntityValues, ResolvedEntityCollection, User } from "../types";
3
- import { ValidationError } from "yup";
2
+ import { Entity, EntityCollection, EntityStatus, User } from "../types";
4
3
  export type OnUpdateParams = {
5
4
  entity: Entity<any>;
6
5
  status: EntityStatus;
@@ -33,22 +32,12 @@ export interface EntityEditViewProps<M extends Record<string, any>> {
33
32
  /**
34
33
  * This is the default view that is used as the content of a side panel when
35
34
  * an entity is opened.
36
- * You probably don't want to use this view directly since it is bound to the
37
- * side panel.
38
35
  */
39
36
  export declare function EntityEditView<M extends Record<string, any>, USER extends User>({ entityId, ...props }: EntityEditViewProps<M>): import("react/jsx-runtime").JSX.Element;
40
- export declare function EntityEditViewInner<M extends Record<string, any>>({ path, entityId: entityIdProp, selectedTab: selectedTabProp, copy, collection, parentCollectionIds, onValuesModified, onSaved, onClose, onTabChange, entity, cachedDirtyValues, dataLoading, layout, barActions }: EntityEditViewProps<M> & {
37
+ export declare function EntityEditViewInner<M extends Record<string, any>>({ path, entityId, selectedTab: selectedTabProp, copy, collection, parentCollectionIds, onValuesModified, onSaved, onClose, onTabChange, entity, cachedDirtyValues, dataLoading, layout, barActions, status, setStatus, }: EntityEditViewProps<M> & {
41
38
  entity?: Entity<M>;
42
39
  cachedDirtyValues?: Partial<M>;
43
40
  dataLoading: boolean;
41
+ status: EntityStatus;
42
+ setStatus: (status: EntityStatus) => void;
44
43
  }): import("react/jsx-runtime").JSX.Element;
45
- export type EntityFormSaveParams<M extends Record<string, any>> = {
46
- collection: ResolvedEntityCollection<M>;
47
- path: string;
48
- entityId: string | undefined;
49
- values: EntityValues<M>;
50
- previousValues?: EntityValues<M>;
51
- closeAfterSave: boolean;
52
- autoSave: boolean;
53
- };
54
- export declare function yupToFormErrors(yupError: ValidationError): Record<string, any>;
@@ -0,0 +1,43 @@
1
+ import React from "react";
2
+ import { Entity, EntityCollection, EntityStatus, FormContext } from "../types";
3
+ import { FormexController } from "@firecms/formex";
4
+ import { ValidationError } from "yup";
5
+ export type OnUpdateParams = {
6
+ entity: Entity<any>;
7
+ status: EntityStatus;
8
+ path: string;
9
+ entityId?: string;
10
+ selectedTab?: string;
11
+ collection: EntityCollection<any>;
12
+ };
13
+ type EntityFormProps<M extends Record<string, any>> = {
14
+ path: string;
15
+ collection: EntityCollection<M>;
16
+ entityId?: string;
17
+ entity?: Entity<M>;
18
+ databaseId?: string;
19
+ onIdChange?: (id: string) => void;
20
+ onValuesModified?: (modified: boolean) => void;
21
+ onSaved?: (params: OnUpdateParams) => void;
22
+ onClose?: () => void;
23
+ cachedDirtyValues?: Partial<M>;
24
+ onFormContextReady?: (formContext: FormContext) => void;
25
+ forceActionsAtTheBottom?: boolean;
26
+ initialStatus: EntityStatus;
27
+ className?: string;
28
+ onStatusChange?: (status: EntityStatus) => void;
29
+ onEntityChange?: (entity: Entity<M>) => void;
30
+ formex?: FormexController<M>;
31
+ openEntityMode?: "side_panel" | "full_screen";
32
+ };
33
+ export declare function EntityForm<M extends Record<string, any>>({ path, entityId: entityIdProp, collection, onValuesModified, onIdChange, onSaved, onClose, entity, cachedDirtyValues, onFormContextReady, forceActionsAtTheBottom, initialStatus, className, onStatusChange, onEntityChange, openEntityMode, formex: formexProp }: EntityFormProps<M>): import("react/jsx-runtime").JSX.Element;
34
+ export declare function yupToFormErrors(yupError: ValidationError): Record<string, any>;
35
+ export declare function FormLayoutInner<M extends object>({ id, formContext, children, className, forceActionsAtTheBottom, pluginActions }: {
36
+ id?: string;
37
+ formContext: FormContext;
38
+ children: React.ReactNode;
39
+ className?: string;
40
+ forceActionsAtTheBottom?: boolean;
41
+ pluginActions?: React.ReactNode[];
42
+ }): import("react/jsx-runtime").JSX.Element;
43
+ export {};
@@ -0,0 +1,6 @@
1
+ import React from "react";
2
+ export declare function FormEntry({ propertyKey, widthPercentage, children }: {
3
+ propertyKey: string;
4
+ widthPercentage?: number;
5
+ children: React.ReactNode;
6
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,5 @@
1
+ import React from "react";
2
+ export declare function FormLayout({ children, className }: {
3
+ children: React.ReactNode;
4
+ className?: string;
5
+ }): import("react/jsx-runtime").JSX.Element;
@@ -1,3 +1,5 @@
1
1
  export * from "./FieldHelperText";
2
2
  export * from "./LabelWithIcon";
3
3
  export * from "./LabelWithIconAndTooltip";
4
+ export * from "./FormEntry";
5
+ export * from "./FormLayout";
@@ -6,4 +6,4 @@ import { FieldProps } from "../../types";
6
6
  * and tables to the specified properties.
7
7
  * @group Form fields
8
8
  */
9
- export declare function ArrayCustomShapedFieldBinding<T extends Array<any>>({ propertyKey, value, error, showError, isSubmitting, setValue, minimalistView: minimalistViewProp, property, includeDescription, underlyingValueHasChanged, context, disabled }: FieldProps<T, any, any>): import("react/jsx-runtime").JSX.Element;
9
+ export declare function ArrayCustomShapedFieldBinding<T extends Array<any>>({ propertyKey, value, error, showError, isSubmitting, setValue, minimalistView: minimalistViewProp, property, includeDescription, context, disabled }: FieldProps<T, any, any>): import("react/jsx-runtime").JSX.Element;
@@ -6,4 +6,4 @@ import { FieldProps } from "../../types";
6
6
  * and tables to the specified properties.
7
7
  * @group Form fields
8
8
  */
9
- export declare function MapFieldBinding({ propertyKey, value, showError, error, disabled, property, minimalistView: minimalistViewProp, includeDescription, underlyingValueHasChanged, autoFocus, context, onPropertyChange }: FieldProps<Record<string, any>>): import("react/jsx-runtime").JSX.Element;
9
+ export declare function MapFieldBinding({ propertyKey, value, showError, error, disabled, property, minimalistView: minimalistViewProp, includeDescription, autoFocus, context, onPropertyChange }: FieldProps<Record<string, any>>): import("react/jsx-runtime").JSX.Element;
@@ -7,5 +7,5 @@ interface MarkdownEditorFieldProps {
7
7
  };
8
8
  editorProps?: Partial<FireCMSEditorProps>;
9
9
  }
10
- export declare function MarkdownEditorFieldBinding({ property, propertyKey, value, setValue, includeDescription, showError, error, minimalistView, isSubmitting, context, customProps, }: FieldProps<string, MarkdownEditorFieldProps>): import("react/jsx-runtime").JSX.Element;
10
+ export declare function MarkdownEditorFieldBinding({ property, propertyKey, value, setValue, includeDescription, showError, error, minimalistView, disabled: disabledProp, isSubmitting, context, customProps, }: FieldProps<string, MarkdownEditorFieldProps>): import("react/jsx-runtime").JSX.Element;
11
11
  export {};