@firecms/core 3.0.0-canary.7 → 3.0.0-canary.70

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 (271) hide show
  1. package/README.md +2 -2
  2. package/dist/app/AppBar.d.ts +12 -0
  3. package/dist/app/Drawer.d.ts +17 -0
  4. package/dist/app/Scaffold.d.ts +30 -0
  5. package/dist/app/index.d.ts +4 -0
  6. package/dist/app/useApp.d.ts +16 -0
  7. package/dist/components/ClearFilterSortButton.d.ts +5 -0
  8. package/dist/components/EntityCollectionTable/EntityCollectionRowActions.d.ts +11 -11
  9. package/dist/components/EntityCollectionTable/EntityCollectionTable.d.ts +2 -2
  10. package/dist/components/EntityCollectionTable/EntityCollectionTableProps.d.ts +5 -3
  11. package/dist/components/EntityCollectionTable/PropertyTableCell.d.ts +3 -2
  12. package/dist/components/EntityCollectionTable/column_utils.d.ts +1 -2
  13. package/dist/components/EntityCollectionTable/fields/TableReferenceField.d.ts +2 -0
  14. package/dist/components/EntityCollectionTable/internal/CollectionTableToolbar.d.ts +1 -4
  15. package/dist/components/EntityCollectionTable/internal/EntityTableCell.d.ts +2 -2
  16. package/dist/components/EntityCollectionTable/internal/popup_field/PopupFormField.d.ts +1 -1
  17. package/dist/components/EntityCollectionView/EntityCollectionView.d.ts +12 -3
  18. package/dist/components/EntityCollectionView/EntityCollectionViewStartActions.d.ts +11 -0
  19. package/dist/components/EntityCollectionView/useSelectionController.d.ts +2 -0
  20. package/dist/components/EntityPreview.d.ts +26 -7
  21. package/dist/components/EntityView.d.ts +11 -0
  22. package/dist/components/FieldCaption.d.ts +5 -0
  23. package/dist/components/HomePage/NavigationCard.d.ts +8 -0
  24. package/dist/components/HomePage/{NavigationCollectionCard.d.ts → NavigationCardBinding.d.ts} +2 -2
  25. package/dist/components/HomePage/SmallNavigationCard.d.ts +6 -0
  26. package/dist/components/HomePage/index.d.ts +3 -1
  27. package/dist/components/ReferenceWidget.d.ts +3 -1
  28. package/dist/components/SelectableTable/SelectableTable.d.ts +1 -1
  29. package/dist/components/SelectableTable/filters/ReferenceFilterField.d.ts +2 -1
  30. package/dist/components/VirtualTable/VirtualTableProps.d.ts +6 -7
  31. package/dist/components/VirtualTable/types.d.ts +3 -3
  32. package/dist/components/{EntityCollectionTable/internal → common}/default_entity_actions.d.ts +1 -1
  33. package/dist/components/common/index.d.ts +1 -0
  34. package/dist/components/common/table_height.d.ts +5 -0
  35. package/dist/components/common/types.d.ts +4 -6
  36. package/dist/components/common/useDataSourceEntityCollectionTableController.d.ts +3 -0
  37. package/dist/components/index.d.ts +6 -3
  38. package/dist/contexts/AuthControllerContext.d.ts +1 -1
  39. package/dist/{components/FireCMSAppBar.d.ts → core/DefaultAppBar.d.ts} +5 -8
  40. package/dist/core/DefaultDrawer.d.ts +19 -0
  41. package/dist/core/DrawerNavigationItem.d.ts +9 -0
  42. package/dist/core/EntityEditView.d.ts +36 -0
  43. package/dist/core/NavigationRoutes.d.ts +2 -2
  44. package/dist/core/index.d.ts +3 -4
  45. package/dist/form/PropertiesForm.d.ts +8 -0
  46. package/dist/form/components/ErrorFocus.d.ts +1 -1
  47. package/dist/form/components/FieldHelperText.d.ts +3 -3
  48. package/dist/form/components/StorageItemPreview.d.ts +2 -3
  49. package/dist/form/components/StorageUploadProgress.d.ts +1 -1
  50. package/dist/form/field_bindings/KeyValueFieldBinding.d.ts +1 -1
  51. package/dist/form/field_bindings/MapFieldBinding.d.ts +1 -1
  52. package/dist/form/field_bindings/StorageUploadFieldBinding.d.ts +3 -4
  53. package/dist/form/field_bindings/TextFieldBinding.d.ts +2 -2
  54. package/dist/form/index.d.ts +0 -2
  55. package/dist/form/validation.d.ts +1 -1
  56. package/dist/hooks/data/delete.d.ts +2 -2
  57. package/dist/hooks/data/save.d.ts +2 -3
  58. package/dist/hooks/data/useDataSource.d.ts +2 -2
  59. package/dist/hooks/data/useEntityFetch.d.ts +3 -3
  60. package/dist/hooks/index.d.ts +2 -0
  61. package/dist/hooks/useBuildNavigationController.d.ts +6 -4
  62. package/dist/hooks/useProjectLog.d.ts +6 -2
  63. package/dist/hooks/useStorageSource.d.ts +2 -2
  64. package/dist/hooks/useValidateAuthenticator.d.ts +21 -0
  65. package/dist/index.d.ts +1 -0
  66. package/dist/index.es.js +10512 -9997
  67. package/dist/index.es.js.map +1 -1
  68. package/dist/index.umd.js +5 -5
  69. package/dist/index.umd.js.map +1 -1
  70. package/dist/internal/useBuildDataSource.d.ts +1 -16
  71. package/dist/preview/PropertyPreview.d.ts +1 -1
  72. package/dist/preview/PropertyPreviewProps.d.ts +1 -4
  73. package/dist/preview/components/BooleanPreview.d.ts +5 -1
  74. package/dist/preview/components/EnumValuesChip.d.ts +1 -1
  75. package/dist/preview/components/ReferencePreview.d.ts +3 -8
  76. package/dist/types/analytics.d.ts +1 -1
  77. package/dist/types/auth.d.ts +37 -1
  78. package/dist/types/collections.d.ts +44 -6
  79. package/dist/types/datasource.d.ts +21 -14
  80. package/dist/types/entities.d.ts +5 -1
  81. package/dist/types/entity_actions.d.ts +14 -0
  82. package/dist/types/entity_callbacks.d.ts +2 -2
  83. package/dist/types/entity_overrides.d.ts +6 -0
  84. package/dist/types/fields.d.ts +31 -30
  85. package/dist/types/index.d.ts +2 -1
  86. package/dist/types/navigation.d.ts +15 -14
  87. package/dist/types/permissions.d.ts +5 -1
  88. package/dist/types/plugins.d.ts +22 -22
  89. package/dist/types/properties.d.ts +13 -5
  90. package/dist/types/property_config.d.ts +2 -2
  91. package/dist/types/roles.d.ts +31 -0
  92. package/dist/types/storage.d.ts +11 -3
  93. package/dist/types/user.d.ts +5 -0
  94. package/dist/util/collections.d.ts +9 -1
  95. package/dist/util/entities.d.ts +1 -1
  96. package/dist/util/icon_synonyms.d.ts +1 -97
  97. package/dist/util/icons.d.ts +8 -2
  98. package/dist/util/navigation_utils.d.ts +2 -2
  99. package/dist/util/objects.d.ts +1 -1
  100. package/dist/util/permissions.d.ts +4 -4
  101. package/dist/util/references.d.ts +4 -2
  102. package/dist/util/resolutions.d.ts +14 -14
  103. package/dist/util/storage.d.ts +23 -2
  104. package/dist/util/useStorageUploadController.d.ts +1 -1
  105. package/dist/util/useTraceUpdate.d.ts +1 -0
  106. package/package.json +139 -119
  107. package/src/app/AppBar.tsx +18 -0
  108. package/src/app/Drawer.tsx +25 -0
  109. package/src/app/Scaffold.tsx +249 -0
  110. package/src/app/index.ts +4 -0
  111. package/src/app/useApp.tsx +32 -0
  112. package/src/components/ClearFilterSortButton.tsx +41 -0
  113. package/src/components/DeleteEntityDialog.tsx +4 -4
  114. package/src/components/EntityCollectionTable/EntityCollectionRowActions.tsx +4 -4
  115. package/src/components/EntityCollectionTable/EntityCollectionTable.tsx +276 -279
  116. package/src/components/EntityCollectionTable/EntityCollectionTableProps.tsx +9 -5
  117. package/src/components/EntityCollectionTable/PropertyTableCell.tsx +48 -45
  118. package/src/components/EntityCollectionTable/column_utils.tsx +3 -3
  119. package/src/components/EntityCollectionTable/fields/TableReferenceField.tsx +18 -17
  120. package/src/components/EntityCollectionTable/fields/TableStorageUpload.tsx +5 -5
  121. package/src/components/EntityCollectionTable/internal/CollectionTableToolbar.tsx +29 -34
  122. package/src/components/EntityCollectionTable/internal/EntityTableCell.tsx +16 -12
  123. package/src/components/EntityCollectionTable/internal/popup_field/PopupFormField.tsx +4 -5
  124. package/src/components/EntityCollectionView/EntityCollectionView.tsx +73 -72
  125. package/src/components/EntityCollectionView/EntityCollectionViewActions.tsx +5 -6
  126. package/src/components/EntityCollectionView/EntityCollectionViewStartActions.tsx +68 -0
  127. package/src/components/EntityCollectionView/useSelectionController.tsx +30 -0
  128. package/src/components/EntityPreview.tsx +209 -70
  129. package/src/components/EntityView.tsx +84 -0
  130. package/src/components/FieldCaption.tsx +14 -0
  131. package/src/components/HomePage/DefaultHomePage.tsx +15 -11
  132. package/src/components/HomePage/NavigationCard.tsx +69 -0
  133. package/src/components/HomePage/NavigationCardBinding.tsx +116 -0
  134. package/src/components/HomePage/SmallNavigationCard.tsx +45 -0
  135. package/src/components/HomePage/index.tsx +3 -1
  136. package/src/components/PropertyIdCopyTooltipContent.tsx +2 -3
  137. package/src/components/ReferenceTable/ReferenceSelectionTable.tsx +4 -4
  138. package/src/components/ReferenceWidget.tsx +22 -12
  139. package/src/components/SearchIconsView.tsx +5 -5
  140. package/src/components/SelectableTable/SelectableTable.tsx +5 -3
  141. package/src/components/SelectableTable/filters/BooleanFilterField.tsx +2 -3
  142. package/src/components/SelectableTable/filters/DateTimeFilterField.tsx +23 -8
  143. package/src/components/SelectableTable/filters/ReferenceFilterField.tsx +38 -24
  144. package/src/components/SelectableTable/filters/StringNumberFilterField.tsx +35 -15
  145. package/src/components/VirtualTable/VirtualTable.tsx +38 -29
  146. package/src/components/VirtualTable/VirtualTableHeader.tsx +4 -4
  147. package/src/components/VirtualTable/VirtualTableHeaderRow.tsx +2 -2
  148. package/src/components/VirtualTable/VirtualTableProps.tsx +7 -7
  149. package/src/components/VirtualTable/VirtualTableRow.tsx +4 -5
  150. package/src/components/VirtualTable/fields/VirtualTableDateField.tsx +1 -1
  151. package/src/components/VirtualTable/types.tsx +2 -3
  152. package/src/components/{EntityCollectionTable/internal → common}/default_entity_actions.tsx +11 -7
  153. package/src/components/common/index.ts +1 -0
  154. package/src/components/{VirtualTable/common.tsx → common/table_height.tsx} +5 -2
  155. package/src/components/common/types.tsx +4 -6
  156. package/src/components/common/useColumnsIds.tsx +10 -2
  157. package/src/components/common/useDataSourceEntityCollectionTableController.tsx +12 -1
  158. package/src/components/common/useTableSearchHelper.ts +39 -9
  159. package/src/components/index.tsx +6 -3
  160. package/src/contexts/AuthControllerContext.tsx +1 -1
  161. package/src/{components/FireCMSAppBar.tsx → core/DefaultAppBar.tsx} +51 -34
  162. package/src/core/DefaultDrawer.tsx +177 -0
  163. package/src/core/DrawerNavigationItem.tsx +62 -0
  164. package/src/core/EntityEditView.tsx +1101 -0
  165. package/src/core/EntitySidePanel.tsx +3 -4
  166. package/src/core/FireCMS.tsx +54 -43
  167. package/src/core/NavigationRoutes.tsx +14 -7
  168. package/src/core/field_configs.tsx +2 -3
  169. package/src/core/index.tsx +3 -4
  170. package/src/form/PropertiesForm.tsx +81 -0
  171. package/src/form/PropertyFieldBinding.tsx +29 -7
  172. package/src/form/components/FieldHelperText.tsx +3 -3
  173. package/src/form/components/StorageItemPreview.tsx +5 -7
  174. package/src/form/components/StorageUploadProgress.tsx +9 -8
  175. package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +10 -12
  176. package/src/form/field_bindings/BlockFieldBinding.tsx +2 -2
  177. package/src/form/field_bindings/DateTimeFieldBinding.tsx +1 -1
  178. package/src/form/field_bindings/KeyValueFieldBinding.tsx +19 -19
  179. package/src/form/field_bindings/MapFieldBinding.tsx +25 -17
  180. package/src/form/field_bindings/MarkdownFieldBinding.tsx +2 -2
  181. package/src/form/field_bindings/ReadOnlyFieldBinding.tsx +2 -9
  182. package/src/form/field_bindings/ReferenceFieldBinding.tsx +16 -13
  183. package/src/form/field_bindings/SelectFieldBinding.tsx +3 -3
  184. package/src/form/field_bindings/StorageUploadFieldBinding.tsx +14 -35
  185. package/src/form/field_bindings/TextFieldBinding.tsx +7 -5
  186. package/src/form/index.tsx +4 -4
  187. package/src/form/validation.ts +4 -21
  188. package/src/hooks/data/delete.ts +3 -3
  189. package/src/hooks/data/save.ts +4 -2
  190. package/src/hooks/data/useCollectionFetch.tsx +1 -1
  191. package/src/hooks/data/useDataSource.tsx +8 -3
  192. package/src/hooks/data/useEntityFetch.tsx +4 -4
  193. package/src/hooks/index.tsx +3 -0
  194. package/src/hooks/useBuildLocalConfigurationPersistence.tsx +8 -10
  195. package/src/hooks/useBuildModeController.tsx +11 -5
  196. package/src/hooks/useBuildNavigationController.tsx +200 -83
  197. package/src/hooks/useProjectLog.tsx +17 -7
  198. package/src/hooks/useReferenceDialog.tsx +2 -2
  199. package/src/hooks/useResolvedNavigationFrom.tsx +1 -1
  200. package/src/hooks/useStorageSource.tsx +7 -2
  201. package/src/hooks/useValidateAuthenticator.tsx +115 -0
  202. package/src/index.ts +1 -0
  203. package/src/internal/useBuildDataSource.ts +54 -47
  204. package/src/internal/useBuildSideEntityController.tsx +88 -21
  205. package/src/preview/PropertyPreview.tsx +5 -15
  206. package/src/preview/PropertyPreviewProps.tsx +1 -11
  207. package/src/preview/components/BooleanPreview.tsx +19 -4
  208. package/src/preview/components/EnumValuesChip.tsx +2 -2
  209. package/src/preview/components/ReferencePreview.tsx +72 -165
  210. package/src/preview/property_previews/ArrayOfMapsPreview.tsx +0 -1
  211. package/src/preview/property_previews/ArrayOfReferencesPreview.tsx +2 -1
  212. package/src/preview/property_previews/ArrayOfStorageComponentsPreview.tsx +0 -1
  213. package/src/preview/property_previews/ArrayOfStringsPreview.tsx +0 -1
  214. package/src/preview/property_previews/ArrayOneOfPreview.tsx +2 -3
  215. package/src/preview/property_previews/ArrayPropertyPreview.tsx +2 -3
  216. package/src/preview/property_previews/MapPropertyPreview.tsx +5 -5
  217. package/src/preview/property_previews/StringPropertyPreview.tsx +8 -7
  218. package/src/types/analytics.ts +1 -0
  219. package/src/types/auth.tsx +50 -1
  220. package/src/types/collections.ts +51 -6
  221. package/src/types/customization_controller.tsx +0 -1
  222. package/src/types/datasource.ts +24 -17
  223. package/src/types/entities.ts +9 -1
  224. package/src/types/entity_actions.tsx +17 -0
  225. package/src/types/entity_callbacks.ts +2 -2
  226. package/src/types/entity_overrides.tsx +7 -0
  227. package/src/types/fields.tsx +33 -33
  228. package/src/types/firecms.tsx +0 -1
  229. package/src/types/index.ts +2 -1
  230. package/src/types/navigation.ts +17 -17
  231. package/src/types/permissions.ts +6 -1
  232. package/src/types/plugins.tsx +28 -30
  233. package/src/types/properties.ts +19 -7
  234. package/src/types/property_config.tsx +2 -2
  235. package/src/types/roles.ts +41 -0
  236. package/src/types/side_entity_controller.tsx +1 -0
  237. package/src/types/storage.ts +12 -3
  238. package/src/types/user.ts +7 -0
  239. package/src/util/collections.ts +22 -0
  240. package/src/util/entities.ts +2 -1
  241. package/src/util/enums.ts +1 -1
  242. package/src/util/icon_list.ts +2 -2
  243. package/src/util/icon_synonyms.ts +3 -99
  244. package/src/util/icons.tsx +11 -3
  245. package/src/util/navigation_utils.ts +6 -6
  246. package/src/util/objects.ts +8 -21
  247. package/src/util/permissions.ts +12 -8
  248. package/src/util/references.ts +36 -5
  249. package/src/util/resolutions.ts +32 -31
  250. package/src/util/storage.ts +75 -21
  251. package/src/util/strings.ts +2 -2
  252. package/src/util/useStorageUploadController.tsx +21 -3
  253. package/src/util/useTraceUpdate.tsx +2 -1
  254. package/dist/components/VirtualTable/common.d.ts +0 -2
  255. package/dist/core/Drawer.d.ts +0 -23
  256. package/dist/core/EntityView.d.ts +0 -22
  257. package/dist/core/Scaffold.d.ts +0 -55
  258. package/dist/core/SideEntityView.d.ts +0 -7
  259. package/dist/form/EntityForm.d.ts +0 -77
  260. package/dist/internal/useBuildCustomizationController.d.ts +0 -2
  261. package/dist/internal/useLocaleConfig.d.ts +0 -1
  262. package/dist/types/appcheck.d.ts +0 -26
  263. package/src/components/HomePage/NavigationCollectionCard.tsx +0 -146
  264. package/src/core/Drawer.tsx +0 -164
  265. package/src/core/EntityView.tsx +0 -578
  266. package/src/core/Scaffold.tsx +0 -281
  267. package/src/core/SideEntityView.tsx +0 -38
  268. package/src/form/EntityForm.tsx +0 -720
  269. package/src/internal/useBuildCustomizationController.tsx +0 -5
  270. package/src/internal/useLocaleConfig.tsx +0 -18
  271. package/src/types/appcheck.ts +0 -29
