@firecms/core 3.0.0-canary.1 → 3.0.0-canary.100

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 (301) 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/CircularProgressCenter.d.ts +1 -1
  8. package/dist/components/ClearFilterSortButton.d.ts +5 -0
  9. package/dist/components/EntityCollectionTable/EntityCollectionRowActions.d.ts +11 -12
  10. package/dist/components/EntityCollectionTable/EntityCollectionTable.d.ts +2 -2
  11. package/dist/components/EntityCollectionTable/EntityCollectionTableProps.d.ts +5 -3
  12. package/dist/components/EntityCollectionTable/PropertyTableCell.d.ts +3 -2
  13. package/dist/components/EntityCollectionTable/column_utils.d.ts +1 -2
  14. package/dist/components/EntityCollectionTable/fields/TableReferenceField.d.ts +2 -0
  15. package/dist/components/EntityCollectionTable/internal/CollectionTableToolbar.d.ts +1 -4
  16. package/dist/components/EntityCollectionTable/internal/EntityTableCell.d.ts +2 -2
  17. package/dist/components/EntityCollectionTable/internal/popup_field/PopupFormField.d.ts +1 -1
  18. package/dist/components/EntityCollectionView/EntityCollectionView.d.ts +13 -4
  19. package/dist/components/EntityCollectionView/EntityCollectionViewStartActions.d.ts +11 -0
  20. package/dist/components/EntityCollectionView/useSelectionController.d.ts +2 -0
  21. package/dist/components/EntityPreview.d.ts +26 -7
  22. package/dist/components/EntityView.d.ts +11 -0
  23. package/dist/components/ErrorView.d.ts +1 -1
  24. package/dist/components/FieldCaption.d.ts +5 -0
  25. package/dist/components/HomePage/DefaultHomePage.d.ts +1 -1
  26. package/dist/components/HomePage/NavigationCard.d.ts +8 -0
  27. package/dist/components/HomePage/{NavigationCollectionCard.d.ts → NavigationCardBinding.d.ts} +3 -3
  28. package/dist/components/HomePage/SmallNavigationCard.d.ts +6 -0
  29. package/dist/components/HomePage/index.d.ts +3 -1
  30. package/dist/components/ReferenceWidget.d.ts +6 -4
  31. package/dist/components/SelectableTable/SelectableTable.d.ts +1 -1
  32. package/dist/components/SelectableTable/filters/ReferenceFilterField.d.ts +2 -1
  33. package/dist/components/VirtualTable/VirtualTableProps.d.ts +16 -13
  34. package/dist/components/VirtualTable/types.d.ts +3 -3
  35. package/dist/components/{EntityCollectionTable/internal → common}/default_entity_actions.d.ts +1 -1
  36. package/dist/components/common/index.d.ts +1 -0
  37. package/dist/components/common/table_height.d.ts +5 -0
  38. package/dist/components/common/types.d.ts +4 -6
  39. package/dist/components/common/useColumnsIds.d.ts +2 -1
  40. package/dist/components/common/useDataSourceEntityCollectionTableController.d.ts +3 -0
  41. package/dist/components/index.d.ts +6 -4
  42. package/dist/contexts/AuthControllerContext.d.ts +1 -1
  43. package/dist/{components/FireCMSAppBar.d.ts → core/DefaultAppBar.d.ts} +6 -9
  44. package/dist/core/DefaultDrawer.d.ts +19 -0
  45. package/dist/core/DrawerNavigationItem.d.ts +9 -0
  46. package/dist/core/EntityEditView.d.ts +36 -0
  47. package/dist/core/FireCMS.d.ts +1 -1
  48. package/dist/core/NavigationRoutes.d.ts +3 -3
  49. package/dist/core/index.d.ts +3 -6
  50. package/dist/form/PropertiesForm.d.ts +8 -0
  51. package/dist/form/PropertyFieldBinding.d.ts +1 -1
  52. package/dist/form/components/ErrorFocus.d.ts +1 -1
  53. package/dist/form/components/FieldHelperText.d.ts +3 -3
  54. package/dist/form/components/StorageItemPreview.d.ts +4 -3
  55. package/dist/form/components/StorageUploadProgress.d.ts +1 -1
  56. package/dist/form/components/index.d.ts +1 -0
  57. package/dist/form/field_bindings/KeyValueFieldBinding.d.ts +1 -1
  58. package/dist/form/field_bindings/MapFieldBinding.d.ts +1 -1
  59. package/dist/form/field_bindings/StorageUploadFieldBinding.d.ts +3 -4
  60. package/dist/form/field_bindings/TextFieldBinding.d.ts +2 -2
  61. package/dist/form/index.d.ts +1 -2
  62. package/dist/form/validation.d.ts +1 -1
  63. package/dist/hooks/data/delete.d.ts +2 -2
  64. package/dist/hooks/data/save.d.ts +2 -3
  65. package/dist/hooks/data/useDataSource.d.ts +2 -2
  66. package/dist/hooks/data/useEntityFetch.d.ts +3 -3
  67. package/dist/hooks/index.d.ts +4 -1
  68. package/dist/{core → hooks}/useBuildModeController.d.ts +1 -1
  69. package/dist/hooks/useBuildNavigationController.d.ts +6 -4
  70. package/dist/hooks/useProjectLog.d.ts +6 -2
  71. package/dist/hooks/useStorageSource.d.ts +2 -2
  72. package/dist/hooks/useValidateAuthenticator.d.ts +21 -0
  73. package/dist/index.d.ts +1 -0
  74. package/dist/index.es.js +16400 -12423
  75. package/dist/index.es.js.map +1 -1
  76. package/dist/index.umd.js +19713 -7
  77. package/dist/index.umd.js.map +1 -1
  78. package/dist/internal/useBuildDataSource.d.ts +1 -12
  79. package/dist/preview/PropertyPreview.d.ts +1 -1
  80. package/dist/preview/PropertyPreviewProps.d.ts +6 -4
  81. package/dist/preview/components/BooleanPreview.d.ts +5 -1
  82. package/dist/preview/components/EnumValuesChip.d.ts +1 -1
  83. package/dist/preview/components/ReferencePreview.d.ts +3 -8
  84. package/dist/preview/components/StorageThumbnail.d.ts +2 -1
  85. package/dist/preview/components/UrlComponentPreview.d.ts +2 -1
  86. package/dist/types/analytics.d.ts +1 -1
  87. package/dist/types/auth.d.ts +38 -2
  88. package/dist/types/collections.d.ts +45 -8
  89. package/dist/types/datasource.d.ts +34 -20
  90. package/dist/types/entities.d.ts +6 -1
  91. package/dist/types/entity_actions.d.ts +14 -0
  92. package/dist/types/entity_callbacks.d.ts +2 -2
  93. package/dist/types/entity_overrides.d.ts +6 -0
  94. package/dist/types/fields.d.ts +36 -30
  95. package/dist/types/index.d.ts +2 -1
  96. package/dist/types/navigation.d.ts +15 -14
  97. package/dist/types/permissions.d.ts +5 -1
  98. package/dist/types/plugins.d.ts +31 -23
  99. package/dist/types/properties.d.ts +34 -21
  100. package/dist/types/property_config.d.ts +2 -2
  101. package/dist/types/roles.d.ts +31 -0
  102. package/dist/types/storage.d.ts +11 -3
  103. package/dist/types/user.d.ts +5 -0
  104. package/dist/util/collections.d.ts +9 -1
  105. package/dist/util/entities.d.ts +1 -1
  106. package/dist/util/icon_list.d.ts +5 -1
  107. package/dist/util/icon_synonyms.d.ts +1 -97
  108. package/dist/util/icons.d.ts +9 -3
  109. package/dist/util/index.d.ts +1 -0
  110. package/dist/util/navigation_utils.d.ts +2 -2
  111. package/dist/util/objects.d.ts +1 -1
  112. package/dist/util/permissions.d.ts +4 -4
  113. package/dist/util/plurals.d.ts +0 -2
  114. package/dist/util/references.d.ts +4 -2
  115. package/dist/util/resolutions.d.ts +15 -14
  116. package/dist/util/storage.d.ts +23 -2
  117. package/dist/util/useStorageUploadController.d.ts +1 -1
  118. package/dist/util/useTraceUpdate.d.ts +1 -0
  119. package/package.json +128 -119
  120. package/src/app/AppBar.tsx +18 -0
  121. package/src/app/Drawer.tsx +25 -0
  122. package/src/app/Scaffold.tsx +251 -0
  123. package/src/app/index.ts +4 -0
  124. package/src/app/useApp.tsx +32 -0
  125. package/src/components/ArrayContainer.tsx +1 -1
  126. package/src/components/CircularProgressCenter.tsx +1 -1
  127. package/src/components/ClearFilterSortButton.tsx +41 -0
  128. package/src/components/DeleteEntityDialog.tsx +4 -4
  129. package/src/components/EntityCollectionTable/EntityCollectionRowActions.tsx +11 -21
  130. package/src/components/EntityCollectionTable/EntityCollectionTable.tsx +276 -279
  131. package/src/components/EntityCollectionTable/EntityCollectionTableProps.tsx +9 -5
  132. package/src/components/EntityCollectionTable/PropertyTableCell.tsx +49 -45
  133. package/src/components/EntityCollectionTable/column_utils.tsx +3 -3
  134. package/src/components/EntityCollectionTable/fields/TableReferenceField.tsx +20 -18
  135. package/src/components/EntityCollectionTable/fields/TableStorageUpload.tsx +17 -9
  136. package/src/components/EntityCollectionTable/internal/CollectionTableToolbar.tsx +29 -34
  137. package/src/components/EntityCollectionTable/internal/EntityTableCell.tsx +16 -12
  138. package/src/components/EntityCollectionTable/internal/popup_field/PopupFormField.tsx +4 -5
  139. package/src/components/EntityCollectionView/EntityCollectionView.tsx +95 -92
  140. package/src/components/EntityCollectionView/EntityCollectionViewActions.tsx +5 -6
  141. package/src/components/EntityCollectionView/EntityCollectionViewStartActions.tsx +68 -0
  142. package/src/components/EntityCollectionView/useSelectionController.tsx +42 -0
  143. package/src/components/EntityPreview.tsx +210 -70
  144. package/src/components/EntityView.tsx +84 -0
  145. package/src/components/ErrorView.tsx +1 -1
  146. package/src/components/FieldCaption.tsx +14 -0
  147. package/src/components/HomePage/DefaultHomePage.tsx +37 -24
  148. package/src/components/HomePage/NavigationCard.tsx +69 -0
  149. package/src/components/HomePage/NavigationCardBinding.tsx +116 -0
  150. package/src/components/HomePage/SmallNavigationCard.tsx +45 -0
  151. package/src/components/HomePage/index.tsx +3 -1
  152. package/src/components/PropertyIdCopyTooltipContent.tsx +2 -3
  153. package/src/components/ReferenceTable/ReferenceSelectionTable.tsx +4 -4
  154. package/src/components/ReferenceWidget.tsx +26 -16
  155. package/src/components/SearchIconsView.tsx +9 -6
  156. package/src/components/SelectableTable/SelectableTable.tsx +7 -7
  157. package/src/components/SelectableTable/filters/BooleanFilterField.tsx +2 -3
  158. package/src/components/SelectableTable/filters/DateTimeFilterField.tsx +22 -7
  159. package/src/components/SelectableTable/filters/ReferenceFilterField.tsx +38 -24
  160. package/src/components/SelectableTable/filters/StringNumberFilterField.tsx +35 -15
  161. package/src/components/VirtualTable/VirtualTable.tsx +70 -37
  162. package/src/components/VirtualTable/VirtualTableCell.tsx +1 -1
  163. package/src/components/VirtualTable/VirtualTableHeader.tsx +4 -4
  164. package/src/components/VirtualTable/VirtualTableHeaderRow.tsx +2 -2
  165. package/src/components/VirtualTable/VirtualTableProps.tsx +19 -15
  166. package/src/components/VirtualTable/VirtualTableRow.tsx +4 -5
  167. package/src/components/VirtualTable/fields/VirtualTableDateField.tsx +1 -1
  168. package/src/components/VirtualTable/types.tsx +2 -3
  169. package/src/components/{EntityCollectionTable/internal → common}/default_entity_actions.tsx +11 -7
  170. package/src/components/common/index.ts +1 -0
  171. package/src/components/{VirtualTable/common.tsx → common/table_height.tsx} +5 -2
  172. package/src/components/common/types.tsx +4 -6
  173. package/src/components/common/useColumnsIds.tsx +23 -2
  174. package/src/components/common/useDataSourceEntityCollectionTableController.tsx +12 -1
  175. package/src/components/common/useTableSearchHelper.ts +52 -12
  176. package/src/components/index.tsx +6 -4
  177. package/src/contexts/AuthControllerContext.tsx +1 -1
  178. package/src/contexts/DialogsProvider.tsx +2 -2
  179. package/src/{components/FireCMSAppBar.tsx → core/DefaultAppBar.tsx} +60 -37
  180. package/src/core/DefaultDrawer.tsx +177 -0
  181. package/src/core/DrawerNavigationItem.tsx +62 -0
  182. package/src/core/EntityEditView.tsx +1130 -0
  183. package/src/core/EntitySidePanel.tsx +3 -4
  184. package/src/core/FireCMS.tsx +55 -44
  185. package/src/core/NavigationRoutes.tsx +15 -8
  186. package/src/core/SideDialogs.tsx +1 -0
  187. package/src/core/field_configs.tsx +2 -3
  188. package/src/core/index.tsx +3 -6
  189. package/src/form/PropertiesForm.tsx +81 -0
  190. package/src/form/PropertyFieldBinding.tsx +38 -9
  191. package/src/form/components/FieldHelperText.tsx +3 -3
  192. package/src/form/components/StorageItemPreview.tsx +21 -10
  193. package/src/form/components/StorageUploadProgress.tsx +9 -8
  194. package/src/form/components/index.tsx +1 -0
  195. package/src/form/field_bindings/ArrayCustomShapedFieldBinding.tsx +10 -8
  196. package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +18 -18
  197. package/src/form/field_bindings/BlockFieldBinding.tsx +4 -5
  198. package/src/form/field_bindings/DateTimeFieldBinding.tsx +3 -3
  199. package/src/form/field_bindings/KeyValueFieldBinding.tsx +62 -57
  200. package/src/form/field_bindings/MapFieldBinding.tsx +28 -20
  201. package/src/form/field_bindings/MarkdownFieldBinding.tsx +3 -4
  202. package/src/form/field_bindings/MultiSelectBinding.tsx +2 -3
  203. package/src/form/field_bindings/ReadOnlyFieldBinding.tsx +4 -11
  204. package/src/form/field_bindings/ReferenceFieldBinding.tsx +21 -17
  205. package/src/form/field_bindings/RepeatFieldBinding.tsx +14 -11
  206. package/src/form/field_bindings/SelectFieldBinding.tsx +5 -6
  207. package/src/form/field_bindings/StorageUploadFieldBinding.tsx +28 -40
  208. package/src/form/field_bindings/SwitchFieldBinding.tsx +3 -4
  209. package/src/form/field_bindings/TextFieldBinding.tsx +10 -9
  210. package/src/form/index.tsx +5 -4
  211. package/src/form/validation.ts +4 -21
  212. package/src/hooks/data/delete.ts +3 -3
  213. package/src/hooks/data/save.ts +4 -2
  214. package/src/hooks/data/useCollectionFetch.tsx +1 -1
  215. package/src/hooks/data/useDataSource.tsx +7 -2
  216. package/src/hooks/data/useEntityFetch.tsx +4 -4
  217. package/src/hooks/index.tsx +6 -1
  218. package/src/{core → hooks}/useBuildLocalConfigurationPersistence.tsx +8 -10
  219. package/src/{core → hooks}/useBuildModeController.tsx +12 -6
  220. package/src/hooks/useBuildNavigationController.tsx +208 -92
  221. package/src/hooks/useProjectLog.tsx +30 -9
  222. package/src/hooks/useReferenceDialog.tsx +2 -2
  223. package/src/hooks/useResolvedNavigationFrom.tsx +1 -1
  224. package/src/hooks/useStorageSource.tsx +7 -2
  225. package/src/hooks/useValidateAuthenticator.tsx +115 -0
  226. package/src/index.ts +1 -0
  227. package/src/internal/useBuildDataSource.ts +56 -44
  228. package/src/internal/useBuildSideEntityController.tsx +88 -21
  229. package/src/preview/PropertyPreview.tsx +11 -18
  230. package/src/preview/PropertyPreviewProps.tsx +4 -8
  231. package/src/preview/components/BooleanPreview.tsx +19 -4
  232. package/src/preview/components/EnumValuesChip.tsx +2 -2
  233. package/src/preview/components/ImagePreview.tsx +21 -33
  234. package/src/preview/components/ReferencePreview.tsx +74 -166
  235. package/src/preview/components/StorageThumbnail.tsx +5 -1
  236. package/src/preview/components/UrlComponentPreview.tsx +44 -11
  237. package/src/preview/property_previews/ArrayOfMapsPreview.tsx +0 -1
  238. package/src/preview/property_previews/ArrayOfReferencesPreview.tsx +2 -1
  239. package/src/preview/property_previews/ArrayOfStorageComponentsPreview.tsx +0 -1
  240. package/src/preview/property_previews/ArrayOfStringsPreview.tsx +0 -1
  241. package/src/preview/property_previews/ArrayOneOfPreview.tsx +2 -3
  242. package/src/preview/property_previews/ArrayPropertyPreview.tsx +2 -3
  243. package/src/preview/property_previews/MapPropertyPreview.tsx +5 -5
  244. package/src/preview/property_previews/StringPropertyPreview.tsx +8 -7
  245. package/src/types/analytics.ts +1 -0
  246. package/src/types/auth.tsx +51 -2
  247. package/src/types/collections.ts +52 -8
  248. package/src/types/customization_controller.tsx +0 -1
  249. package/src/types/datasource.ts +41 -24
  250. package/src/types/entities.ts +13 -1
  251. package/src/types/entity_actions.tsx +17 -0
  252. package/src/types/entity_callbacks.ts +2 -2
  253. package/src/types/entity_overrides.tsx +7 -0
  254. package/src/types/fields.tsx +39 -33
  255. package/src/types/firecms.tsx +0 -1
  256. package/src/types/index.ts +2 -1
  257. package/src/types/navigation.ts +17 -17
  258. package/src/types/permissions.ts +6 -1
  259. package/src/types/plugins.tsx +38 -31
  260. package/src/types/properties.ts +40 -22
  261. package/src/types/property_config.tsx +2 -2
  262. package/src/types/roles.ts +41 -0
  263. package/src/types/side_entity_controller.tsx +1 -0
  264. package/src/types/storage.ts +12 -3
  265. package/src/types/user.ts +7 -0
  266. package/src/util/collections.ts +22 -0
  267. package/src/util/entities.ts +5 -4
  268. package/src/util/enums.ts +1 -1
  269. package/src/util/icon_list.ts +15 -10
  270. package/src/util/icon_synonyms.ts +3 -99
  271. package/src/util/icons.tsx +11 -3
  272. package/src/util/index.ts +1 -0
  273. package/src/util/navigation_utils.ts +6 -6
  274. package/src/util/objects.ts +25 -28
  275. package/src/util/permissions.ts +12 -8
  276. package/src/util/plurals.ts +0 -2
  277. package/src/util/references.ts +36 -5
  278. package/src/util/resolutions.ts +44 -39
  279. package/src/util/storage.ts +75 -21
  280. package/src/util/strings.ts +2 -2
  281. package/src/util/useStorageUploadController.tsx +21 -3
  282. package/src/util/useTraceUpdate.tsx +2 -1
  283. package/dist/components/VirtualTable/common.d.ts +0 -2
  284. package/dist/core/Drawer.d.ts +0 -23
  285. package/dist/core/Scaffold.d.ts +0 -55
  286. package/dist/form/EntityForm.d.ts +0 -77
  287. package/dist/internal/EntityView.d.ts +0 -22
  288. package/dist/internal/useBuildCustomizationController.d.ts +0 -2
  289. package/dist/internal/useLocaleConfig.d.ts +0 -1
  290. package/dist/types/appcheck.d.ts +0 -26
  291. package/src/components/HomePage/NavigationCollectionCard.tsx +0 -146
  292. package/src/core/Drawer.tsx +0 -164
  293. package/src/core/Scaffold.tsx +0 -281
  294. package/src/form/EntityForm.tsx +0 -720
  295. package/src/internal/EntityView.tsx +0 -578
  296. package/src/internal/useBuildCustomizationController.tsx +0 -5
  297. package/src/internal/useLocaleConfig.tsx +0 -18
  298. package/src/types/appcheck.ts +0 -29
  299. /package/dist/{components → form/components}/LabelWithIcon.d.ts +0 -0
  300. /package/dist/{core → hooks}/useBuildLocalConfigurationPersistence.d.ts +0 -0
  301. /package/src/{components → form/components}/LabelWithIcon.tsx +0 -0
