@firecms/core 3.0.0-beta.6 → 3.0.0-beta.8

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 (185) hide show
  1. package/dist/app/AppBar.d.ts +12 -0
  2. package/dist/app/Drawer.d.ts +17 -0
  3. package/dist/app/Scaffold.d.ts +30 -0
  4. package/dist/app/index.d.ts +4 -0
  5. package/dist/app/useApp.d.ts +16 -0
  6. package/dist/components/EntityCollectionTable/EntityCollectionTable.d.ts +1 -1
  7. package/dist/components/EntityCollectionTable/EntityCollectionTableProps.d.ts +4 -2
  8. package/dist/components/EntityCollectionTable/PropertyTableCell.d.ts +1 -0
  9. package/dist/components/EntityCollectionTable/column_utils.d.ts +1 -2
  10. package/dist/components/EntityCollectionTable/fields/TableReferenceField.d.ts +2 -0
  11. package/dist/components/EntityCollectionTable/internal/EntityTableCell.d.ts +2 -2
  12. package/dist/components/EntityCollectionTable/internal/popup_field/PopupFormField.d.ts +1 -1
  13. package/dist/components/EntityPreview.d.ts +3 -2
  14. package/dist/components/ReferenceWidget.d.ts +3 -1
  15. package/dist/components/SelectableTable/filters/ReferenceFilterField.d.ts +2 -1
  16. package/dist/components/VirtualTable/VirtualTableProps.d.ts +5 -6
  17. package/dist/components/VirtualTable/types.d.ts +3 -3
  18. package/dist/components/{EntityCollectionTable/internal → common}/default_entity_actions.d.ts +1 -1
  19. package/dist/components/common/index.d.ts +1 -0
  20. package/dist/components/common/table_height.d.ts +5 -0
  21. package/dist/components/common/types.d.ts +3 -5
  22. package/dist/components/common/useDataSourceEntityCollectionTableController.d.ts +3 -0
  23. package/dist/components/index.d.ts +2 -1
  24. package/dist/{components/FireCMSAppBar.d.ts → core/DefaultAppBar.d.ts} +5 -8
  25. package/dist/core/DefaultDrawer.d.ts +19 -0
  26. package/dist/core/DrawerNavigationItem.d.ts +9 -0
  27. package/dist/core/EntityEditView.d.ts +17 -3
  28. package/dist/core/NavigationRoutes.d.ts +2 -2
  29. package/dist/core/index.d.ts +3 -4
  30. package/dist/form/PropertiesForm.d.ts +8 -0
  31. package/dist/form/components/FieldHelperText.d.ts +3 -3
  32. package/dist/form/components/StorageItemPreview.d.ts +4 -4
  33. package/dist/form/field_bindings/MapFieldBinding.d.ts +1 -1
  34. package/dist/form/field_bindings/StorageUploadFieldBinding.d.ts +2 -4
  35. package/dist/form/index.d.ts +0 -2
  36. package/dist/hooks/data/save.d.ts +1 -2
  37. package/dist/hooks/index.d.ts +1 -0
  38. package/dist/index.d.ts +1 -0
  39. package/dist/index.es.js +10199 -10140
  40. package/dist/index.es.js.map +1 -1
  41. package/dist/index.umd.js +5 -5
  42. package/dist/index.umd.js.map +1 -1
  43. package/dist/preview/PropertyPreviewProps.d.ts +5 -0
  44. package/dist/preview/components/ReferencePreview.d.ts +2 -1
  45. package/dist/preview/components/StorageThumbnail.d.ts +2 -1
  46. package/dist/preview/components/UrlComponentPreview.d.ts +2 -1
  47. package/dist/types/auth.d.ts +1 -1
  48. package/dist/types/collections.d.ts +22 -1
  49. package/dist/types/datasource.d.ts +18 -8
  50. package/dist/types/entity_actions.d.ts +14 -0
  51. package/dist/types/fields.d.ts +31 -30
  52. package/dist/types/navigation.d.ts +2 -2
  53. package/dist/types/plugins.d.ts +11 -3
  54. package/dist/types/properties.d.ts +15 -2
  55. package/dist/util/icon_synonyms.d.ts +1 -97
  56. package/dist/util/icons.d.ts +2 -2
  57. package/dist/util/objects.d.ts +1 -1
  58. package/dist/util/resolutions.d.ts +8 -8
  59. package/dist/util/storage.d.ts +23 -2
  60. package/dist/util/useStorageUploadController.d.ts +1 -1
  61. package/package.json +130 -122
  62. package/src/app/AppBar.tsx +18 -0
  63. package/src/app/Drawer.tsx +25 -0
  64. package/src/app/Scaffold.tsx +249 -0
  65. package/src/app/index.ts +4 -0
  66. package/src/app/useApp.tsx +32 -0
  67. package/src/components/EntityCollectionTable/EntityCollectionRowActions.tsx +8 -10
  68. package/src/components/EntityCollectionTable/EntityCollectionTable.tsx +9 -7
  69. package/src/components/EntityCollectionTable/EntityCollectionTableProps.tsx +9 -5
  70. package/src/components/EntityCollectionTable/PropertyTableCell.tsx +22 -15
  71. package/src/components/EntityCollectionTable/column_utils.tsx +3 -3
  72. package/src/components/EntityCollectionTable/fields/TableReferenceField.tsx +9 -1
  73. package/src/components/EntityCollectionTable/fields/TableStorageUpload.tsx +2 -2
  74. package/src/components/EntityCollectionTable/internal/CollectionTableToolbar.tsx +2 -2
  75. package/src/components/EntityCollectionTable/internal/EntityTableCell.tsx +5 -6
  76. package/src/components/EntityCollectionTable/internal/popup_field/PopupFormField.tsx +4 -5
  77. package/src/components/EntityCollectionView/EntityCollectionView.tsx +26 -24
  78. package/src/components/EntityPreview.tsx +9 -7
  79. package/src/components/EntityView.tsx +4 -4
  80. package/src/components/HomePage/NavigationCard.tsx +2 -2
  81. package/src/components/HomePage/SmallNavigationCard.tsx +5 -5
  82. package/src/components/PropertyIdCopyTooltipContent.tsx +2 -3
  83. package/src/components/ReferenceTable/ReferenceSelectionTable.tsx +1 -0
  84. package/src/components/ReferenceWidget.tsx +21 -11
  85. package/src/components/SearchIconsView.tsx +5 -5
  86. package/src/components/SelectableTable/SelectableTable.tsx +4 -2
  87. package/src/components/SelectableTable/filters/ReferenceFilterField.tsx +4 -1
  88. package/src/components/VirtualTable/VirtualTable.tsx +13 -12
  89. package/src/components/VirtualTable/VirtualTableHeader.tsx +4 -4
  90. package/src/components/VirtualTable/VirtualTableHeaderRow.tsx +2 -2
  91. package/src/components/VirtualTable/VirtualTableProps.tsx +6 -6
  92. package/src/components/VirtualTable/VirtualTableRow.tsx +4 -5
  93. package/src/components/VirtualTable/types.tsx +2 -3
  94. package/src/components/{EntityCollectionTable/internal → common}/default_entity_actions.tsx +2 -2
  95. package/src/components/common/index.ts +1 -0
  96. package/src/components/{VirtualTable/common.tsx → common/table_height.tsx} +5 -2
  97. package/src/components/common/types.tsx +3 -5
  98. package/src/components/common/useColumnsIds.tsx +10 -2
  99. package/src/components/common/useDataSourceEntityCollectionTableController.tsx +11 -0
  100. package/src/components/common/useTableSearchHelper.ts +52 -12
  101. package/src/components/index.tsx +2 -1
  102. package/src/contexts/DialogsProvider.tsx +2 -2
  103. package/src/{components/FireCMSAppBar.tsx → core/DefaultAppBar.tsx} +51 -36
  104. package/src/core/DefaultDrawer.tsx +177 -0
  105. package/src/core/DrawerNavigationItem.tsx +62 -0
  106. package/src/core/EntityEditView.tsx +673 -134
  107. package/src/core/EntitySidePanel.tsx +1 -2
  108. package/src/core/FireCMS.tsx +36 -40
  109. package/src/core/NavigationRoutes.tsx +6 -7
  110. package/src/core/field_configs.tsx +1 -1
  111. package/src/core/index.tsx +3 -4
  112. package/src/form/PropertiesForm.tsx +81 -0
  113. package/src/form/PropertyFieldBinding.tsx +29 -7
  114. package/src/form/components/FieldHelperText.tsx +3 -3
  115. package/src/form/components/StorageItemPreview.tsx +20 -11
  116. package/src/form/components/StorageUploadProgress.tsx +3 -3
  117. package/src/form/field_bindings/ArrayCustomShapedFieldBinding.tsx +8 -5
  118. package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +8 -5
  119. package/src/form/field_bindings/BlockFieldBinding.tsx +2 -2
  120. package/src/form/field_bindings/KeyValueFieldBinding.tsx +44 -39
  121. package/src/form/field_bindings/MapFieldBinding.tsx +11 -3
  122. package/src/form/field_bindings/MarkdownFieldBinding.tsx +2 -2
  123. package/src/form/field_bindings/ReadOnlyFieldBinding.tsx +2 -9
  124. package/src/form/field_bindings/ReferenceFieldBinding.tsx +15 -13
  125. package/src/form/field_bindings/RepeatFieldBinding.tsx +10 -7
  126. package/src/form/field_bindings/SelectFieldBinding.tsx +3 -3
  127. package/src/form/field_bindings/StorageUploadFieldBinding.tsx +10 -39
  128. package/src/form/field_bindings/SwitchFieldBinding.tsx +1 -1
  129. package/src/form/index.tsx +4 -4
  130. package/src/form/validation.ts +1 -17
  131. package/src/hooks/data/save.ts +2 -1
  132. package/src/hooks/index.tsx +1 -0
  133. package/src/hooks/useBuildLocalConfigurationPersistence.tsx +2 -3
  134. package/src/hooks/useBuildNavigationController.tsx +1 -2
  135. package/src/hooks/useResolvedNavigationFrom.tsx +1 -1
  136. package/src/hooks/useValidateAuthenticator.tsx +15 -15
  137. package/src/index.ts +1 -0
  138. package/src/internal/useBuildDataSource.ts +12 -0
  139. package/src/internal/useBuildSideEntityController.tsx +72 -11
  140. package/src/preview/PropertyPreview.tsx +7 -4
  141. package/src/preview/PropertyPreviewProps.tsx +6 -0
  142. package/src/preview/components/BooleanPreview.tsx +2 -2
  143. package/src/preview/components/EnumValuesChip.tsx +1 -1
  144. package/src/preview/components/ImagePreview.tsx +21 -33
  145. package/src/preview/components/ReferencePreview.tsx +22 -22
  146. package/src/preview/components/StorageThumbnail.tsx +5 -1
  147. package/src/preview/components/UrlComponentPreview.tsx +44 -11
  148. package/src/preview/property_previews/ArrayOfMapsPreview.tsx +0 -1
  149. package/src/preview/property_previews/ArrayOfReferencesPreview.tsx +2 -1
  150. package/src/preview/property_previews/ArrayOfStorageComponentsPreview.tsx +0 -1
  151. package/src/preview/property_previews/ArrayOfStringsPreview.tsx +0 -1
  152. package/src/preview/property_previews/ArrayOneOfPreview.tsx +2 -3
  153. package/src/preview/property_previews/ArrayPropertyPreview.tsx +2 -3
  154. package/src/preview/property_previews/MapPropertyPreview.tsx +5 -5
  155. package/src/preview/property_previews/StringPropertyPreview.tsx +2 -2
  156. package/src/types/auth.tsx +1 -1
  157. package/src/types/collections.ts +28 -2
  158. package/src/types/customization_controller.tsx +0 -1
  159. package/src/types/datasource.ts +20 -16
  160. package/src/types/entity_actions.tsx +16 -3
  161. package/src/types/fields.tsx +33 -33
  162. package/src/types/navigation.ts +1 -2
  163. package/src/types/plugins.tsx +12 -3
  164. package/src/types/properties.ts +17 -2
  165. package/src/types/storage.ts +1 -1
  166. package/src/util/entities.ts +4 -3
  167. package/src/util/enums.ts +1 -1
  168. package/src/util/icon_list.ts +2 -2
  169. package/src/util/icon_synonyms.ts +3 -99
  170. package/src/util/objects.ts +25 -28
  171. package/src/util/permissions.ts +1 -0
  172. package/src/util/resolutions.ts +32 -31
  173. package/src/util/storage.ts +75 -21
  174. package/src/util/useStorageUploadController.tsx +21 -3
  175. package/dist/components/VirtualTable/common.d.ts +0 -2
  176. package/dist/core/Drawer.d.ts +0 -23
  177. package/dist/core/Scaffold.d.ts +0 -55
  178. package/dist/core/SideEntityView.d.ts +0 -7
  179. package/dist/form/EntityForm.d.ts +0 -77
  180. package/dist/internal/useBuildCustomizationController.d.ts +0 -2
  181. package/src/core/Drawer.tsx +0 -191
  182. package/src/core/Scaffold.tsx +0 -281
  183. package/src/core/SideEntityView.tsx +0 -38
  184. package/src/form/EntityForm.tsx +0 -728
  185. package/src/internal/useBuildCustomizationController.tsx +0 -5