@@ -1,4 +1,4 @@
1
- import { DataSource, DataSourceDelegate, EntityReference, GeoPoint, NavigationController, PropertyConfig } from "../types";
1
+ import { DataSource, DataSourceDelegate, NavigationController, PropertyConfig } from "../types";
2
2
  /**
3
3
  * Use this hook to build a {@link DataSource} based on Firestore
4
4
  * @param firebaseApp
@@ -9,18 +9,3 @@ export declare function useBuildDataSource({ delegate, propertyConfigs, navigati
9
9
  propertyConfigs?: Record<string, PropertyConfig>;
10
10
  navigationController: NavigationController;
11
11
  }): DataSource;
12
- /**
13
- * Recursive function that converts Firestore data types into CMS or plain
14
- * JS types.
15
- * FireCMS uses Javascript dates internally instead of Firestore timestamps.
16
- * This makes it easier to interact with the rest of the libraries and
17
- * bindings.
18
- * Also, Firestore references are replaced with {@link EntityReference}
19
- * @param data
20
- * @param buildReference
21
- * @param buildGeoPoint
22
- * @param buildDate
23
- * @param buildDelete
24
- * @group Firestore
25
- */
26
- export declare function cmsToDelegateModel(data: any, buildReference: (reference: EntityReference) => any, buildGeoPoint: (geoPoint: GeoPoint) => any, buildDate: (date: Date) => any, buildDelete: () => any): any;
@@ -4,4 +4,4 @@ import { PropertyPreviewProps } from "./PropertyPreviewProps";
4
4
  /**
5
5
  * @group Preview components
6
6
  */
