@firecms/core 3.0.0-beta.10 → 3.0.0-beta.12

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 (267) hide show
  1. package/dist/components/ArrayContainer.d.ts +22 -6
  2. package/dist/components/EntityCollectionTable/EntityCollectionRowActions.d.ts +2 -1
  3. package/dist/components/EntityCollectionTable/EntityCollectionTable.d.ts +2 -2
  4. package/dist/components/EntityCollectionTable/EntityCollectionTableProps.d.ts +17 -3
  5. package/dist/components/EntityCollectionTable/index.d.ts +1 -1
  6. package/dist/components/EntityCollectionTable/internal/popup_field/PopupFormField.d.ts +6 -3
  7. package/dist/components/EntityCollectionView/EntityCollectionView.d.ts +4 -0
  8. package/dist/components/PropertyIdCopyTooltip.d.ts +1 -1
  9. package/dist/components/SelectableTable/SelectableTable.d.ts +12 -2
  10. package/dist/components/SelectableTable/filters/ReferenceFilterField.d.ts +1 -1
  11. package/dist/components/UnsavedChangesDialog.d.ts +8 -0
  12. package/dist/components/VirtualTable/VirtualTableProps.d.ts +13 -0
  13. package/dist/components/common/default_entity_actions.d.ts +0 -2
  14. package/dist/components/common/index.d.ts +1 -1
  15. package/dist/components/common/useColumnsIds.d.ts +1 -0
  16. package/dist/components/common/{useDataSourceEntityCollectionTableController.d.ts → useDataSourceTableController.d.ts} +10 -2
  17. package/dist/components/common/useDebouncedCallback.d.ts +1 -0
  18. package/dist/components/common/useScrollRestoration.d.ts +14 -0
  19. package/dist/contexts/BreacrumbsContext.d.ts +8 -0
  20. package/dist/core/EntityEditView.d.ts +30 -22
  21. package/dist/core/EntityEditViewFormActions.d.ts +2 -0
  22. package/dist/core/FireCMS.d.ts +1 -1
  23. package/dist/core/FireCMSRouter.d.ts +4 -0
  24. package/dist/core/NavigationRoutes.d.ts +0 -1
  25. package/dist/core/SideDialogs.d.ts +4 -2
  26. package/dist/core/index.d.ts +2 -1
  27. package/dist/form/EntityForm.d.ts +45 -0
  28. package/dist/form/EntityFormActions.d.ts +17 -0
  29. package/dist/form/PropertyFieldBinding.d.ts +1 -1
  30. package/dist/form/components/FormEntry.d.ts +6 -0
  31. package/dist/form/components/FormLayout.d.ts +5 -0
  32. package/dist/form/components/index.d.ts +2 -1
  33. package/dist/form/field_bindings/ArrayCustomShapedFieldBinding.d.ts +1 -1
  34. package/dist/form/field_bindings/ArrayOfReferencesFieldBinding.d.ts +1 -1
  35. package/dist/form/field_bindings/BlockFieldBinding.d.ts +1 -1
  36. package/dist/form/field_bindings/MapFieldBinding.d.ts +1 -1
  37. package/dist/form/field_bindings/MarkdownEditorFieldBinding.d.ts +1 -1
  38. package/dist/form/field_bindings/ReferenceFieldBinding.d.ts +2 -2
  39. package/dist/form/field_bindings/RepeatFieldBinding.d.ts +1 -1
  40. package/dist/form/field_bindings/SwitchFieldBinding.d.ts +1 -2
  41. package/dist/form/index.d.ts +16 -16
  42. package/dist/hooks/data/delete.d.ts +4 -4
  43. package/dist/hooks/data/save.d.ts +3 -3
  44. package/dist/hooks/data/useCollectionFetch.d.ts +1 -1
  45. package/dist/hooks/data/useEntityFetch.d.ts +4 -3
  46. package/dist/hooks/useAuthController.d.ts +1 -1
  47. package/dist/hooks/useBreadcrumbsController.d.ts +26 -0
  48. package/dist/hooks/useBuildNavigationController.d.ts +7 -4
  49. package/dist/hooks/useFireCMSContext.d.ts +1 -1
  50. package/dist/hooks/useModeController.d.ts +1 -2
  51. package/dist/hooks/useResolvedNavigationFrom.d.ts +3 -3
  52. package/dist/hooks/useValidateAuthenticator.d.ts +3 -3
  53. package/dist/index.es.js +17032 -12909
  54. package/dist/index.es.js.map +1 -1
  55. package/dist/index.umd.js +17019 -12898
  56. package/dist/index.umd.js.map +1 -1
  57. package/dist/internal/useBuildSideEntityController.d.ts +2 -2
  58. package/dist/internal/useUnsavedChangesDialog.d.ts +7 -9
  59. package/dist/preview/PropertyPreviewProps.d.ts +1 -1
  60. package/dist/preview/components/EnumValuesChip.d.ts +1 -1
  61. package/dist/preview/util.d.ts +3 -3
  62. package/dist/routes/CustomCMSRoute.d.ts +4 -0
  63. package/dist/routes/FireCMSRoute.d.ts +1 -0
  64. package/dist/routes/HomePageRoute.d.ts +3 -0
  65. package/dist/types/auth.d.ts +7 -9
  66. package/dist/types/collections.d.ts +44 -23
  67. package/dist/types/datasource.d.ts +2 -6
  68. package/dist/types/dialogs_controller.d.ts +7 -3
  69. package/dist/types/entities.d.ts +1 -1
  70. package/dist/types/entity_actions.d.ts +14 -4
  71. package/dist/types/entity_callbacks.d.ts +16 -16
  72. package/dist/types/export_import.d.ts +4 -4
  73. package/dist/types/fields.d.ts +27 -4
  74. package/dist/types/firecms.d.ts +2 -2
  75. package/dist/types/firecms_context.d.ts +1 -1
  76. package/dist/types/navigation.d.ts +29 -12
  77. package/dist/types/permissions.d.ts +4 -4
  78. package/dist/types/plugins.d.ts +9 -8
  79. package/dist/types/properties.d.ts +18 -3
  80. package/dist/types/property_config.d.ts +0 -2
  81. package/dist/types/side_entity_controller.d.ts +6 -1
  82. package/dist/types/user.d.ts +1 -0
  83. package/dist/util/builders.d.ts +3 -3
  84. package/dist/util/entities.d.ts +1 -1
  85. package/dist/util/entity_actions.d.ts +2 -0
  86. package/dist/util/entity_cache.d.ts +23 -0
  87. package/dist/util/icon_synonyms.d.ts +0 -1
  88. package/dist/util/icons.d.ts +3 -1
  89. package/dist/util/index.d.ts +1 -0
  90. package/dist/util/navigation_from_path.d.ts +6 -1
  91. package/dist/util/navigation_utils.d.ts +12 -1
  92. package/dist/util/objects.d.ts +1 -0
  93. package/dist/util/permissions.d.ts +4 -4
  94. package/dist/util/property_utils.d.ts +2 -2
  95. package/dist/util/resolutions.d.ts +12 -7
  96. package/package.json +129 -125
  97. package/src/app/Scaffold.tsx +4 -4
  98. package/src/components/ArrayContainer.tsx +115 -34
  99. package/src/components/CircularProgressCenter.tsx +1 -1
  100. package/src/components/ConfirmationDialog.tsx +2 -2
  101. package/src/components/DeleteEntityDialog.tsx +10 -19
  102. package/src/components/EntityCollectionTable/EntityCollectionRowActions.tsx +44 -20
  103. package/src/components/EntityCollectionTable/EntityCollectionTable.tsx +23 -17
  104. package/src/components/EntityCollectionTable/EntityCollectionTableProps.tsx +20 -3
  105. package/src/components/EntityCollectionTable/PropertyTableCell.tsx +6 -4
  106. package/src/components/EntityCollectionTable/fields/TableReferenceField.tsx +8 -9
  107. package/src/components/EntityCollectionTable/fields/TableStorageUpload.tsx +5 -11
  108. package/src/components/EntityCollectionTable/index.tsx +1 -1
  109. package/src/components/EntityCollectionTable/internal/CollectionTableToolbar.tsx +3 -3
  110. package/src/components/EntityCollectionTable/internal/EntityTableCell.tsx +5 -5
  111. package/src/components/EntityCollectionTable/internal/EntityTableCellActions.tsx +2 -2
  112. package/src/components/EntityCollectionTable/internal/popup_field/PopupFormField.tsx +77 -73
  113. package/src/components/EntityCollectionView/EntityCollectionView.tsx +90 -49
  114. package/src/components/EntityCollectionView/EntityCollectionViewActions.tsx +4 -2
  115. package/src/components/EntityCollectionView/useSelectionController.tsx +5 -4
  116. package/src/components/EntityPreview.tsx +39 -30
  117. package/src/components/EntityView.tsx +5 -5
  118. package/src/components/ErrorView.tsx +3 -3
  119. package/src/components/HomePage/DefaultHomePage.tsx +1 -0
  120. package/src/components/HomePage/FavouritesView.tsx +6 -11
  121. package/src/components/HomePage/NavigationCard.tsx +1 -1
  122. package/src/components/HomePage/NavigationCardBinding.tsx +4 -9
  123. package/src/components/HomePage/NavigationGroup.tsx +1 -1
  124. package/src/components/NotFoundPage.tsx +2 -2
  125. package/src/components/PropertyConfigBadge.tsx +1 -1
  126. package/src/components/PropertyIdCopyTooltip.tsx +3 -4
  127. package/src/components/ReferenceTable/ReferenceSelectionTable.tsx +13 -8
  128. package/src/components/SelectableTable/SelectableTable.tsx +20 -5
  129. package/src/components/SelectableTable/filters/DateTimeFilterField.tsx +4 -2
  130. package/src/components/SelectableTable/filters/ReferenceFilterField.tsx +10 -8
  131. package/src/components/SelectableTable/filters/StringNumberFilterField.tsx +7 -5
  132. package/src/components/UnsavedChangesDialog.tsx +42 -0
  133. package/src/components/VirtualTable/VirtualTable.tsx +19 -2
  134. package/src/components/VirtualTable/VirtualTableHeader.tsx +8 -8
  135. package/src/components/VirtualTable/VirtualTableHeaderRow.tsx +1 -1
  136. package/src/components/VirtualTable/VirtualTableProps.tsx +15 -0
  137. package/src/components/VirtualTable/VirtualTableRow.tsx +1 -1
  138. package/src/components/VirtualTable/fields/VirtualTableDateField.tsx +1 -1
  139. package/src/components/VirtualTable/fields/VirtualTableInput.tsx +1 -1
  140. package/src/components/VirtualTable/fields/VirtualTableSelect.tsx +2 -0
  141. package/src/components/common/default_entity_actions.tsx +26 -37
  142. package/src/components/common/index.ts +1 -1
  143. package/src/components/common/useColumnsIds.tsx +1 -1
  144. package/src/components/common/useDataSourceTableController.tsx +420 -0
  145. package/src/components/common/useDebouncedCallback.tsx +20 -0
  146. package/src/components/common/useScrollRestoration.tsx +68 -0
  147. package/src/contexts/BreacrumbsContext.tsx +38 -0
  148. package/src/contexts/DialogsProvider.tsx +3 -2
  149. package/src/contexts/ModeController.tsx +1 -3
  150. package/src/contexts/SnackbarProvider.tsx +2 -0
  151. package/src/core/DefaultAppBar.tsx +56 -25
  152. package/src/core/DefaultDrawer.tsx +11 -9
  153. package/src/core/DrawerNavigationItem.tsx +4 -4
  154. package/src/core/EntityEditView.tsx +282 -1006
  155. package/src/core/EntityEditViewFormActions.tsx +199 -0
  156. package/src/core/EntitySidePanel.tsx +85 -15
  157. package/src/core/FireCMS.tsx +12 -9
  158. package/src/core/FireCMSRouter.tsx +17 -0
  159. package/src/core/NavigationRoutes.tsx +23 -32
  160. package/src/core/SideDialogs.tsx +21 -12
  161. package/src/core/field_configs.tsx +4 -4
  162. package/src/core/index.tsx +4 -2
  163. package/src/form/EntityForm.tsx +774 -0
  164. package/src/form/EntityFormActions.tsx +169 -0
  165. package/src/form/PropertyFieldBinding.tsx +39 -30
  166. package/src/form/components/CustomIdField.tsx +2 -0
  167. package/src/form/components/FormEntry.tsx +22 -0
  168. package/src/form/components/FormLayout.tsx +16 -0
  169. package/src/form/components/LabelWithIcon.tsx +6 -3
  170. package/src/form/components/StorageItemPreview.tsx +3 -3
  171. package/src/form/components/StorageUploadProgress.tsx +1 -1
  172. package/src/form/components/index.tsx +2 -1
  173. package/src/form/field_bindings/ArrayCustomShapedFieldBinding.tsx +7 -6
  174. package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +20 -12
  175. package/src/form/field_bindings/BlockFieldBinding.tsx +45 -25
  176. package/src/form/field_bindings/DateTimeFieldBinding.tsx +2 -1
  177. package/src/form/field_bindings/KeyValueFieldBinding.tsx +10 -7
  178. package/src/form/field_bindings/MapFieldBinding.tsx +69 -52
  179. package/src/form/field_bindings/MarkdownEditorFieldBinding.tsx +9 -6
  180. package/src/form/field_bindings/MultiSelectFieldBinding.tsx +1 -1
  181. package/src/form/field_bindings/ReadOnlyFieldBinding.tsx +2 -2
  182. package/src/form/field_bindings/ReferenceFieldBinding.tsx +5 -5
  183. package/src/form/field_bindings/RepeatFieldBinding.tsx +30 -22
  184. package/src/form/field_bindings/SelectFieldBinding.tsx +6 -5
  185. package/src/form/field_bindings/StorageUploadFieldBinding.tsx +7 -5
  186. package/src/form/field_bindings/SwitchFieldBinding.tsx +26 -25
  187. package/src/form/field_bindings/TextFieldBinding.tsx +4 -3
  188. package/src/form/index.tsx +16 -32
  189. package/src/form/validation.ts +12 -6
  190. package/src/hooks/data/delete.ts +4 -4
  191. package/src/hooks/data/save.ts +8 -9
  192. package/src/hooks/data/useCollectionFetch.tsx +3 -3
  193. package/src/hooks/data/useEntityFetch.tsx +10 -6
  194. package/src/hooks/useAuthController.tsx +1 -1
  195. package/src/hooks/useBreadcrumbsController.tsx +31 -0
  196. package/src/hooks/useBuildModeController.tsx +15 -28
  197. package/src/hooks/useBuildNavigationController.tsx +74 -29
  198. package/src/hooks/useFireCMSContext.tsx +5 -5
  199. package/src/hooks/useLargeLayout.tsx +0 -35
  200. package/src/hooks/useModeController.tsx +1 -2
  201. package/src/hooks/useResolvedNavigationFrom.tsx +9 -11
  202. package/src/hooks/useValidateAuthenticator.tsx +3 -3
  203. package/src/internal/useBuildDataSource.ts +1 -1
  204. package/src/internal/useBuildSideDialogsController.tsx +3 -2
  205. package/src/internal/useBuildSideEntityController.tsx +124 -83
  206. package/src/internal/useUnsavedChangesDialog.tsx +127 -93
  207. package/src/preview/PropertyPreview.tsx +11 -11
  208. package/src/preview/PropertyPreviewProps.tsx +1 -1
  209. package/src/preview/components/BooleanPreview.tsx +1 -1
  210. package/src/preview/components/EmptyValue.tsx +1 -1
  211. package/src/preview/components/EnumValuesChip.tsx +1 -1
  212. package/src/preview/components/ImagePreview.tsx +5 -6
  213. package/src/preview/components/UrlComponentPreview.tsx +20 -21
  214. package/src/preview/property_previews/ArrayOfMapsPreview.tsx +1 -1
  215. package/src/preview/property_previews/ArrayOfReferencesPreview.tsx +2 -2
  216. package/src/preview/property_previews/ArrayOfStorageComponentsPreview.tsx +2 -2
  217. package/src/preview/property_previews/ArrayOfStringsPreview.tsx +1 -1
  218. package/src/preview/property_previews/ArrayOneOfPreview.tsx +2 -2
  219. package/src/preview/property_previews/ArrayPropertyPreview.tsx +2 -2
  220. package/src/preview/property_previews/MapPropertyPreview.tsx +7 -6
  221. package/src/preview/property_previews/SkeletonPropertyComponent.tsx +12 -12
  222. package/src/preview/property_previews/StringPropertyPreview.tsx +2 -2
  223. package/src/preview/util.ts +10 -10
  224. package/src/routes/CustomCMSRoute.tsx +21 -0
  225. package/src/routes/FireCMSRoute.tsx +235 -0
  226. package/src/routes/HomePageRoute.tsx +17 -0
  227. package/src/types/auth.tsx +8 -12
  228. package/src/types/collections.ts +52 -26
  229. package/src/types/datasource.ts +2 -6
  230. package/src/types/dialogs_controller.tsx +7 -3
  231. package/src/types/entities.ts +1 -1
  232. package/src/types/entity_actions.tsx +16 -4
  233. package/src/types/entity_callbacks.ts +18 -18
  234. package/src/types/export_import.ts +4 -4
  235. package/src/types/fields.tsx +33 -4
  236. package/src/types/firecms.tsx +2 -2
  237. package/src/types/firecms_context.tsx +1 -1
  238. package/src/types/navigation.ts +36 -16
  239. package/src/types/permissions.ts +5 -5
  240. package/src/types/plugins.tsx +9 -8
  241. package/src/types/properties.ts +21 -3
  242. package/src/types/property_config.tsx +0 -2
  243. package/src/types/side_dialogs_controller.tsx +2 -0
  244. package/src/types/side_entity_controller.tsx +6 -1
  245. package/src/types/user.ts +2 -0
  246. package/src/util/builders.ts +10 -8
  247. package/src/util/entities.ts +3 -1
  248. package/src/util/entity_actions.ts +28 -0
  249. package/src/util/entity_cache.ts +204 -0
  250. package/src/util/icon_list.ts +1 -0
  251. package/src/util/icon_synonyms.ts +0 -1
  252. package/src/util/icons.tsx +12 -8
  253. package/src/util/index.ts +1 -0
  254. package/src/util/join_collections.ts +3 -0
  255. package/src/util/navigation_from_path.ts +13 -6
  256. package/src/util/navigation_utils.ts +53 -1
  257. package/src/util/objects.ts +24 -1
  258. package/src/util/parent_references_from_path.ts +3 -3
  259. package/src/util/permissions.ts +8 -8
  260. package/src/util/property_utils.tsx +10 -3
  261. package/src/util/references.ts +8 -2
  262. package/src/util/resolutions.ts +34 -13
  263. package/src/util/useStorageUploadController.tsx +40 -22
  264. package/dist/form/components/FormikArrayContainer.d.ts +0 -19
  265. package/src/components/common/useDataSourceEntityCollectionTableController.tsx +0 -236
  266. package/src/form/components/FormikArrayContainer.tsx +0 -47
  267. /package/src/util/{common.tsx → common.ts} +0 -0