@@ -4,7 +4,7 @@ import { EntitySidePanelProps } from "../types";
4
4
  import { useNavigationController } from "../hooks";
5
5
 
6
6
  import { ErrorBoundary } from "../components";
7
- import { EntityView } from "../internal/EntityView";
7
+ import { EntityEditView } from "./EntityEditView";
8
8
  import { useSideDialogContext } from "./SideDialogs";
9
9
 
10
10
  /**
@@ -33,7 +33,7 @@ export function EntitySidePanel(props: EntitySidePanelProps) {
33
33
  if (!props) return undefined;
34
34
  let usedCollection = props.collection;
35
35
 
36
- const registryCollection = navigationController.getCollection(props.path, props.entityId);
36
+ const registryCollection = navigationController.getCollection(props.path);
37
37
  if (registryCollection) {
38
38
  usedCollection = registryCollection;
39
39
  }
@@ -77,9 +77,8 @@ export function EntitySidePanel(props: EntitySidePanelProps) {
77
77
  return (
78
78
  <>
79
79
  <ErrorBoundary>
80
- <EntityView
80
+ <EntityEditView
81
81
  {...props}
82
- formWidth={props.width}
83
82
  collection={collection}
84
83
  parentCollectionIds={parentCollectionIds}
85
84
  onValuesAreModified={onValuesAreModified}
@@ -1,9 +1,9 @@
1
1
  import React, { useMemo } from "react";
2
2
 
3
- import { EntityCollection, FireCMSContext, FireCMSPlugin, FireCMSProps, User } from "../types";
4
- import { AuthControllerContext, ModeControllerContext } from "../contexts";
3
+ import { CustomizationController, EntityCollection, FireCMSContext, FireCMSPlugin, FireCMSProps, User } from "../types";
4
+ import { AuthControllerContext } from "../contexts";
5
5
  import { useBuildSideEntityController } from "../internal/useBuildSideEntityController";
6
- import { useCustomizationController, useFireCMSContext, useModeController } from "../hooks";
6
+ import { useCustomizationController, useFireCMSContext } from "../hooks";
7
7
  import { useBuildSideDialogsController } from "../internal/useBuildSideDialogsController";
8
8
  import { ErrorView } from "../components";
9
9
  import { StorageSourceContext } from "../contexts/StorageSourceContext";
@@ -12,11 +12,9 @@ import { DataSourceContext } from "../contexts/DataSourceContext";
12
12
  import { SideEntityControllerContext } from "../contexts/SideEntityControllerContext";
13
13
  import { NavigationContext } from "../contexts/NavigationContext";
14
14
  import { SideDialogsControllerContext } from "../contexts/SideDialogsControllerContext";
15
- import { useLocaleConfig } from "../internal/useLocaleConfig";
16
- import { CenteredView } from "@firecms/ui";
15
+ import { CenteredView, Typography, useLocaleConfig } from "@firecms/ui";
17
16
  import { DialogsProvider } from "../contexts/DialogsProvider";
18
17
  import { useBuildDataSource } from "../internal/useBuildDataSource";
19
- import { useBuildCustomizationController } from "../internal/useBuildCustomizationController";
20
18
  import { CustomizationControllerContext } from "../contexts/CustomizationControllerContext";
21
19
  import { AnalyticsContext } from "../contexts/AnalyticsContext";
22
20
  import { useProjectLog } from "../hooks/useProjectLog";
@@ -30,12 +28,11 @@ import { useProjectLog } from "../hooks/useProjectLog";
30
28
  *
31
29
  * You only need to use this component if you are building a custom app.
32
30
  *
33
- * @constructor
31
+
34
32
  * @group Core
35
33
  */