@@ -37,4 +37,9 @@ export interface PropertyPreviewProps<T extends CMSType = any, CustomProps = any
37
37
  * Additional properties set by the developer
38
38
  */
39
39
  customProps?: CustomProps;
40
+ /**
41
+ * If the preview should be interactive or not.
42
+ * This applies only to videos.
43
+ */
44
+ interactive?: boolean;
40
45
  }
@@ -8,7 +8,8 @@ export type ReferencePreviewProps = {
8
8
  previewProperties?: string[];
9
9
  onClick?: (e: React.SyntheticEvent) => void;
10
10
  hover?: boolean;
11
- allowEntityNavigation?: boolean;
11
+ includeEntityLink?: boolean;
12
+ includeId?: boolean;
12
13
  };
13
14
  /**
14
15
  * @group Preview components
@@ -4,10 +4,11 @@ type StorageThumbnailProps = {
4
4
  storagePathOrDownloadUrl: string;
5
5
  storeUrl: boolean;
6
6
  size: PreviewSize;
7
+ interactive?: boolean;
7
8
  };
8
9
  /**
9
10
  * @group Preview components
10
11
  */
11
12
  export declare const StorageThumbnail: React.FunctionComponent<StorageThumbnailProps>;
12
- export declare function StorageThumbnailInternal({ storeUrl, storagePathOrDownloadUrl, size }: StorageThumbnailProps): import("react/jsx-runtime").JSX.Element | null;
13
+ export declare function StorageThumbnailInternal({ storeUrl, interactive, storagePathOrDownloadUrl, size }: StorageThumbnailProps): import("react/jsx-runtime").JSX.Element | null;
13
14
  export {};