7
- export declare const PropertyPreview: React.MemoExoticComponent<(<T extends CMSType>(props: PropertyPreviewProps<T, any, Record<string, any>>) => any)>;
7
+ export declare const PropertyPreview: React.MemoExoticComponent<(<T extends CMSType>(props: PropertyPreviewProps<T>) => any)>;
@@ -6,7 +6,7 @@ export type PreviewSize = "medium" | "small" | "tiny";
6
6
  /**
7
7
  * @group Preview components
8
8
  */
9
- export interface PropertyPreviewProps<T extends CMSType = any, CustomProps = any, M extends Record<string, any> = Record<string, any>> {
9
+ export interface PropertyPreviewProps<T extends CMSType = any, CustomProps = any> {
10
10
  /**
11
11
  * Name of the property
12
12
  */
@@ -19,9 +19,6 @@ export interface PropertyPreviewProps<T extends CMSType = any, CustomProps = any
19
19
  * Property this display is related to
20
20
  */
21
21
  property: Property<T> | ResolvedProperty<T>;
22
- /**
23
- * Click handler
24
- */
25
22
  /**
26
23
  * Desired size of the preview, depending on the context.
27
24
  */
@@ -1,7 +1,11 @@
1
1
  import React from "react";
2
+ import { PreviewSize } from "../PropertyPreviewProps";
3
+ import { Property } from "../../types";
2
4
  /**
3
5
  * @group Preview components
4
6
  */
5
- export declare function BooleanPreview({ value }: {
7
+ export declare function BooleanPreview({ value, size, property }: {
6
8
  value: boolean;
9
+ size: PreviewSize;
10
+ property: Property;
7
11
  }): React.ReactElement;
@@ -3,7 +3,7 @@ import { EnumValues } from "../../types";
3
3
  export interface EnumValuesChipProps {
4
4
  enumValues?: EnumValues;
5
5
  enumKey: string | number;
6
- size: "small" | "medium";
6
+ size: "tiny" | "small" | "medium";
7
7
  className?: string;
8
8
  children?: React.ReactNode;
9
9
  }
@@ -7,16 +7,11 @@ export type ReferencePreviewProps = {
7
7
  size: PreviewSize;
8
8
  previewProperties?: string[];
9
9
  onClick?: (e: React.SyntheticEvent) => void;
10
- onHover?: boolean;
11
- allowEntityNavigation?: boolean;
10
+ hover?: boolean;
11
+ includeEntityLink?: boolean;
12
+ includeId?: boolean;
12
13
  };
13
14
  /**
14
15
  * @group Preview components
15
16
  */
16
17
  export declare const ReferencePreview: React.FunctionComponent<ReferencePreviewProps>;
17
- export declare function ReferencePreviewContainer({ children, onHover, size, onClick }: {
18
- children: React.ReactNode;
19
- onHover?: boolean;
20
- size: PreviewSize;
21
- onClick?: (e: React.SyntheticEvent) => void;
22
- }): import("react/jsx-runtime").JSX.Element;
@@ -1 +1 @@
1
- export type CMSAnalyticsEvent = "entity_click" | "entity_click_from_reference" | "reference_selection_clear" | "reference_selection_toggle" | "reference_selected_single" | "reference_selection_new_entity" | "edit_entity_clicked" | "entity_edited" | "new_entity_click" | "new_entity_saved" | "copy_entity_click" | "entity_copied" | "single_delete_dialog_open" | "multiple_delete_dialog_open" | "single_entity_deleted" | "multiple_entities_deleted" | "drawer_navigate_to_home" | "drawer_navigate_to_collection" | "drawer_navigate_to_view" | "home_navigate_to_collection" | "home_favorite_navigate_to_collection" | "home_navigate_to_view" | "home_favorite_navigate_to_view" | "collection_inline_editing" | "unmapped_event";
1
+ export type CMSAnalyticsEvent = "entity_click" | "entity_click_from_reference" | "reference_selection_clear" | "reference_selection_toggle" | "reference_selected_single" | "reference_selection_new_entity" | "edit_entity_clicked" | "entity_edited" | "new_entity_click" | "new_entity_saved" | "copy_entity_click" | "entity_copied" | "single_delete_dialog_open" | "multiple_delete_dialog_open" | "single_entity_deleted" | "multiple_entities_deleted" | "drawer_navigate_to_home" | "drawer_navigate_to_collection" | "drawer_navigate_to_view" | "home_navigate_to_collection" | "home_favorite_navigate_to_collection" | "home_navigate_to_view" | "home_navigate_to_admin_view" | "home_favorite_navigate_to_view" | "collection_inline_editing" | "unmapped_event";
@@ -1,22 +1,34 @@
1
1
  import { User } from "./user";
2
+ import { Role } from "./roles";
3
+ import { DataSourceDelegate } from "./datasource";
4
+ import { StorageSource } from "./storage";
2
5
  /**
3
6
  * Controller for retrieving the logged user or performing auth related operations.
4
7
  * Note that if you are implementing your AuthController, you probably will want
5
8
  * to do it as the result of a hook.
6
9
  * @group Hooks and utilities
7
10
  */
8
- export type AuthController<UserType extends User = User> = {
11
+ export type AuthController<UserType extends User = any, ExtraData extends any = any> = {
9
12
  /**
10
13
  * The user currently logged in
11
14
  * The values can be: the user object, null if they skipped login
12
15
  */
13
16
  user: UserType | null;
17
+ /**
18
+ * Roles related to the logged user
19
+ */
20
+ roles?: Role[];
14
21
  /**
15
22
  * Initial loading flag. It is used not to display the login screen
16
23
  * when the app first loads, and it has not been checked whether the user
17
24
  * is logged in or not.
18
25
  */
19
26
  initialLoading?: boolean;
27
+ /**
28
+ * Loading flag. It is used to display a loading screen when the user is
29
+ * logging in or out.
30
+ */
31
+ authLoading: boolean;
20
32
  /**
21
33
  * Sign out
22
34
  */
@@ -37,4 +49,28 @@ export type AuthController<UserType extends User = User> = {
37
49
  * Has the user skipped the login process
38
50
  */
39
51
  loginSkipped: boolean;
52
+ extra: ExtraData;
53
+ setExtra: (extra: ExtraData) => void;
40
54
  };
55
+ /**
56
+ * Implement this function to allow access to specific users.
57
+ * @group Hooks and utilities
58
+ */
59
+ export type Authenticator<UserType extends User = User, Controller extends AuthController<UserType> = AuthController<UserType>> = (props: {
60
+ /**
61
+ * Logged-in user or null
62
+ */
63
+ user: UserType | null;
64
+ /**
65
+ * AuthController
66
+ */
67
+ authController: Controller;
68
+ /**
69
+ * Connector to your database, e.g. your Firestore database
70
+ */
71
+ dataSourceDelegate: DataSourceDelegate;
72
+ /**
73
+ * Used storage implementation
74
+ */
75
+ storageSource: StorageSource;
76
+ }) => boolean | Promise<boolean>;
@@ -8,6 +8,7 @@ import { EnumValues, PropertiesOrBuilders } from "./properties";
8
8
  import { FormContext } from "./fields";
9
9
  import { EntityAction } from "./entity_actions";
10
10
  import { ExportConfig } from "./export_import";
11
+ import { EntityOverrides } from "./entity_overrides";
11
12
  /**
12
13
  * This interface represents a view that includes a collection of entities.
13
14
  * It can be in the root level of the configuration, defining the main
@@ -15,7 +16,7 @@ import { ExportConfig } from "./export_import";
15
16
  *
16
17
  * @group Models
17
18
  */
18
- export interface EntityCollection<M extends Record<string, any> = any, UserType extends User = User> {
19
+ export interface EntityCollection<M extends Record<string, any> = any, UserType extends User = any> {
19
20
  /**
20
21
  * You can set an alias that will be used internally instead of the `path`.
21
22
  * The `alias` value will be used to determine the URL of the collection,
@@ -65,6 +66,12 @@ export interface EntityCollection<M extends Record<string, any> = any, UserType
65
66
  * Set of properties that compose an entity
66
67
  */
67
68
  properties: PropertiesOrBuilders<M>;
69
+ /**
70
+ * Title property of the entity. This is the property that will be used
71
+ * as the title in entity related views and references.
72
+ * If not specified, the first property simple text property will be used.
73
+ */
74
+ titleProperty?: keyof M;
68
75
  /**
69
76
  * Can this collection be edited by the end user.
70
77
  * Defaults to `true`.
@@ -87,8 +94,12 @@ export interface EntityCollection<M extends Record<string, any> = any, UserType
87
94
  * `subcollection:`. e.g. `subcollection:orders`.
88
95
  * - If you are using a collection group, you will also have an
89
96
  * additional `collectionGroupParent` column.
97
+ * You can use this prop to hide some properties from the table view.
98
+ * Note that if you set this prop, other ways to hide fields, like
99
+ * `hidden` in the property definition,will be ignored.
100
+ * `propertiesOrder` has precedence over `hidden`.
90
101
  */
91
- propertiesOrder?: Extract<keyof M, string>[];
102
+ propertiesOrder?: (Extract<keyof M, string> | `subcollection:${string}`)[];
92
103
  /**
93
104
  * If enabled, content is loaded in batches. If `false` all entities in the
94
105
  * collection are loaded.
@@ -121,7 +132,7 @@ export interface EntityCollection<M extends Record<string, any> = any, UserType
121
132
  * is being created, updated or deleted.
122
133
  * Useful for adding your own logic or blocking the execution of the operation.
123
134
  */
124
- callbacks?: EntityCallbacks<M>;
135
+ callbacks?: EntityCallbacks<M, UserType>;
125
136
  /**
126
137
  * Builder for rendering additional components such as buttons in the
127
138
  * collection toolbar
@@ -241,6 +252,19 @@ export interface EntityCollection<M extends Record<string, any> = any, UserType
241
252
  *
242
253
  */
243
254
  exportable?: boolean | ExportConfig<UserType>;
255
+ /**
256
+ * User id of the owner of this collection. This is used only by plugins, or if you
257
+ * are writing custom code
258
+ */
259
+ ownerId?: string;
260
+ /**
261
+ * Overrides for the entity view, like the data source or the storage source.
262
+ */
263
+ overrides?: EntityOverrides;
264
+ /**
265
+ * Width of the side dialog (in pixels) when opening an entity in this collection.
266
+ */
267
+ sideDialogWidth?: number | string;
244
268
  }
245
269
  /**
246
270
  * Parameter passed to the `Actions` prop in the collection configuration.
@@ -300,7 +324,7 @@ export type SelectionController<M extends Record<string, any> = any> = {
300
324
  };
301
325
  /**
302
326
  * Filter conditions in a `Query.where()` clause are specified using the
303
- * strings '<', '<=', '==', '>=', '>', 'array-contains', 'in', and 'array-contains-any'.
327
+ * strings `<`, `<=`, `==`, `>=`, `>`, `array-contains`, `in`, and `array-contains-any`.
304
328
  * @group Models
305
329
  */
306
330
  export type WhereFilterOp = "<" | "<=" | "==" | "!=" | ">=" | ">" | "array-contains" | "in" | "not-in" | "array-contains-any";
@@ -369,7 +393,7 @@ export interface AdditionalFieldDelegate<M extends Record<string, any> = any, Us
369
393
  */
370
394
  value?: (props: {
371
395
  entity: Entity<M>;
372
- context: FireCMSContext;
396
+ context: FireCMSContext<any>;
373
397
  }) => string | number | Promise<string | number> | undefined;
374
398
  }
375
399
  /**
@@ -378,8 +402,22 @@ export interface AdditionalFieldDelegate<M extends Record<string, any> = any, Us
378
402
  * @group Models
379
403
  */
380
404
  export type EntityCustomView<M extends Record<string, any> = any> = {
405
+ /**
406
+ * Key of this custom view.
407
+ */
381
408
  key: string;
409
+ /**
410
+ * Name of this custom view.
411
+ */
382
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
+ */
383
421
  Builder?: React.ComponentType<EntityCustomViewParams<M>>;
384
422
  };
385
423
  /**
@@ -432,7 +470,7 @@ export type EntityTableController<M extends Record<string, any> = any> = {
432
470
  filterValues?: FilterValues<Extract<keyof M, string>>;
433
471
  setFilterValues?: (filterValues: FilterValues<Extract<keyof M, string>>) => void;
434
472
  sortBy?: [Extract<keyof M, string>, "asc" | "desc"];
435
- setSortBy?: (sortBy: [Extract<keyof M, string>, "asc" | "desc"]) => void;
473
+ setSortBy?: (sortBy?: [Extract<keyof M, string>, "asc" | "desc"]) => void;
436
474
  searchString?: string;
437
475
  setSearchString?: (searchString?: string) => void;
438
476
  clearFilter?: () => void;
@@ -1,13 +1,14 @@
1
- import { Entity, EntityReference, EntityStatus, EntityValues, GeoPoint } from "./entities";
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
  */
7
8
  export interface FetchEntityProps<M extends Record<string, any> = any> {
8
9
  path: string;
9
10
  entityId: string;
10
- collection?: EntityCollection<M>;
11
+ collection?: EntityCollection<M, any>;
11
12
  }
12
13
  /**
13
14
  * @group Datasource
@@ -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,22 +253,17 @@ 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
- buildReference: (reference: EntityReference) => any;
249
- /**
250
- * Convert a FireCMS GeoPoint to a GeoPoint that can be used by the datasource
251
- * @param geoPoint
252
- */
253
- buildGeoPoint: (geoPoint: GeoPoint) => any;
254
256
  /**
255
257
  * Get the object to generate the current time in the datasource
256
258
  */
257
259
  currentTime(): any;
258
- buildDate: (date: Date) => any;
259
- buildDeleteFieldValue: () => any;
260
260
  delegateToCMSModel: (data: any) => any;
261
+ cmsToDelegateModel: (data: any) => any;
261
262
  setDateToMidnight: (input?: any) => any;
263
+ initTextSearch?: (props: {
264
+ context: FireCMSContext;
265
+ path: string;
266
+ collection: EntityCollection;
267
+ parentCollectionIds?: string[];
268
+ }) => Promise<boolean>;
262
269
  }
@@ -31,7 +31,7 @@ export type EntityValues<M extends object> = M;
31
31
  /**
32
32
  * Class used to create a reference to an entity in a different path
33
33
  */
34
- export declare class EntityReference<M extends Record<string, any> = any> {
34
+ export declare class EntityReference {
35
35
  /**
36
36
  * ID of the entity
37
37
  */
@@ -56,3 +56,7 @@ export declare class GeoPoint {
56
56
  readonly longitude: number;
57
57
  constructor(latitude: number, longitude: number);
58
58
  }
59
+ export declare class Vector {
60
+ readonly value: number[];
61
+ constructor(value: number[]);
62
+ }
@@ -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.
@@ -63,7 +63,7 @@ export interface EntityOnFetchProps<M extends Record<string, any> = any, UserTyp
63
63
  /**
64
64
  * Collection of the entity
65
65
  */
66
- collection: EntityCollection<M>;
66
+ collection: EntityCollection<M, UserType>;
67
67
  /**
68
68
  * Full path of the CMS where this collection is being fetched.
69
69
  * Might contain unresolved aliases.
@@ -155,7 +155,7 @@ export interface EntityOnDeleteProps<M extends Record<string, any> = any, UserTy
155
155
  /**
156
156
  * Context of the app status
157
157
  */
158
- context: FireCMSContext;
158
+ context: FireCMSContext<UserType>;
159
159
  }
160
160
  /**
161
161
  * Parameters passed to hooks when an entity is deleted
@@ -0,0 +1,6 @@
1
+ import { DataSource } from "./datasource";
2
+ import { StorageSource } from "./storage";
3
+ export type EntityOverrides = {
4
+ dataSource?: DataSource;
5
+ storageSource?: StorageSource;
6
+ };
@@ -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
@@ -17,11 +17,12 @@ export * from "./side_entity_controller";
17
17
  export * from "./side_dialogs_controller";
18
18
  export * from "./firecms_context";
19
19
  export * from "./entity_callbacks";
20
+ export * from "./entity_overrides";
20
21
  export * from "./local_config_persistence";
21
22
  export * from "./plugins";
22
23
  export * from "./analytics";
23
24
  export * from "./firecms";
24
- export * from "./appcheck";
25
+ export * from "./roles";
25
26
  export * from "./export_import";
26
27
  export * from "./modify_collections";
27
28
  export * from "./analytics_controller";
@@ -1,3 +1,4 @@
1
+ import React from "react";
1
2
  import { EntityCollection } from "./collections";
2
3
  import { EntityReference } from "./entities";
3
4
  /**
@@ -5,7 +6,7 @@ import { EntityReference } from "./entities";
5
6
  * attributes.
6
7
  * @group Models
7
8
  */
8
- export type NavigationController = {
9
+ export type NavigationController<EC extends EntityCollection = EntityCollection<any>> = {
9
10
  /**
10
11
  * List of the mapped collections in the CMS.
11
12
  * Each entry relates to a collection in the root database.
@@ -18,6 +19,11 @@ export type NavigationController = {
18
19
  * navigation
19
20
  */
20
21
  views?: CMSView[];
22
+ /**
23
+ * Custom additional views created by the developer, added to the admin
24
+ * navigation
25
+ */
26
+ adminViews?: CMSView[];
21
27
  /**
22
28
  * Configuration for the views that should be displayed at the top
23
29
  * level of the navigation (e.g. in the home page or the navigation
@@ -41,15 +47,15 @@ export type NavigationController = {
41
47
  * Get the collection configuration for a given path.
42
48
  * The collection is resolved from the given path or alias.
43
49
  */
44
- getCollection: <EC extends EntityCollection = EntityCollection<any>>(pathOrAlias: string, entityId?: string, includeUserOverride?: boolean) => EC | undefined;
50
+ getCollection: (pathOrId: string, includeUserOverride?: boolean) => EC | undefined;
45
51
  /**
46
- * Get the collection configuration from its parent path segments.
52
+ * Get the collection configuration from its parent ids.
47
53
  */
48
- getCollectionFromIds: <EC extends EntityCollection = EntityCollection<any>>(ids: string[]) => EC | undefined;
54
+ getCollectionFromIds: (ids: string[]) => EC | undefined;
49
55
  /**
50
56
  * Get the collection configuration from its parent path segments.
51
57
  */
52
- getCollectionFromPaths: <EC extends EntityCollection = EntityCollection<any>>(pathSegments: string[]) => EC | undefined;
58
+ getCollectionFromPaths: (pathSegments: string[]) => EC | undefined;
53
59
  /**
54
60
  * Default path under the navigation routes of the CMS will be created
55
61
  */
@@ -95,12 +101,6 @@ export type NavigationController = {
95
101
  * @param pathWithAliases
96
102
  */
97
103
  resolveAliasesFrom: (pathWithAliases: string) => string;
98
- /**
99
- * Location used as the base for routes.
100
- * This is the location that will be used underneath, when the url changes while
101
- * opening a side dialog
102
- */
103
- baseLocation: string;
104
104
  /**
105
105
  * Call this method to recalculate the navigation
106
106
  */
@@ -159,6 +159,7 @@ export interface CMSView {
159
159
  /**
160
160
  * Optional field used to group top level navigation entries under a
161
161
  * navigation view.
162
+ * This prop is ignored for admin views.
162
163
  */
163
164
  group?: string;
164
165
  }
@@ -166,11 +167,11 @@ export interface TopNavigationEntry {
166
167
  url: string;
167
168
  name: string;
168
169
  path: string;
169
- type: "collection" | "view";
170
+ type: "collection" | "view" | "admin";
170
171
  collection?: EntityCollection;
171
- view: CMSView;
172
+ view?: CMSView;
172
173
  description?: string;
173
- group?: string;
174
+ group: string;
174
175
  }
175
176
  export type TopNavigationResult = {
176
177
  navigationEntries: TopNavigationEntry[];