36
34
  export function FireCMS<UserType extends User, EC extends EntityCollection>(props: FireCMSProps<UserType, EC>) {
37
35
 
38
- const modeController = useModeController();
39
36
  const {
40
37
  children,
41
38
  entityLinkBuilder,
@@ -71,7 +68,7 @@ export function FireCMS<UserType extends User, EC extends EntityCollection>(prop
71
68
 
72
69
  const loading = authController.initialLoading || navigationController.loading || pluginsLoading;
73
70
 
74
- const customizationController = useBuildCustomizationController({
71
+ const customizationController: CustomizationController = {
75
72
  dateTimeFormat,
76
73
  locale,
77
74
  entityLinkBuilder,
@@ -79,13 +76,13 @@ export function FireCMS<UserType extends User, EC extends EntityCollection>(prop
79
76
  entityViews: entityViews ?? [],
80
77
  propertyConfigs: propertyConfigs ?? {},
81
78
  components
82
- });
79
+ };
83
80
 
84
81
  const analyticsController = useMemo(() => ({
85
82
  onAnalyticsEvent
86
83
  }), []);
87
84
 
88
- useProjectLog(authController);
85
+ const accessResponse = useProjectLog(authController, dataSourceDelegate, plugins);
89
86
 
90
87
  if (navigationController.navigationLoadingError) {
91
88
  return (
@@ -107,40 +104,54 @@ export function FireCMS<UserType extends User, EC extends EntityCollection>(prop
107
104
  );
108
105
  }
109
106
 
107
+ if (accessResponse?.blocked) {
108
+ return (
109
+ <CenteredView maxWidth={"md"} fullScreen={true}>
110
+ <Typography variant={"h4"}>
111
+ Access blocked
112
+ </Typography>
113
+ <Typography>
114
+ This app has been blocked. Please reach out at <a
115
+ href={"mailto:hello@firecms.co"}>hello@firecms.co</a> for more information.
116
+ </Typography>
117
+ {accessResponse?.message &&
118
+ <Typography>Response from the server: {accessResponse?.message}</Typography>}
119
+ </CenteredView>
120
+ );
121
+ }
122
+
110
123
  return (
111
- <ModeControllerContext.Provider value={modeController}>
112
- <AnalyticsContext.Provider value={analyticsController}>
113
- <CustomizationControllerContext.Provider value={customizationController}>
114
- <UserConfigurationPersistenceContext.Provider
115
- value={userConfigPersistence}>
116
- <StorageSourceContext.Provider
117
- value={storageSource}>
118
- <DataSourceContext.Provider
119
- value={dataSource}>
120
- <AuthControllerContext.Provider
121
- value={authController}>
122
- <SideDialogsControllerContext.Provider
123
- value={sideDialogsController}>
124
- <SideEntityControllerContext.Provider
125
- value={sideEntityController}>
126
- <NavigationContext.Provider
127
- value={navigationController}>
128
- <DialogsProvider>
129
- <FireCMSInternal
130
- loading={loading}>
131
- {children}
132
- </FireCMSInternal>
133
- </DialogsProvider>
134
- </NavigationContext.Provider>
135
- </SideEntityControllerContext.Provider>
136
- </SideDialogsControllerContext.Provider>
137
- </AuthControllerContext.Provider>
138
- </DataSourceContext.Provider>
139
- </StorageSourceContext.Provider>
140
- </UserConfigurationPersistenceContext.Provider>
141
- </CustomizationControllerContext.Provider>
142
- </AnalyticsContext.Provider>
143
- </ModeControllerContext.Provider>
124
+ <AnalyticsContext.Provider value={analyticsController}>
125
+ <CustomizationControllerContext.Provider value={customizationController}>
126
+ <UserConfigurationPersistenceContext.Provider
127
+ value={userConfigPersistence}>
128
+ <StorageSourceContext.Provider
129
+ value={storageSource}>
130
+ <DataSourceContext.Provider
131
+ value={dataSource}>
132
+ <AuthControllerContext.Provider
133
+ value={authController}>
134
+ <SideDialogsControllerContext.Provider
135
+ value={sideDialogsController}>
136
+ <SideEntityControllerContext.Provider
137
+ value={sideEntityController}>
138
+ <NavigationContext.Provider
139
+ value={navigationController}>
140
+ <DialogsProvider>
141
+ <FireCMSInternal
142
+ loading={loading}>
143
+ {children}
144
+ </FireCMSInternal>
145
+ </DialogsProvider>
146
+ </NavigationContext.Provider>
147
+ </SideEntityControllerContext.Provider>
148
+ </SideDialogsControllerContext.Provider>
149
+ </AuthControllerContext.Provider>
150
+ </DataSourceContext.Provider>
151
+ </StorageSourceContext.Provider>
152
+ </UserConfigurationPersistenceContext.Provider>
153
+ </CustomizationControllerContext.Provider>
154
+ </AnalyticsContext.Provider>
144
155
  );
145
156
 
146
157
  }
@@ -13,9 +13,9 @@ export type NavigationRoutesProps = {
13
13
  /**
14
14
  * In case you need to override the home page
15
15
  */
16
- HomePage?: React.ComponentType;
16
+ homePage?: React.ReactNode;
17
17
 
18
- customRoutes?: React.ReactNode[]
18
+ children?: React.ReactNode | React.ReactNode[]
19
19
 
20
20
  };
21
21
 
@@ -25,14 +25,13 @@ export type NavigationRoutesProps = {
25
25
  * or the home route) related to a {@link NavigationController}.
26
26
  * This component needs a parent {@link FireCMS}
27
27
  *
28
- * @constructor
28
+
29
29
  * @group Components
30
30
  */
31
-
32
31
  export const NavigationRoutes = React.memo<NavigationRoutesProps>(
33
32
  function NavigationRoutes({
34
- HomePage = DefaultHomePage,
35
- customRoutes
33
+ homePage = <DefaultHomePage/>,
34
+ children
36
35
  }: NavigationRoutesProps) {
37
36
 
38
37
  const location = useLocation();
@@ -59,6 +58,14 @@ export const NavigationRoutes = React.memo<NavigationRoutesProps>(
59
58
  cmsViews.push(buildCMSViewRoute(cmsView.path, cmsView));
60
59
  });
61
60
  }
61
+ if (navigation.adminViews) {
62
+ navigation.adminViews.forEach((cmsView) => {
63
+ if (Array.isArray(cmsView.path))
64
+ cmsViews.push(...cmsView.path.map(path => buildCMSViewRoute(path, cmsView)));
65
+ else
66
+ cmsViews.push(buildCMSViewRoute(cmsView.path, cmsView));
67
+ });
68
+ }
62
69
 
63
70
  // we reorder collections so that nested paths are included first
64
71
  const sortedCollections = [...(navigation.collections ?? [])]
@@ -85,7 +92,7 @@ export const NavigationRoutes = React.memo<NavigationRoutesProps>(
85
92
 
86
93
  const homeRoute = (
87
94
  <Route path={"/"}
88
- element={<HomePage/>}/>
95
+ element={homePage}/>
89
96
  );
90
97
 
91
98
  const notFoundRoute = <Route path={"*"}
@@ -104,7 +111,7 @@ export const NavigationRoutes = React.memo<NavigationRoutesProps>(
104
111
 
105
112
  {notFoundRoute}
106
113
 
107
- {customRoutes}
114
+ {children}
108
115
 
109
116
  </Routes>
110
117
  );
@@ -126,6 +126,7 @@ function SideDialogView({
126
126
  <Sheet
127
127
  open={Boolean(panel)}
128
128
  onOpenChange={(open) => !open && onCloseRequest()}
129
+ title={"Side dialog " + panel?.key}
129
130
  >
130
131
  {panel &&
131
132
  <div
@@ -331,7 +331,7 @@ export function getFieldConfig(property: Property | ResolvedProperty, propertyCo
331
331
  }
332
332
  const defaultFieldConfig = DEFAULT_FIELD_CONFIGS[defaultFieldId];
333
333
  const customField = fieldId ? propertyConfigs[fieldId] : undefined;
334
- return mergeDeep(defaultFieldConfig ?? {}, customField ?? {});
334
+ return mergeDeep(defaultFieldConfig ?? {}, customField ?? {} as PropertyConfig);
335
335
  }
336
336
 
337
337
  export function getDefaultFieldId(property: Property | ResolvedProperty) {
@@ -359,8 +359,7 @@ export function getDefaultFieldId(property: Property | ResolvedProperty) {
359
359
  } else if (property.dataType === "map") {
360
360
  if (property.keyValue)
361
361
  return "key_value";
362
- if (property.properties)
363
- return "group";
362
+ return "group";
364
363
  } else if (property.dataType === "array") {
365
364
  const of = (property as ArrayProperty).of;
366
365
  const oneOf = (property as ArrayProperty).oneOf;
@@ -1,14 +1,11 @@
1
1
  export * from "./FireCMS";
2
2
 
3
- export type { ScaffoldProps } from "./Scaffold";
4
- export { Scaffold } from "./Scaffold";
3
+ export * from "../app/Scaffold";
5
4
 
6
- export type { DrawerProps } from "./Drawer";
7
- export { Drawer, DrawerNavigationItem } from "./Drawer";
5
+ export * from "./DefaultDrawer";
6
+ export * from "./DrawerNavigationItem";
8
7
 
9
8
  export * from "./field_configs";
10
9
 
11
10
  export * from "./SideDialogs";
12
11
  export * from "./NavigationRoutes";
13
- export * from "./useBuildModeController";
14
- export * from "./useBuildLocalConfigurationPersistence";
@@ -0,0 +1,81 @@
1
+ import { FormContext, PropertiesOrBuilders, PropertyFieldBindingProps } from "../types";
2
+ import { Tooltip } from "@firecms/ui";
3
+ import { PropertyIdCopyTooltipContent } from "../components/PropertyIdCopyTooltipContent";
4
+ import { PropertyFieldBinding } from "./PropertyFieldBinding";
5
+ import { ErrorBoundary } from "../components";
6
+ import { isHidden, isReadOnly, resolveProperties } from "../util";
7
+ import { FormexController } from "@firecms/formex";
8
+
9
+ export type PropertiesFormProps<M extends Record<string, any> = Record<string, any>> = {
10
+ properties: PropertiesOrBuilders<M>;
11
+ propertiesOrder?: string[];
12
+ formex: FormexController<M>;
13
+ }
14
+
15
+ export function PropertiesForm<M extends Record<string, any> = Record<string, any>>({
16
+ properties,
17
+ propertiesOrder,
18
+ formex
19
+ }: PropertiesFormProps<M>) {
20
+
21
+ const resolvedProperties = resolveProperties({ properties });
22
+
23
+ const formContext: FormContext<M> = {
24
+ // @ts-ignore
25
+ setFieldValue: useCallback(formex.setFieldValue, []),
26
+ values: formex.values ?? {},
27
+ // @ts-ignore
28
+ save: useCallback(() => {
29
+ throw new Error("Not implemented. You currently can't call save from a custom field, within a PropertiesForm (it works in standard Entity forms)");
30
+ }, []),
31
+ formex
32
+ };
33
+
34
+ const formFields = (
35
+ <div className={"flex flex-col gap-8"}>
36
+ {(propertiesOrder ?? Object.keys(resolvedProperties))
37
+ .map((key) => {
38
+
39
+ const property = resolvedProperties[key];
40
+ if (!property) {
41
+ console.warn(`Property ${key} not found in collection PropertiesForm`);
42
+ return null;
43
+ }
44
+
45
+ const disabled = formex.isSubmitting || isReadOnly(property) || Boolean(property.disabled);
46
+ const hidden = isHidden(property);
47
+ if (hidden) return null;
48
+ const cmsFormFieldProps: PropertyFieldBindingProps<any, M> = {
49
+ propertyKey: key,
50
+ disabled,
51
+ property,
52
+ includeDescription: property.description || property.longDescription,
53
+ context: formContext,
54
+ tableMode: false,
55
+ partOfArray: false,
56
+ partOfBlock: false,
57
+ autoFocus: false
58
+ };
59
+
60
+ return (
61
+ <div id={`form_field_${key}`}
62
+ key={`field_${key}`}>
63
+ <ErrorBoundary>
64
+ <Tooltip title={<PropertyIdCopyTooltipContent propertyId={key}/>}
65
+ delayDuration={800}
66
+ side={"left"}
67
+ align={"start"}
68
+ sideOffset={16}>
69
+ <PropertyFieldBinding {...cmsFormFieldProps}/>
70
+ </Tooltip>
71
+ </ErrorBoundary>
72
+ </div>
73
+ );
74
+ })
75
+ .filter(Boolean)}
76
+
77
+ </div>
78
+ );
79
+
80
+ return <div></div>
81
+ }
@@ -51,6 +51,9 @@ export const PropertyFieldBinding = React.memo(PropertyFieldBindingInternal, (a:
51
51
  if (a.propertyKey !== b.propertyKey) {
52
52
  return false;
53
53
  }
54
+ if (a.index !== b.index) {
55
+ return false;
56
+ }
54
57
  const aIsBuilder = isPropertyBuilder(a.property) || a.property.fromBuilder;
55
58
  const bIsBuilder = isPropertyBuilder(b.property) || b.property.fromBuilder;
56
59
 
@@ -79,12 +82,14 @@ function PropertyFieldBindingInternal<T extends CMSType = CMSType, M extends Rec
79
82
  partOfArray,
80
83
  partOfBlock,
81
84
  autoFocus,
85
+ index,
82
86
  }: PropertyFieldBindingProps<T, M>): ReactElement<PropertyFieldBindingProps<T, M>> {
83
87
 
84
88
  const customizationController = useCustomizationController();
85
89
 
86
90
  return (
87
91
  <Field
92
+ key={propertyKey}
88
93
  name={propertyKey}
89
94
  >
90
95
  {(fieldProps) => {
@@ -92,12 +97,12 @@ function PropertyFieldBindingInternal<T extends CMSType = CMSType, M extends Rec
92
97
  let Component: ComponentType<FieldProps<T>> | undefined;
93
98
  const resolvedProperty: ResolvedProperty<T> | null = resolveProperty({
94
99
  propertyKey,
95
- propertyValue: fieldProps.field.value,
96
100
  propertyOrBuilder: property,
97
101
  values: fieldProps.form.values,
98
102
  path: context.path,
99
103
  entityId: context.entityId,
100
- fields: customizationController.propertyConfigs
104
+ fields: customizationController.propertyConfigs,
105
+ index
101
106
  });
102
107
 
103
108
  if (resolvedProperty === null || isHidden(resolvedProperty)) {
@@ -111,16 +116,22 @@ function PropertyFieldBindingInternal<T extends CMSType = CMSType, M extends Rec
111
116
  } else {
112
117
  const propertyConfig = getFieldConfig(resolvedProperty, customizationController.propertyConfigs);
113
118
  if (!propertyConfig) {
114
- console.log("INTERNAL: Could not find field config for property", { propertyKey, resolvedProperty, fields: customizationController.propertyConfigs, propertyConfig });
119
+ console.log("INTERNAL: Could not find field config for property", {
120
+ propertyKey,
121
+ resolvedProperty,
122
+ fields: customizationController.propertyConfigs,
123
+ propertyConfig
124
+ });
115
125
  throw new Error(`INTERNAL: Could not find field config for property ${propertyKey}`);
116
126
  }
117
127
  const configProperty = resolveProperty({
128
+ propertyKey,
118
129
  propertyOrBuilder: propertyConfig.property,
119
- propertyValue: fieldProps.field.value,
120
130
  values: fieldProps.form.values,
121
131
  path: context.path,
122
132
  entityId: context.entityId,
123
- fields: customizationController.propertyConfigs
133
+ fields: customizationController.propertyConfigs,
134
+ index
124
135
  });
125
136
  Component = configProperty.Field as ComponentType<FieldProps<T>>;
126
137
  }
@@ -196,7 +207,14 @@ function FieldInternal<T extends CMSType, CustomProps, M extends Record<string,
196
207
  (fieldProps.form.submitCount > 0 || property.validation?.unique) &&
197
208
  (!Array.isArray(error) || !!error.filter((e: any) => !!e).length);
198
209
 
199
- const WrappedComponent: ComponentType<FieldProps<T, any, M>> | null = useWrappedComponent(context.path, context.collection, propertyKey, property, Component, plugins);
210
+ const WrappedComponent: ComponentType<FieldProps<T, any, M>> | null = useWrappedComponent({
211
+ path: context.path,
212
+ collection: context.collection,
213
+ propertyKey: propertyKey,
214
+ property: property,
215
+ Component: Component,
216
+ plugins: plugins
217
+ });
200
218
  const UsedComponent: ComponentType<FieldProps<T>> = WrappedComponent ?? Component;
201
219
 
202
220
  const isSubmitting = fieldProps.form.isSubmitting;
@@ -266,13 +284,24 @@ const shouldPropertyReRender = (property: PropertyOrBuilder | ResolvedProperty,
266
284
  }
267
285
  }
268
286
 
269
- function useWrappedComponent<T extends CMSType = CMSType, M extends Record<string, any> = any>(
270
- path: string,
271
- collection: EntityCollection<M>,
287
+ interface UseWrappedComponentParams<T extends CMSType = CMSType, M extends Record<string, any> = any> {
288
+ path?: string,
289
+ collection?: EntityCollection<M>,
272
290
  propertyKey: string,
273
291
  property: ResolvedProperty<T>,
274
292
  Component: ComponentType<FieldProps<T, any, M>>,
275
293
  plugins?: FireCMSPlugin[]
294
+ }
295
+
296
+ function useWrappedComponent<T extends CMSType = CMSType, M extends Record<string, any> = any>(
297
+ {
298
+ path,
299
+ collection,
300
+ propertyKey,
301
+ property,
302
+ Component,
303
+ plugins
304
+ }: UseWrappedComponentParams<T, M>
276
305
  ): ComponentType<FieldProps<T, any, M>> | null {
277
306
 
278
307
  const wrapperRef = useRef<ComponentType<FieldProps<T, any, M>> | null>((() => {
@@ -1,4 +1,4 @@
1
- import { ResolvedProperty } from "../../types";
1
+ import { Property, ResolvedProperty } from "../../types";
2
2
  import { IconButton, InfoIcon, Tooltip, Typography } from "@firecms/ui";
3
3
 
4
4
  /**
@@ -13,8 +13,8 @@ export function FieldHelperText({
13
13
  disabled
14
14
  }: {
15
15
  error?: string,
16
- showError: boolean,
17
- property: ResolvedProperty,
16
+ showError?: boolean,
17
+ property: ResolvedProperty | Property,
18
18
  includeDescription?: boolean,
19
19
  disabled?: boolean,
20
20
  }
@@ -1,37 +1,40 @@
1
1
  import React from "react";
2
2
 
3
- import { Entity, ResolvedStringProperty } from "../../types";
3
+ import { ResolvedStringProperty } from "../../types";
4
4
  import { PreviewSize, PropertyPreview } from "../../preview";
5
5
 
6
- import { cn, IconButton, paperMixin, RemoveIcon, Tooltip } from "@firecms/ui";
6
+ import { cls, DescriptionIcon, IconButton, paperMixin, RemoveIcon, Tooltip } from "@firecms/ui";
7
7
  import { ErrorBoundary } from "../../components";
8
8
 
9
9
  interface StorageItemPreviewProps {
10
10
  name: string;
11
11
  property: ResolvedStringProperty;
12
12
  value: string,
13
- entity: Entity<any>,
14
13
  onRemove: (value: string) => void;
15
14
  size: PreviewSize;
16
15
  disabled: boolean;
16
+ placeholder?: boolean;
17
+ className?: string;
17
18
  }
18
19
 
19
20
  export function StorageItemPreview({
20
21
  name,
21
22
  property,
22
23
  value,
23
- entity,
24
24
  onRemove,
25
25
  disabled,
26
- size
26
+ size,
27
+ placeholder,
28
+ className
27
29
  }: StorageItemPreviewProps) {
28
30
 
29
31
  return (
30
- <div className={cn(paperMixin,
32
+ <div className={cls(paperMixin,
31
33
  "relative m-4 border-box flex items-center justify-center",
32
- size === "medium" ? "min-w-[220px] min-h-[220px] max-w-[220px]" : "min-w-[118px] min-h-[118px] max-w-[118px]")}>
34
+ size === "medium" ? "min-w-[220px] min-h-[220px] max-w-[220px]" : "min-w-[118px] min-h-[118px] max-w-[118px]",
35
+ className)}>
33
36
 
34
- {!disabled &&
37
+ {!placeholder && !disabled &&
35
38
  <div
36
39
  className="absolute rounded-full -top-2 -right-2 z-10 bg-white dark:bg-gray-900">
37
40
 
@@ -49,16 +52,24 @@ export function StorageItemPreview({
49
52
  </div>
50
53
  }
51
54
 
52
- {value &&
55
+ {!placeholder && value &&
53
56
  <ErrorBoundary>
54
57
  <PropertyPreview propertyKey={name}
55
58
  value={value}
56
59
  property={property}
57
- // entity={entity}
60
+ interactive={false}
58
61
  size={size}/>
59
62
  </ErrorBoundary>
60
63
  }
61
64
 
65
+ {placeholder &&
66
+ <div
67
+ onClick={(e) => e.stopPropagation()}
68
+ className="flex flex-col items-center justify-center w-full h-full">
69
+ <DescriptionIcon className="text-gray-700 dark:text-gray-300"/>
70
+ </div>
71
+ }
72
+
62
73
 
63
74
  </div>
64
75
  );
@@ -3,7 +3,8 @@ import React, { useCallback } from "react";
3
3
  import { useSnackbarController, useStorageSource } from "../../hooks";
4
4
  import { StorageFieldItem } from "../../util/useStorageUploadController";
5
5
  import { ErrorView } from "../../components";
6
- import { cn, paperMixin, Skeleton } from "@firecms/ui";
6
+ import { cls, paperMixin, Skeleton } from "@firecms/ui";
7
+ import { EntityCollection, StorageSource } from "../../types";
7
8
 
8
9
  export interface StorageUploadItemProps {
9
10
  storagePath: string;
@@ -22,10 +23,10 @@ export function StorageUploadProgress({
22
23
  metadata,
23
24
  onFileUploadComplete,
24
25
  imageSize,
25
- simple
26
+ simple,
26
27
  }: StorageUploadItemProps) {
27
28
 
28
- const storage = useStorageSource();
29
+ const storageSource = useStorageSource();
29
30
 
30
31
  const snackbarController = useSnackbarController();
31
32
 
@@ -41,14 +42,14 @@ export function StorageUploadProgress({
41
42
  setError(undefined);
42
43
  setLoading(true);
43
44
 
44
- storage.uploadFile({
45
+ storageSource.uploadFile({
45
46
  file,
46
47
  fileName,
47
48
  path: storagePath,
48
49
  metadata
49
50
  })
50
51
  .then(async ({ path }) => {
51
- console.debug("Upload successful");
52
+ console.debug("Upload successful", path);
52
53
  await onFileUploadComplete(path, entry, metadata);
53
54
  if (mounted.current)
54
55
  setLoading(false);
@@ -67,7 +68,7 @@ export function StorageUploadProgress({
67
68
  .finally(() => {
68
69
  uploading.current = false;
69
70
  });
70
- }, [entry, metadata, onFileUploadComplete, storage, storagePath]);
71
+ }, [entry, metadata, onFileUploadComplete, storageSource, storagePath]);
71
72
 
72
73
  React.useEffect(() => {
73
74
  mounted.current = true;
@@ -87,9 +88,9 @@ export function StorageUploadProgress({
87
88
  }
88
89
  return (
89
90
 
90
- <div className={cn(paperMixin,
91
+ <div className={cls(paperMixin,
91
92
  "relative m-4 border-box flex items-center justify-center",
92
- `min-w-[${imageSize}px] min-h-[${imageSize}px]`)}>
93
+ `min-w-[${imageSize}px] min-h-[${imageSize}px]`)}>
93
94
 
94
95
  {loading &&
95
96
  <Skeleton className="w-full h-full"/>}
@@ -1,2 +1,3 @@
1
1
  export * from "./FormikArrayContainer";
2
2
  export * from "./FieldHelperText";
3
+ export * from "./LabelWithIcon";