@@ -1,6 +1,6 @@
1
1
  import { Entity, EntityCallbacks, EntityCollection } from "../types";
2
2
  import React, { useCallback, useMemo, useState } from "react";
3
- import { Button, CircularProgress, Dialog, DialogActions, DialogContent, Typography } from "@firecms/ui";
3
+ import { Button, CircularProgress, Dialog, DialogActions, DialogContent, DialogTitle } from "@firecms/ui";
4
4
  import {
5
5
  deleteEntityWithCallbacks,
6
6
  useCustomizationController,
@@ -40,25 +40,17 @@ export function DeleteEntityDialog<M extends Record<string, any>>({
40
40
  const snackbarController = useSnackbarController();
41
41
  const [loading, setLoading] = useState(false);
42
42
 
43
- const [entityOrEntities, setUsedEntityOrEntities] = React.useState<Entity<M> | Entity<M>[]>();
44
-
45
- const [multipleEntities, setMultipleEntities] = React.useState<boolean>();
46
43
  const context = useFireCMSContext();
44
+ const entityOrEntities = Array.isArray(entityOrEntitiesToDelete) && entityOrEntitiesToDelete.length === 1
45
+ ? entityOrEntitiesToDelete[0]
46
+ : entityOrEntitiesToDelete;
47
47
 
48
- React.useEffect(() => {
49
- if (entityOrEntitiesToDelete) {
50
- const revisedEntityOrEntities = Array.isArray(entityOrEntitiesToDelete) && entityOrEntitiesToDelete.length === 1
51
- ? entityOrEntitiesToDelete[0]
52
- : entityOrEntitiesToDelete;
53
- setUsedEntityOrEntities(revisedEntityOrEntities);
54
- setMultipleEntities(Array.isArray(revisedEntityOrEntities));
55
- }
56
- }, [entityOrEntitiesToDelete]);
48
+ const multipleEntities = Array.isArray(entityOrEntities);
57
49
 
58
50
  const resolvedCollection = useMemo(() => resolveCollection<M>({
59
51
  collection,
60
52
  path,
61
- fields: customizationController.propertyConfigs
53
+ propertyConfigs: customizationController.propertyConfigs
62
54
  }), [collection, path]);
63
55
 
64
56
  const handleCancel = useCallback(() => {
@@ -181,16 +173,15 @@ export function DeleteEntityDialog<M extends Record<string, any>>({
181
173
  open={open}
182
174
  onOpenChange={(open) => !open ? onClose() : undefined}
183
175
  >
176
+ <DialogTitle id="delete-dialog-title">
177
+ {dialogTitle}
178
+ </DialogTitle>
184
179
  <DialogContent fullHeight={true}>
185
- <Typography variant={"subtitle2"} className={"p-4"}>
186
- {dialogTitle}
187
- </Typography>
188
-
189
180
  {!multipleEntities && <div className={"p-4"}>{content}</div>}
190
181
  </DialogContent>
191
182
  <DialogActions>
192
183
 
193
- {loading && <CircularProgress size={"small"}/>}
184
+ {loading && <CircularProgress size={"smallest"}/>}
194
185
 
195
186
  <Button onClick={handleCancel}
196
187
  disabled={loading}
@@ -1,8 +1,20 @@
1
1
  import React, { MouseEvent, useCallback } from "react";
2
2
 
3
3
  import { CollectionSize, Entity, EntityAction, EntityCollection, SelectionController } from "../../types";
4
- import { Checkbox, cls, IconButton, Menu, MenuItem, MoreVertIcon, Skeleton, Tooltip } from "@firecms/ui";
4
+ import {
5
+ Checkbox,
6
+ Chip,
7
+ cls,
8
+ EditIcon,
9
+ IconButton,
10
+ Menu,
11
+ MenuItem,
12
+ MoreVertIcon,
13
+ Skeleton,
14
+ Tooltip
15
+ } from "@firecms/ui";
5
16
  import { useFireCMSContext, useLargeLayout } from "../../hooks";
17
+ import { hasEntityInCache } from "../../util/entity_cache";
6
18
 
7
19
  /**
8
20
  *
@@ -32,23 +44,25 @@ export const EntityCollectionRowActions = function EntityCollectionRowActions({
32
44
  actions = [],
33
45
  hideId,
34
46
  selectionController,
47
+ openEntityMode
35
48
  }:
36
- {
37
- entity: Entity<any>,
38
- collection?: EntityCollection<any>,
39
- fullPath?: string,
40
- width: number,
41
- frozen?: boolean,
42
- size: CollectionSize,
43
- isSelected?: boolean,
44
- selectionEnabled?: boolean,
45
- actions?: EntityAction[],
46
- hideId?: boolean,
47
- onCollectionChange?: () => void,
48
- selectionController?: SelectionController;
49
- highlightEntity?: (entity: Entity<any>) => void;
50
- unhighlightEntity?: (entity: Entity<any>) => void;
51
- }) {
49
+ {
50
+ entity: Entity<any>,
51
+ collection?: EntityCollection<any>,
52
+ fullPath?: string,
53
+ width: number,
54
+ frozen?: boolean,
55
+ size: CollectionSize,
56
+ isSelected?: boolean,
57
+ selectionEnabled?: boolean,
58
+ actions?: EntityAction[],
59
+ hideId?: boolean,
60
+ onCollectionChange?: () => void,
61
+ selectionController?: SelectionController;
62
+ highlightEntity?: (entity: Entity<any>) => void;
63
+ unhighlightEntity?: (entity: Entity<any>) => void;
64
+ openEntityMode: "side_panel" | "full_screen";
65
+ }) {
52
66
 
53
67
  const largeLayout = useLargeLayout();
54
68
 
@@ -63,12 +77,16 @@ export const EntityCollectionRowActions = function EntityCollectionRowActions({
63
77
 
64
78
  const collapsedActions = actions.filter(a => a.collapsed || a.collapsed === undefined);
65
79
  const uncollapsedActions = actions.filter(a => a.collapsed === false);
80
+ const hasDraft = hasEntityInCache(fullPath + "/" + entity.id);
66
81
  return (
67
82
  <div
68
83
  className={cls(
69
- "h-full flex items-center justify-center flex-col bg-gray-50 dark:bg-gray-900 bg-opacity-90 dark:bg-opacity-90 z-10",
84
+ "h-full flex items-center justify-center flex-col bg-surface-50 dark:bg-surface-900 bg-opacity-90 dark:bg-opacity-90 z-10",
70
85
  frozen ? "sticky left-0" : ""
71
86
  )}
87
+ onClick={useCallback((event: any) => {
88
+ event.stopPropagation();
89
+ }, [])}
72
90
  style={{
73
91
  width,
74
92
  position: frozen ? "sticky" : "initial",
@@ -95,6 +113,7 @@ export const EntityCollectionRowActions = function EntityCollectionRowActions({
95
113
  highlightEntity,
96
114
  unhighlightEntity,
97
115
  onCollectionChange,
116
+ openEntityMode: openEntityMode ?? collection?.openEntityMode
98
117
  });
99
118
  }}
100
119
  size={largeLayout ? "medium" : "small"}>
@@ -123,6 +142,7 @@ export const EntityCollectionRowActions = function EntityCollectionRowActions({
123
142
  highlightEntity,
124
143
  unhighlightEntity,
125
144
  onCollectionChange,
145
+ openEntityMode: openEntityMode ?? collection?.openEntityMode
126
146
  });
127
147
  }}>
128
148
  {action.icon}
@@ -145,11 +165,15 @@ export const EntityCollectionRowActions = function EntityCollectionRowActions({
145
165
 
146
166
  {!hideId && size !== "xs" && (
147
167
  <div
148
- className="w-[138px] text-center overflow-hidden truncate font-mono text-xs text-text-secondary dark:text-text-secondary-dark max-w-full text-ellipsis px-2"
168
+ className="w-[138px] overflow-hidden truncate font-mono text-xs text-text-secondary dark:text-text-secondary-dark max-w-full text-ellipsis px-2 align-center flex items-center justify-center gap-1"
149
169
  onClick={(event) => {
150
170
  event.stopPropagation();
151
171
  }}>
152
-
172
+ {hasDraft && <Tooltip title={"Unsaved changes"} className={"inline"}>
173
+ <Chip colorScheme={"orangeDarker"} className={"p-0.5"}>
174
+ <EditIcon size={12}/>
175
+ </Chip>
176
+ </Tooltip>}
153
177
  {entity
154
178
  ? entity.id
155
179
  : <Skeleton/>
@@ -34,14 +34,14 @@ import { getRowHeight } from "../common/table_height";
34
34
  *
35
35
  * The data displayed in the table is managed by a {@link EntityTableController}.
36
36
  * You can build the default, bound to a path in the datasource, by using the hook
37
- * {@link useDataSourceEntityCollectionTableController}
37
+ * {@link useDataSourceTableController}
38
38
  *
39
39
  * @see EntityCollectionTableProps
40
40
  * @see EntityCollectionView
41
41
  * @see VirtualTable
42
42
  * @group Components
43
43
  */
44
- export const EntityCollectionTable = function EntityCollectionTable<M extends Record<string, any>, UserType extends User>
44
+ export const EntityCollectionTable = function EntityCollectionTable<M extends Record<string, any> = any, USER extends User = any>
45
45
  ({
46
46
  className,
47
47
  style,
@@ -57,6 +57,8 @@ export const EntityCollectionTable = function EntityCollectionTable<M extends Re
57
57
  highlightedEntities,
58
58
  onEntityClick,
59
59
  onColumnResize,
60
+ initialScroll,
61
+ onScroll,
60
62
  onSizeChanged,
61
63
  textSearchEnabled = false,
62
64
  hoverRow = true,
@@ -76,7 +78,8 @@ export const EntityCollectionTable = function EntityCollectionTable<M extends Re
76
78
  getIdColumnWidth,
77
79
  onTextSearchClick,
78
80
  textSearchLoading,
79
- enablePopupIcon
81
+ enablePopupIcon,
82
+ openEntityMode = "side_panel"
80
83
  }: EntityCollectionTableProps<M>) {
81
84
 
82
85
  const ref = useRef<HTMLDivElement>(null);
@@ -84,12 +87,10 @@ export const EntityCollectionTable = function EntityCollectionTable<M extends Re
84
87
  const largeLayout = useLargeLayout();
85
88
  const selectedEntities = (selectionController?.selectedEntities?.length > 0 ? selectionController?.selectedEntities : highlightedEntities)?.filter(Boolean);
86
89
 
87
- const context: FireCMSContext<UserType> = useFireCMSContext();
90
+ const context: FireCMSContext<USER> = useFireCMSContext();
88
91
 
89
92
  const [size, setSize] = React.useState<CollectionSize>(defaultSize ?? "m");
90
93
 
91
- const selectedEntityIds = selectedEntities?.map(e => e.id);
92
-
93
94
  const updateSize = useCallback((size: CollectionSize) => {
94
95
  if (onSizeChanged)
95
96
  onSizeChanged(size);
@@ -98,12 +99,12 @@ export const EntityCollectionTable = function EntityCollectionTable<M extends Re
98
99
 
99
100
  const onTextSearch = useCallback((newSearchString?: string) => tableController.setSearchString?.(newSearchString), []);
100
101
 
101
- const additionalFieldsMap: Record<string, AdditionalFieldDelegate<M, UserType>> = useMemo(() => {
102
+ const additionalFieldsMap: Record<string, AdditionalFieldDelegate<M, USER>> = useMemo(() => {
102
103
  return (additionalFields
103
104
  ? additionalFields
104
105
  .map((aC) => ({ [aC.key]: aC as AdditionalFieldDelegate<M, any> }))
105
106
  .reduce((a, b) => ({ ...a, ...b }), {})
106
- : {}) as Record<string, AdditionalFieldDelegate<M, UserType>>;
107
+ : {}) as Record<string, AdditionalFieldDelegate<M, USER>>;
107
108
  }, [additionalFields]);
108
109
 
109
110
  const customFieldValidator: CustomFieldValidator | undefined = uniqueFieldValidator;
@@ -176,12 +177,14 @@ export const EntityCollectionTable = function EntityCollectionTable<M extends Re
176
177
  throw new Error("When using additional fields you need to provide a Builder or a value");
177
178
  }
178
179
 
179
- const child = Builder
180
+ const child: React.ReactNode = Builder
180
181
  ? <Builder entity={entity} context={context}/>
181
- : <>{additionalField.value?.({
182
- entity,
183
- context
184
- })}</>;
182
+ : <>
183
+ {additionalField.value?.({
184
+ entity,
185
+ context
186
+ })?.toString()}
187
+ </>;
185
188
 
186
189
  return (
187
190
  <EntityTableCell
@@ -202,7 +205,7 @@ export const EntityCollectionTable = function EntityCollectionTable<M extends Re
202
205
  </EntityTableCell>
203
206
  );
204
207
 
205
- }, [size, selectedEntityIds]);
208
+ }, [size]);
206
209
 
207
210
  const collectionColumns: VirtualTableColumn[] = (() => {
208
211
  const columnsResult: VirtualTableColumn[] = propertiesToColumns({
@@ -265,7 +268,8 @@ export const EntityCollectionTable = function EntityCollectionTable<M extends Re
265
268
  width={column.width}
266
269
  frozen={column.frozen}
267
270
  isSelected={false}
268
- size={size}/>;
271
+ size={size}
272
+ openEntityMode={openEntityMode}/>;
269
273
  } else if (additionalFieldsMap[columnKey]) {
270
274
  return additionalCellRenderer(props);
271
275
  } else if (props.columnIndex < columns.length + 1) {
@@ -292,7 +296,7 @@ export const EntityCollectionTable = function EntityCollectionTable<M extends Re
292
296
 
293
297
  <div ref={ref}
294
298
  style={style}
295
- className={cls("h-full w-full flex flex-col bg-white dark:bg-gray-950", className)}>
299
+ className={cls("h-full w-full flex flex-col bg-white dark:bg-surface-950", className)}>
296
300
 
297
301
  <CollectionTableToolbar
298
302
  onTextSearch={textSearchEnabled ? onTextSearch : undefined}
@@ -310,9 +314,11 @@ export const EntityCollectionTable = function EntityCollectionTable<M extends Re
310
314
  inlineEditing={inlineEditing}
311
315
  cellRenderer={cellRenderer}
312
316
  onEntityClick={onEntityClick}
313
- highlightedRow={useCallback((entity: Entity<M>) => selectedEntityIds?.includes(entity.id) ?? false, [selectedEntityIds])}
317
+ highlightedRow={(entity: Entity<M>) => Boolean(selectedEntities?.find(e => e.id === entity.id && e.path === entity.path))}
314
318
  tableController={tableController}
315
319
  onValueChange={onValueChange}
320
+ initialScroll={initialScroll}
321
+ onScroll={onScroll}
316
322
  onColumnResize={onColumnResize}
317
323
  hoverRow={hoverRow}
318
324
  filterable={filterable}
@@ -16,7 +16,7 @@ import { OnCellValueChange, OnColumnResizeParams, UniqueFieldValidator } from ".
16
16
  * @group Collection components
17
17
  */
18
18
  export type EntityCollectionTableProps<M extends Record<string, any>,
19
- UserType extends User = User> = {
19
+ USER extends User = User> = {
20
20
 
21
21
  className?: string;
22
22
 
@@ -72,6 +72,21 @@ export type EntityCollectionTableProps<M extends Record<string, any>,
72
72
  */
73
73
  onColumnResize?(params: OnColumnResizeParams): void;
74
74
 
75
+ /**
76
+ * Initial scroll position
77
+ */
78
+ initialScroll?: number;
79
+
80
+ /**
81
+ * Callback when the table is scrolled
82
+ * @param props
83
+ */
84
+ onScroll?: (props: {
85
+ scrollDirection: "forward" | "backward",
86
+ scrollOffset: number,
87
+ scrollUpdateWasRequested: boolean
88
+ }) => void;
89
+
75
90
  /**
76
91
  * Callback when the selected size of the table is changed
77
92
  */
@@ -90,7 +105,7 @@ export type EntityCollectionTableProps<M extends Record<string, any>,
90
105
 
91
106
  /**
92
107
  * Controller holding the logic for the table
93
- * {@link useDataSourceEntityCollectionTableController}
108
+ * {@link useDataSourceTableController}
94
109
  * {@link EntityTableController}
95
110
  */
96
111
  tableController: EntityTableController<M>;
@@ -103,7 +118,7 @@ export type EntityCollectionTableProps<M extends Record<string, any>,
103
118
 
104
119
  inlineEditing?: boolean;
105
120
 
106
- additionalFields?: AdditionalFieldDelegate<M, UserType>[];
121
+ additionalFields?: AdditionalFieldDelegate<M, USER>[];
107
122
 
108
123
  defaultSize?: CollectionSize;
109
124
 
@@ -136,6 +151,8 @@ export type EntityCollectionTableProps<M extends Record<string, any>,
136
151
  textSearchLoading?: boolean;
137
152
 
138
153
  enablePopupIcon: boolean;
154
+
155
+ openEntityMode?: "side_panel" | "full_screen";
139
156
  };
140
157
 
141
158
  export type GetPropertyForProps<M extends Record<string, any>> = {
@@ -89,8 +89,8 @@ export const PropertyTableCell = React.memo<PropertyTableCellProps<any>>(
89
89
  } = useSelectableTableController();
90
90
 
91
91
  const selected = selectedCell?.propertyKey === propertyKey &&
92
- selectedCell?.entity.path === entity.path &&
93
- selectedCell?.entity.id === entity.id;
92
+ selectedCell?.entityPath === entity.path &&
93
+ selectedCell?.entityId === entity.id;
94
94
 
95
95
  const [internalValue, setInternalValue] = useState<any | null>(value);
96
96
  const internalValueRef = useRef(value);
@@ -193,7 +193,8 @@ export const PropertyTableCell = React.memo<PropertyTableCellProps<any>>(
193
193
  select({
194
194
  width,
195
195
  height,
196
- entity,
196
+ entityPath: entity.path,
197
+ entityId: entity.id,
197
198
  cellRect,
198
199
  propertyKey: propertyKey as Extract<keyof M, string>
199
200
  });
@@ -209,7 +210,8 @@ export const PropertyTableCell = React.memo<PropertyTableCellProps<any>>(
209
210
  setPopupCell({
210
211
  width,
211
212
  height,
212
- entity,
213
+ entityPath: entity.path,
214
+ entityId: entity.id,
213
215
  cellRect,
214
216
  propertyKey: propertyKey as Extract<keyof M, string>
215
217
  });
@@ -8,7 +8,7 @@ import { getPreviewSizeFrom } from "../../../preview/util";
8
8
  import { getReferenceFrom, IconForView } from "../../../util";
9
9
  import { useCustomizationController, useNavigationController, useReferenceDialog } from "../../../hooks";
10
10
  import { ErrorView } from "../../ErrorView";
11
- import { cls } from "@firecms/ui";
11
+ import { cls, EditIcon } from "@firecms/ui";
12
12
  import { EntityPreviewContainer } from "../../EntityPreview";
13
13
 
14
14
  type TableReferenceFieldProps = {
@@ -123,7 +123,7 @@ export const TableReferenceFieldInternal = React.memo(
123
123
  key={`preview_array_ref_${name}_${index}`}>
124
124
  <ReferencePreview
125
125
  onClick={disabled ? undefined : handleOpen}
126
- size={"smallest"}
126
+ size={"small"}
127
127
  reference={reference}
128
128
  hover={!disabled}
129
129
  disabled={!path}
@@ -151,18 +151,17 @@ export const TableReferenceFieldInternal = React.memo(
151
151
 
152
152
  {valueNotSet &&
153
153
  <EntityPreviewContainer
154
- className={cls("px-4 py-2 text-sm font-medium flex items-center uppercase",
154
+ className={cls("px-3 py-2 text-sm font-medium flex items-center",
155
155
  multiselect ? "gap-4" : "gap-6",
156
156
  disabled
157
- ? "text-slate-500"
158
- : "cursor-pointer text-slate-700 dark:text-slate-300 hover:bg-slate-50 dark:hover:bg-gray-800 group-hover:bg-slate-50 dark:group-hover:bg-gray-800")}
157
+ ? "text-surface-accent-500"
158
+ : "cursor-pointer text-text-secondary dark:text-text-secondary-dark hover:bg-surface-accent-50 dark:hover:bg-surface-800 group-hover:bg-surface-accent-50 dark:group-hover:bg-surface-800")}
159
159
  onClick={handleOpen}
160
160
  size={"medium"}>
161
- <IconForView
161
+ <EditIcon
162
162
  size={"small"}
163
- collectionOrView={collection}
164
- className={"text-gray-300 dark:text-gray-600"}/>
165
- Edit {title}
163
+ className={"ml-2 mr-1 text-surface-300 dark:text-surface-600"}/>
164
+ {title}
166
165
  </EntityPreviewContainer>}
167
166
 
168
167
  </div>
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- import { useMemo, useState } from "react";
2
+ import { useMemo } from "react";
3
3
 
4
4
  import { Entity, ResolvedArrayProperty, ResolvedStringProperty, StorageConfig } from "../../../types";
5
5
  import { useDropzone } from "react-dropzone";
@@ -140,9 +140,7 @@ function StorageUpload({
140
140
  storagePathBuilder,
141
141
  }: StorageUploadProps) {
142
142
 
143
- const [onHover, setOnHover] = useState(false);
144
-
145
- const previewSize = multipleFilesSupported && previewSizeInput === "medium" ? "small" : previewSizeInput;
143
+ const previewSize = previewSizeInput;
146
144
  if (multipleFilesSupported) {
147
145
  const arrayProperty = property as ResolvedArrayProperty<string[]>;
148
146
  if (Array.isArray(arrayProperty.of)) {
@@ -212,9 +210,6 @@ function StorageUpload({
212
210
 
213
211
  return (
214
212
  <div {...rootProps}
215
- onMouseEnter={() => setOnHover(true)}
216
- onMouseMove={() => setOnHover(true)}
217
- onMouseLeave={() => setOnHover(false)}
218
213
  className={cls(dropZoneClasses,
219
214
  "relative w-full h-full flex",
220
215
  `justify-${hasValue ? "start" : "center"}`,
@@ -252,14 +247,13 @@ function StorageUpload({
252
247
  }
253
248
 
254
249
  return child;
255
- })
256
- }
250
+ })}
257
251
 
258
252
  {!internalValue && <div
259
253
  className="flex-grow m-2 max-w-[200px]"
260
254
  onClick={open}>
261
255
  <Typography
262
- className="text-gray-400 dark:text-gray-600"
256
+ className="text-surface-400 dark:text-surface-600"
263
257
  variant={"body2"}
264
258
  align={"center"}>
265
259
  {helpText}
@@ -276,7 +270,7 @@ function StorageUpload({
276
270
  color={"inherit"}
277
271
  size={"small"}
278
272
  onClick={open}>
279
- <EditIcon size={"small"} className={"text-gray-500"}/>
273
+ <EditIcon size={"small"} className={"text-surface-500"}/>
280
274
  </IconButton>
281
275
  </EntityTableCellActions>
282
276
 
@@ -8,5 +8,5 @@ export type {
8
8
 
9
9
  export * from "./PropertyTableCell";
10
10
  export * from "./EntityCollectionRowActions";
11
- export * from "../common/useDataSourceEntityCollectionTableController";
11
+ export * from "../common/useDataSourceTableController";
12
12
  export * from "./column_utils";
@@ -71,7 +71,7 @@ export function CollectionTableToolbar({
71
71
 
72
72
  return (
73
73
  <div
74
- className={cls(defaultBorderMixin, "no-scrollbar min-h-[56px] overflow-x-auto px-2 md:px-4 bg-gray-50 dark:bg-gray-900 border-b flex flex-row justify-between items-center w-full")}>
74
+ className={cls(defaultBorderMixin, "no-scrollbar min-h-[56px] overflow-x-auto px-2 md:px-4 bg-surface-50 dark:bg-surface-900 border-b flex flex-row justify-between items-center w-full")}>
75
75
 
76
76
  <div className="flex items-center gap-2 md:mr-4 mr-2">
77
77
 
@@ -87,9 +87,9 @@ export function CollectionTableToolbar({
87
87
 
88
88
  <div className="flex items-center gap-2">
89
89
 
90
- {largeLayout && <div className="w-[22px]">
90
+ {largeLayout && <div className="w-[22px] mr-4">
91
91
  {loading &&
92
- <CircularProgress size={"small"}/>}
92
+ <CircularProgress size={"smallest"}/>}
93
93
  </div>}
94
94
 
95
95
  {(onTextSearch || onTextSearchClick) &&
@@ -2,7 +2,7 @@ import React, { useCallback, useEffect, useMemo, useRef, useState } from "react"
2
2
 
3
3
  import useMeasure from "react-use-measure";
4
4
 
5
- import { cls, RemoveCircleIcon, Tooltip } from "@firecms/ui";
5
+ import { cls, DoNotDisturbOnIcon, Tooltip } from "@firecms/ui";
6
6
  import { ErrorBoundary } from "../../../components";
7
7
  import { getRowHeight, TableSize } from "../../common/table_height";
8
8
 
@@ -188,10 +188,10 @@ export const EntityTableCell = React.memo<EntityTableCellProps>(
188
188
  className={cls(
189
189
  "transition-colors duration-100 ease-in-out",
190
190
  `flex relative h-full rounded-md p-${p} border border-4 border-opacity-75`,
191
- onHover && !disabled ? "bg-gray-50 dark:bg-gray-900" : "",
192
- saved ? "bg-gray-100 bg-opacity-75 dark:bg-gray-800 dark:bg-opacity-75" : "",
191
+ onHover && !disabled ? "bg-surface-50 dark:bg-surface-900" : "",
192
+ saved ? "bg-surface-100 bg-opacity-75 dark:bg-surface-800 dark:bg-opacity-75" : "",
193
193
  hideOverflow ? "overflow-hidden" : "",
194
- isSelected ? "bg-gray-50 dark:bg-gray-900" : "",
194
+ isSelected ? "bg-surface-50 dark:bg-surface-900" : "",
195
195
  borderClass
196
196
  )}
197
197
  ref={ref}
@@ -236,7 +236,7 @@ export const EntityTableCell = React.memo<EntityTableCellProps>(
236
236
  {disabled && onHover && disabledTooltip &&
237
237
  <div className="absolute top-1 right-1 text-xs">
238
238
  <Tooltip title={disabledTooltip}>
239
- <RemoveCircleIcon size={"smallest"} color={"disabled"} className={"text-gray-500"}/>
239
+ <DoNotDisturbOnIcon size={"smallest"} color={"disabled"} className={"text-surface-500"}/>
240
240
  </Tooltip>
241
241
  </div>}
242
242
 
@@ -1,4 +1,4 @@
1
- import { ErrorOutlineIcon, IconButton } from "@firecms/ui";
1
+ import { ErrorIcon, IconButton } from "@firecms/ui";
2
2
  import { ErrorTooltip } from "../../ErrorTooltip";
3
3
  import { useCallback, useEffect, useRef } from "react";
4
4
 
@@ -68,7 +68,7 @@ export function EntityTableCellActions({
68
68
  width: 32,
69
69
  height: 32
70
70
  }}>
71
- <ErrorOutlineIcon
71
+ <ErrorIcon
72
72
  size={"small"}
73
73
  color={"error"}
74
74
  />