@@ -4,9 +4,10 @@ import { PreviewSize } from "../PropertyPreviewProps";
4
4
  /**
5
5
  * @group Preview components
6
6
  */
7
- export declare function UrlComponentPreview({ url, previewType, size, hint }: {
7
+ export declare function UrlComponentPreview({ url, previewType, size, hint, interactive }: {
8
8
  url: string;
9
9
  previewType?: PreviewType;
10
10
  size: PreviewSize;
11
11
  hint?: string;
12
+ interactive?: boolean;
12
13
  }): React.ReactElement;
@@ -32,7 +32,7 @@ export type AuthController<UserType extends User = any, ExtraData extends any =
32
32
  /**
33
33
  * Sign out
34
34
  */
35
- signOut: () => void;
35
+ signOut: () => Promise<void>;
36
36
  /**
37
37
  * Error initializing the authentication
38
38
  */
@@ -99,7 +99,7 @@ export interface EntityCollection<M extends Record<string, any> = any, UserType
99
99
  * `hidden` in the property definition,will be ignored.
100
100
  * `propertiesOrder` has precedence over `hidden`.
101
101
  */
102
- propertiesOrder?: Extract<keyof M, string>[];
102
+ propertiesOrder?: (Extract<keyof M, string> | `subcollection:${string}`)[];
103
103
  /**
104
104
  * If enabled, content is loaded in batches. If `false` all entities in the
105
105
  * collection are loaded.
@@ -257,7 +257,14 @@ export interface EntityCollection<M extends Record<string, any> = any, UserType
257
257
  * are writing custom code
258
258
  */
259
259
  ownerId?: string;
260
+ /**
261
+ * Overrides for the entity view, like the data source or the storage source.
262
+ */
260
263
  overrides?: EntityOverrides;
264
+ /**
265
+ * Width of the side dialog (in pixels) when opening an entity in this collection.
266
+ */
267
+ sideDialogWidth?: number | string;
261
268
  }
262
269
  /**
263
270
  * Parameter passed to the `Actions` prop in the collection configuration.
@@ -395,8 +402,22 @@ export interface AdditionalFieldDelegate<M extends Record<string, any> = any, Us
395
402
  * @group Models
396
403
  */
397
404
  export type EntityCustomView<M extends Record<string, any> = any> = {
405
+ /**
406
+ * Key of this custom view.
407
+ */
398
408
  key: string;
409
+ /**
410
+ * Name of this custom view.
411
+ */
399
412
  name: string;
413
+ /**
414
+ * If set to true, the actions of the entity will be included in the
415
+ * bottom of the panel (save buttons, delete buttons, etc.)
416
+ */
417
+ includeActions?: boolean;
418
+ /**
419
+ * Builder for rendering the custom view
420
+ */
400
421
  Builder?: React.ComponentType<EntityCustomViewParams<M>>;
401
422
  };
402
423
  /**
@@ -1,6 +1,7 @@
1
1
  import { Entity, EntityStatus, EntityValues } from "./entities";
2
2
  import { EntityCollection, FilterValues } from "./collections";
3
3
  import { ResolvedEntityCollection } from "./resolved_entities";
4
+ import { FireCMSContext } from "./firecms_context";
4
5
  /**
5
6
  * @group Datasource
6
7
  */
@@ -145,6 +146,17 @@ export interface DataSource {
145
146
  * @param props
146
147
  */
147
148
  isFilterCombinationValid?(props: FilterCombinationValidProps): boolean;
149
+ /**
150
+ * Called when the user clicks on the search bar in a collection view.
151
+ * Useful for initializing a text search index.
152
+ * @param props
153
+ */
154
+ initTextSearch?: (props: {
155
+ context: FireCMSContext;
156
+ path: string;
157
+ collection: EntityCollection;
158
+ parentCollectionIds?: string[];
159
+ }) => Promise<boolean>;
148
160
  }
149
161
  export type FilterCombinationValidProps = {
150
162
  path: string;
@@ -241,14 +253,6 @@ export interface DataSourceDelegate {
241
253
  * @param props
242
254
  */
243
255
  isFilterCombinationValid?(props: Omit<FilterCombinationValidProps, "collection">): boolean;
244
- /**
245
- * Convert a FireCMS reference to a reference that can be used by the datasource
246
- * @param reference
247
- */
248
- /**
249
- * Convert a FireCMS GeoPoint to a GeoPoint that can be used by the datasource
250
- * @param geoPoint
251
- */
252
256
  /**
253
257
  * Get the object to generate the current time in the datasource
254
258
  */
@@ -256,4 +260,10 @@ export interface DataSourceDelegate {
256
260
  delegateToCMSModel: (data: any) => any;
257
261
  cmsToDelegateModel: (data: any) => any;
258
262
  setDateToMidnight: (input?: any) => any;
263
+ initTextSearch?: (props: {
264
+ context: FireCMSContext;
265
+ path: string;
266
+ collection: EntityCollection;
267
+ parentCollectionIds?: string[];
268
+ }) => Promise<boolean>;
259
269
  }
@@ -4,9 +4,23 @@ import { Entity } from "./entities";
4
4
  import { EntityCollection, SelectionController } from "./collections";
5
5
  import { User } from "./user";
6
6
  import { SideEntityController } from "./side_entity_controller";
7
+ /**
8
+ * An entity action is a custom action that can be performed on an entity.
9
+ * They are displayed in the entity view and in the collection view.
10
+ */
7
11
  export type EntityAction<M extends object = any, UserType extends User = User> = {
12
+ /**
13
+ * Title of the action
14
+ */
8
15
  name: string;
16
+ /**
17
+ * Icon of the action
18
+ */
9
19
  icon?: React.ReactElement;
20
+ /**
21
+ * Callback when the action is clicked
22
+ * @param props
23
+ */
10
24
  onClick: (props: EntityActionClickProps<M, UserType>) => Promise<void> | void;
11
25
  /**
12
26
  * Show this action collapsed in the menu of the collection view.
@@ -1,6 +1,6 @@
1
- import { EntityValues } from "./entities";
2
1
  import { CMSType, PropertyOrBuilder } from "./properties";
3
2
  import { ResolvedEntityCollection, ResolvedProperty } from "./resolved_entities";
3
+ import { FormexController } from "@firecms/formex";
4
4
  /**
5
5
  * When building a custom field you need to create a React component that takes
6
6
  * this interface as props.
@@ -17,9 +17,6 @@ export interface FieldProps<T extends CMSType = any, CustomProps = any, M extend
17
17
  * Current value of this field
18
18
  */
19
19
  value: T;
20
- /**
21
- * Initial value of this field
22
- */
23
20
  /**
24
21
  * Set value of field directly
25
22
  */
@@ -34,24 +31,24 @@ export interface FieldProps<T extends CMSType = any, CustomProps = any, M extend
34
31
  /**
35
32
  * Is the form currently submitting
36
33
  */
37
- isSubmitting: boolean;
34
+ isSubmitting?: boolean;
38
35
  /**
39
36
  * Should this field show the error indicator.
40
37
  * Note that there might be an error (like an empty field that should be
41
38
  * filled) but we don't want to show the error until the user has tried
42
39
  * saving.
43
40
  */
44
- showError: boolean;
41
+ showError?: boolean;
45
42
  /**
46
43
  * Is there an error in this field. The error field has the same shape as
47
44
  * the field, replacing values with a string containing the error.
48
45
  * It takes the value `null` if there is no error
49
46
  */
50
- error: any | null;
47
+ error?: any | null;
51
48
  /**
52
49
  * Has this field been touched
53
50
  */
54
- touched: boolean;
51
+ touched?: boolean;
55
52
  /**
56
53
  * Property related to this field
57
54
  */
@@ -59,32 +56,32 @@ export interface FieldProps<T extends CMSType = any, CustomProps = any, M extend
59
56
  /**
60
57
  * Should this field include a description
61
58
  */
62
- includeDescription: boolean;
59
+ includeDescription?: boolean;
63
60
  /**
64
61
  * Flag to indicate that the underlying value has been updated in the
65
62
  * datasource
66
63
  */
67
- underlyingValueHasChanged: boolean;
64
+ underlyingValueHasChanged?: boolean;
68
65
  /**
69
66
  * Is this field part of an array
70
67
  */
71
- partOfArray: boolean;
68
+ partOfArray?: boolean;
72
69
  /**
73
70
  * Is this field part of a block (oneOf array)
74
71
  */
75
- partOfBlock: boolean;
72
+ partOfBlock?: boolean;
76
73
  /**
77
74
  * Is this field being rendered in the entity table popup
78
75
  */
79
- tableMode: boolean;
76
+ tableMode?: boolean;
80
77
  /**
81
78
  * Should this field autofocus on mount
82
79
  */
83
- autoFocus: boolean;
80
+ autoFocus?: boolean;
84
81
  /**
85
82
  * Additional properties set by the developer
86
83
  */
87
- customProps: CustomProps;
84
+ customProps?: CustomProps;
88
85
  /**
89
86
  * Additional values related to the state of the form or the entity
90
87
  */
@@ -92,7 +89,7 @@ export interface FieldProps<T extends CMSType = any, CustomProps = any, M extend
92
89
  /**
93
90
  * Flag to indicate if this field should be disabled
94
91
  */
95
- disabled: boolean;
92
+ disabled?: boolean;
96
93
  }
97
94
  /**
98
95
  * Context passed to custom fields
@@ -100,13 +97,24 @@ export interface FieldProps<T extends CMSType = any, CustomProps = any, M extend
100
97
  */
101
98
  export interface FormContext<M extends Record<string, any> = any> {
102
99
  /**
103
- * Collection of the entity being modified
100
+ * Current values of the entity
104
101
  */
105
- collection: ResolvedEntityCollection<M>;
102
+ values: M;
106
103
  /**
107
- * Current values of the entity
104
+ * Update the value of a field
105
+ * @param key
106
+ * @param value
107
+ * @param shouldValidate
108
+ */
109
+ setFieldValue: (key: string, value: any, shouldValidate?: boolean) => void;
110
+ /**
111
+ * Save the entity.
112
+ */
113
+ save: (values: M) => void;
114
+ /**
115
+ * Collection of the entity being modified
108
116
  */
109
- values: EntityValues<M>;
117
+ collection?: ResolvedEntityCollection<M>;
110
118
  /**
111
119
  * Entity id, it can be null if it's a new entity
112
120
  */
@@ -114,18 +122,11 @@ export interface FormContext<M extends Record<string, any> = any> {
114
122
  /**
115
123
  * Path this entity is located at
116
124
  */
117
- path: string;
118
- /**
119
- * Update the value of a field
120
- * @param key
121
- * @param value
122
- * @param shouldValidate
123
- */
124
- setFieldValue: (key: string, value: any, shouldValidate?: boolean) => void;
125
+ path?: string;
125
126
  /**
126
- * Save the entity
127
+ * This is the underlying formex controller that powers the form
127
128
  */
128
- save: (values: EntityValues<M>) => void;
129
+ formex: FormexController<M>;
129
130
  }
130
131
  /**
131
132
  * In case you need to render a field bound to a Property inside your
@@ -47,9 +47,9 @@ export type NavigationController<EC extends EntityCollection = EntityCollection<
47
47
  * Get the collection configuration for a given path.
48
48
  * The collection is resolved from the given path or alias.
49
49
  */
50
- getCollection: (pathOrId: string, entityId?: string, includeUserOverride?: boolean) => EC | undefined;
50
+ getCollection: (pathOrId: string, includeUserOverride?: boolean) => EC | undefined;
51
51
  /**
52
- * Get the collection configuration from its parent path segments.
52
+ * Get the collection configuration from its parent ids.
53
53
  */
54
54
  getCollectionFromIds: (ids: string[]) => EC | undefined;
55
55
  /**
@@ -1,6 +1,6 @@
1
1
  import React, { PropsWithChildren } from "react";
2
2
  import { FireCMSContext } from "./firecms_context";
3
- import { CollectionActionsProps, EntityCollection } from "./collections";
3
+ import { CollectionActionsProps, EntityCollection, EntityTableController } from "./collections";
4
4
  import { User } from "./user";
5
5
  import { FieldProps, FormContext } from "./fields";
6
6
  import { CMSType, Property } from "./properties";
@@ -80,6 +80,12 @@ export type FireCMSPlugin<PROPS = any, FORM_PROPS = any, EC extends EntityCollec
80
80
  collectionActionsProps?: COL_ACTIONS_PROPS;
81
81
  CollectionActionsStart?: React.ComponentType<CollectionActionsProps<any, any, EC> & COL_ACTIONS_START__PROPS> | React.ComponentType<CollectionActionsProps<any, any, EC> & COL_ACTIONS_START__PROPS>[];
82
82
  collectionActionsStartProps?: COL_ACTIONS_START__PROPS;
83
+ blockSearch?: (props: {
84
+ context: FireCMSContext;
85
+ path: string;
86
+ collection: EC;
87
+ parentCollectionIds?: string[];
88
+ }) => boolean;
83
89
  showTextSearchBar?: (props: {
84
90
  context: FireCMSContext;
85
91
  path: string;
@@ -103,6 +109,7 @@ export type FireCMSPlugin<PROPS = any, FORM_PROPS = any, EC extends EntityCollec
103
109
  parentCollectionIds: string[];
104
110
  onHover: boolean;
105
111
  collection: EC;
112
+ tableController: EntityTableController;
106
113
  }>;
107
114
  /**
108
115
  * If you add this callback to your plugin, an add button will be added to the collection table.
@@ -112,6 +119,7 @@ export type FireCMSPlugin<PROPS = any, FORM_PROPS = any, EC extends EntityCollec
112
119
  fullPath: string;
113
120
  parentCollectionIds: string[];
114
121
  collection: EC;
122
+ tableController: EntityTableController;
115
123
  }>;
116
124
  };
117
125
  form?: {
@@ -161,8 +169,8 @@ export type PluginFieldBuilderParams<T extends CMSType = CMSType, M extends Reco
161
169
  property: Property<T> | ResolvedProperty<T>;
162
170
  Field: React.ComponentType<FieldProps<T, any, M>>;
163
171
  plugin: FireCMSPlugin;
164
- path: string;
165
- collection: EC;
172
+ path?: string;
173
+ collection?: EC;
166
174
  };
167
175
  export interface PluginGenericProps<UserType extends User = User> {
168
176
  context: FireCMSContext<UserType>;
@@ -97,7 +97,7 @@ export interface BaseProperty<T extends CMSType, CustomProps = any> {
97
97
  /**
98
98
  * This value will be set by default for new entities.
99
99
  */
100
- defaultValue?: T;
100
+ defaultValue?: T | null;
101
101
  /**
102
102
  * Should this property be editable. If set to true, the user will be able to modify the property and
103
103
  * save the new config. The saved config will then become the source of truth.
@@ -474,6 +474,14 @@ export interface ReferenceProperty extends BaseProperty<EntityReference> {
474
474
  * specified values are considered.
475
475
  */
476
476
  previewProperties?: string[];
477
+ /**
478
+ * Should the reference include the ID of the entity. Defaults to `true`
479
+ */
480
+ includeId?: boolean;
481
+ /**
482
+ * Should the reference include a link to the entity (open the entity details). Defaults to `true`
483
+ */
484
+ includeEntityLink?: boolean;
477
485
  }
478
486
  /**
479
487
  * Rules to validate any property. Some properties have specific rules
@@ -620,6 +628,11 @@ export type StorageConfig = {
620
628
  * after it has been resolved.
621
629
  */
622
630
  postProcess?: (pathOrUrl: string) => Promise<string>;
631
+ /**
632
+ * You can use this prop in order to provide a custom preview URL.
633
+ * Useful when the file's path is different from the original field value
634
+ */
635
+ previewUrl?: (fileName: string) => string;
623
636
  };
624
637
  /**
625
638
  * @group Entity properties
@@ -644,7 +657,7 @@ export interface UploadedFileContext {
644
657
  /**
645
658
  * Entity path. E.g. `products/PID/locales`
646
659
  */
647
- path: string;
660
+ path?: string;
648
661
  /**
649
662
  * Values of the current entity
650
663
  */