@firecms/core 3.0.0-beta.7 → 3.0.0-beta.9

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 (216) hide show
  1. package/dist/app/AppBar.d.ts +12 -0
  2. package/dist/app/Drawer.d.ts +17 -0
  3. package/dist/app/Scaffold.d.ts +30 -0
  4. package/dist/app/index.d.ts +4 -0
  5. package/dist/app/useApp.d.ts +16 -0
  6. package/dist/components/ArrayContainer.d.ts +2 -1
  7. package/dist/components/CircularProgressCenter.d.ts +1 -1
  8. package/dist/components/EntityCollectionTable/EntityCollectionRowActions.d.ts +0 -1
  9. package/dist/components/EntityCollectionTable/fields/TableReferenceField.d.ts +1 -1
  10. package/dist/components/EntityCollectionTable/internal/popup_field/PopupFormField.d.ts +1 -1
  11. package/dist/components/EntityCollectionView/EntityCollectionView.d.ts +1 -1
  12. package/dist/components/EntityPreview.d.ts +1 -1
  13. package/dist/components/ErrorView.d.ts +1 -1
  14. package/dist/components/HomePage/DefaultHomePage.d.ts +1 -1
  15. package/dist/components/HomePage/NavigationCardBinding.d.ts +1 -1
  16. package/dist/components/PropertyIdCopyTooltip.d.ts +8 -0
  17. package/dist/components/VirtualTable/VirtualTableProps.d.ts +14 -6
  18. package/dist/components/common/useColumnsIds.d.ts +2 -1
  19. package/dist/components/index.d.ts +2 -1
  20. package/dist/{components/FireCMSAppBar.d.ts → core/DefaultAppBar.d.ts} +3 -8
  21. package/dist/core/DefaultDrawer.d.ts +19 -0
  22. package/dist/core/DrawerNavigationItem.d.ts +2 -1
  23. package/dist/core/EntityEditView.d.ts +18 -4
  24. package/dist/core/FireCMS.d.ts +1 -1
  25. package/dist/core/NavigationRoutes.d.ts +2 -2
  26. package/dist/core/index.d.ts +2 -2
  27. package/dist/form/PropertyFieldBinding.d.ts +1 -1
  28. package/dist/form/components/FieldHelperText.d.ts +3 -3
  29. package/dist/form/components/FormikArrayContainer.d.ts +2 -1
  30. package/dist/form/components/LabelWithIcon.d.ts +1 -1
  31. package/dist/form/components/LabelWithIconAndTooltip.d.ts +15 -0
  32. package/dist/form/components/StorageItemPreview.d.ts +4 -4
  33. package/dist/form/components/index.d.ts +1 -0
  34. package/dist/form/field_bindings/ArrayCustomShapedFieldBinding.d.ts +1 -1
  35. package/dist/form/field_bindings/ArrayOfReferencesFieldBinding.d.ts +1 -1
  36. package/dist/form/field_bindings/BlockFieldBinding.d.ts +1 -1
  37. package/dist/form/field_bindings/KeyValueFieldBinding.d.ts +1 -1
  38. package/dist/form/field_bindings/MapFieldBinding.d.ts +1 -1
  39. package/dist/form/field_bindings/MarkdownEditorFieldBinding.d.ts +11 -0
  40. package/dist/form/field_bindings/{MultiSelectBinding.d.ts → MultiSelectFieldBinding.d.ts} +1 -1
  41. package/dist/form/field_bindings/ReadOnlyFieldBinding.d.ts +1 -1
  42. package/dist/form/field_bindings/RepeatFieldBinding.d.ts +1 -1
  43. package/dist/form/field_bindings/SelectFieldBinding.d.ts +1 -1
  44. package/dist/form/field_bindings/StorageUploadFieldBinding.d.ts +3 -5
  45. package/dist/form/field_bindings/TextFieldBinding.d.ts +1 -1
  46. package/dist/form/index.d.ts +3 -5
  47. package/dist/form/useClearRestoreValue.d.ts +2 -2
  48. package/dist/hooks/useProjectLog.d.ts +2 -2
  49. package/dist/index.d.ts +1 -0
  50. package/dist/index.es.js +14434 -11300
  51. package/dist/index.es.js.map +1 -1
  52. package/dist/index.umd.js +19987 -587
  53. package/dist/index.umd.js.map +1 -1
  54. package/dist/preview/PropertyPreviewProps.d.ts +6 -1
  55. package/dist/preview/components/EnumValuesChip.d.ts +1 -1
  56. package/dist/preview/components/ReferencePreview.d.ts +1 -1
  57. package/dist/preview/components/StorageThumbnail.d.ts +2 -1
  58. package/dist/preview/components/UrlComponentPreview.d.ts +2 -1
  59. package/dist/types/auth.d.ts +2 -2
  60. package/dist/types/collections.d.ts +26 -3
  61. package/dist/types/datasource.d.ts +53 -30
  62. package/dist/types/entities.d.ts +1 -0
  63. package/dist/types/entity_overrides.d.ts +2 -2
  64. package/dist/types/fields.d.ts +47 -41
  65. package/dist/types/navigation.d.ts +1 -0
  66. package/dist/types/plugins.d.ts +11 -3
  67. package/dist/types/properties.d.ts +25 -20
  68. package/dist/types/side_dialogs_controller.d.ts +10 -0
  69. package/dist/types/storage.d.ts +75 -0
  70. package/dist/util/entities.d.ts +1 -1
  71. package/dist/util/icon_list.d.ts +5 -1
  72. package/dist/util/icons.d.ts +3 -2
  73. package/dist/util/index.d.ts +1 -0
  74. package/dist/util/plurals.d.ts +0 -2
  75. package/dist/util/property_utils.d.ts +1 -1
  76. package/dist/util/resolutions.d.ts +15 -1
  77. package/dist/util/storage.d.ts +23 -2
  78. package/dist/util/useStorageUploadController.d.ts +3 -3
  79. package/package.json +18 -29
  80. package/src/app/AppBar.tsx +18 -0
  81. package/src/app/Drawer.tsx +25 -0
  82. package/src/{core → app}/Scaffold.tsx +71 -122
  83. package/src/app/index.ts +4 -0
  84. package/src/app/useApp.tsx +32 -0
  85. package/src/components/ArrayContainer.tsx +15 -10
  86. package/src/components/CircularProgressCenter.tsx +1 -1
  87. package/src/components/EntityCollectionTable/EntityCollectionRowActions.tsx +11 -18
  88. package/src/components/EntityCollectionTable/EntityCollectionTable.tsx +2 -2
  89. package/src/components/EntityCollectionTable/PropertyTableCell.tsx +4 -2
  90. package/src/components/EntityCollectionTable/fields/TableReferenceField.tsx +21 -14
  91. package/src/components/EntityCollectionTable/fields/TableStorageUpload.tsx +12 -4
  92. package/src/components/EntityCollectionTable/internal/EntityTableCell.tsx +17 -19
  93. package/src/components/EntityCollectionTable/internal/EntityTableCellActions.tsx +19 -7
  94. package/src/components/EntityCollectionTable/internal/popup_field/PopupFormField.tsx +5 -6
  95. package/src/components/EntityCollectionView/EntityCollectionView.tsx +33 -29
  96. package/src/components/EntityCollectionView/useSelectionController.tsx +19 -7
  97. package/src/components/EntityPreview.tsx +30 -31
  98. package/src/components/ErrorView.tsx +1 -1
  99. package/src/components/HomePage/DefaultHomePage.tsx +24 -18
  100. package/src/components/HomePage/NavigationCardBinding.tsx +1 -1
  101. package/src/components/HomePage/SmallNavigationCard.tsx +1 -2
  102. package/src/components/PropertyIdCopyTooltip.tsx +48 -0
  103. package/src/components/ReferenceTable/ReferenceSelectionTable.tsx +7 -6
  104. package/src/components/SearchIconsView.tsx +5 -2
  105. package/src/components/SelectableTable/SelectableTable.tsx +2 -4
  106. package/src/components/SelectableTable/filters/DateTimeFilterField.tsx +1 -1
  107. package/src/components/SelectableTable/filters/StringNumberFilterField.tsx +54 -7
  108. package/src/components/VirtualTable/VirtualTable.tsx +36 -10
  109. package/src/components/VirtualTable/VirtualTableCell.tsx +1 -9
  110. package/src/components/VirtualTable/VirtualTableProps.tsx +17 -8
  111. package/src/components/VirtualTable/fields/VirtualTableDateField.tsx +3 -3
  112. package/src/components/VirtualTable/fields/VirtualTableInput.tsx +2 -1
  113. package/src/components/VirtualTable/fields/VirtualTableNumberInput.tsx +2 -1
  114. package/src/components/VirtualTable/fields/VirtualTableSelect.tsx +14 -28
  115. package/src/components/common/useColumnsIds.tsx +13 -0
  116. package/src/components/common/useDataSourceEntityCollectionTableController.tsx +12 -12
  117. package/src/components/common/useTableSearchHelper.ts +53 -12
  118. package/src/components/index.tsx +2 -1
  119. package/src/contexts/DialogsProvider.tsx +2 -2
  120. package/src/{components/FireCMSAppBar.tsx → core/DefaultAppBar.tsx} +28 -30
  121. package/src/core/DefaultDrawer.tsx +183 -0
  122. package/src/core/DrawerNavigationItem.tsx +31 -27
  123. package/src/core/EntityEditView.tsx +712 -145
  124. package/src/core/EntitySidePanel.tsx +0 -1
  125. package/src/core/FireCMS.tsx +2 -2
  126. package/src/core/NavigationRoutes.tsx +4 -4
  127. package/src/core/SideDialogs.tsx +1 -0
  128. package/src/core/field_configs.tsx +5 -5
  129. package/src/core/index.tsx +2 -2
  130. package/src/form/PropertyFieldBinding.tsx +53 -19
  131. package/src/form/components/CustomIdField.tsx +4 -2
  132. package/src/form/components/FieldHelperText.tsx +4 -4
  133. package/src/form/components/FormikArrayContainer.tsx +4 -1
  134. package/src/form/components/LabelWithIcon.tsx +27 -19
  135. package/src/form/components/LabelWithIconAndTooltip.tsx +28 -0
  136. package/src/form/components/StorageItemPreview.tsx +20 -10
  137. package/src/form/components/StorageUploadProgress.tsx +0 -1
  138. package/src/form/components/index.tsx +1 -0
  139. package/src/form/field_bindings/ArrayCustomShapedFieldBinding.tsx +26 -15
  140. package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +28 -25
  141. package/src/form/field_bindings/BlockFieldBinding.tsx +13 -11
  142. package/src/form/field_bindings/DateTimeFieldBinding.tsx +17 -14
  143. package/src/form/field_bindings/KeyValueFieldBinding.tsx +48 -42
  144. package/src/form/field_bindings/MapFieldBinding.tsx +17 -17
  145. package/src/form/field_bindings/MarkdownEditorFieldBinding.tsx +150 -0
  146. package/src/form/field_bindings/{MultiSelectBinding.tsx → MultiSelectFieldBinding.tsx} +25 -20
  147. package/src/form/field_bindings/ReadOnlyFieldBinding.tsx +9 -14
  148. package/src/form/field_bindings/ReferenceFieldBinding.tsx +27 -18
  149. package/src/form/field_bindings/RepeatFieldBinding.tsx +32 -19
  150. package/src/form/field_bindings/SelectFieldBinding.tsx +17 -10
  151. package/src/form/field_bindings/StorageUploadFieldBinding.tsx +33 -43
  152. package/src/form/field_bindings/SwitchFieldBinding.tsx +9 -5
  153. package/src/form/field_bindings/TextFieldBinding.tsx +26 -23
  154. package/src/form/index.tsx +4 -9
  155. package/src/form/useClearRestoreValue.tsx +2 -2
  156. package/src/form/validation.ts +1 -17
  157. package/src/hooks/data/delete.ts +2 -1
  158. package/src/hooks/data/save.ts +5 -2
  159. package/src/hooks/data/useDataSource.tsx +11 -3
  160. package/src/hooks/useBuildNavigationController.tsx +10 -3
  161. package/src/hooks/useProjectLog.tsx +18 -7
  162. package/src/index.ts +1 -0
  163. package/src/internal/useBuildDataSource.ts +69 -74
  164. package/src/internal/useBuildSideDialogsController.tsx +1 -0
  165. package/src/internal/useBuildSideEntityController.tsx +17 -4
  166. package/src/internal/useUnsavedChangesDialog.tsx +3 -1
  167. package/src/preview/PropertyPreview.tsx +7 -4
  168. package/src/preview/PropertyPreviewProps.tsx +7 -1
  169. package/src/preview/components/BooleanPreview.tsx +1 -1
  170. package/src/preview/components/EnumValuesChip.tsx +1 -1
  171. package/src/preview/components/ImagePreview.tsx +24 -34
  172. package/src/preview/components/ReferencePreview.tsx +2 -12
  173. package/src/preview/components/StorageThumbnail.tsx +5 -1
  174. package/src/preview/components/UrlComponentPreview.tsx +44 -11
  175. package/src/preview/property_previews/ArrayOfMapsPreview.tsx +1 -1
  176. package/src/preview/property_previews/ArrayOfReferencesPreview.tsx +1 -1
  177. package/src/preview/property_previews/ArrayOfStorageComponentsPreview.tsx +1 -1
  178. package/src/preview/property_previews/ArrayOneOfPreview.tsx +2 -2
  179. package/src/preview/property_previews/ArrayPropertyPreview.tsx +1 -1
  180. package/src/preview/property_previews/MapPropertyPreview.tsx +1 -1
  181. package/src/preview/property_previews/SkeletonPropertyComponent.tsx +2 -2
  182. package/src/preview/property_previews/StringPropertyPreview.tsx +2 -2
  183. package/src/preview/util.ts +2 -2
  184. package/src/types/auth.tsx +2 -2
  185. package/src/types/collections.ts +29 -4
  186. package/src/types/customization_controller.tsx +0 -1
  187. package/src/types/datasource.ts +62 -43
  188. package/src/types/entities.ts +2 -0
  189. package/src/types/entity_overrides.tsx +2 -2
  190. package/src/types/fields.tsx +51 -45
  191. package/src/types/navigation.ts +1 -0
  192. package/src/types/plugins.tsx +12 -3
  193. package/src/types/properties.ts +25 -19
  194. package/src/types/side_dialogs_controller.tsx +13 -0
  195. package/src/types/storage.ts +82 -0
  196. package/src/util/entities.ts +5 -4
  197. package/src/util/icon_list.ts +14 -9
  198. package/src/util/icons.tsx +8 -2
  199. package/src/util/index.ts +1 -0
  200. package/src/util/objects.ts +17 -7
  201. package/src/util/permissions.ts +1 -0
  202. package/src/util/plurals.ts +0 -2
  203. package/src/util/property_utils.tsx +1 -1
  204. package/src/util/references.ts +3 -0
  205. package/src/util/resolutions.ts +43 -11
  206. package/src/util/storage.ts +79 -21
  207. package/src/util/useStorageUploadController.tsx +33 -7
  208. package/dist/components/PropertyIdCopyTooltipContent.d.ts +0 -3
  209. package/dist/core/Drawer.d.ts +0 -16
  210. package/dist/core/Scaffold.d.ts +0 -51
  211. package/dist/form/EntityForm.d.ts +0 -77
  212. package/dist/form/field_bindings/MarkdownFieldBinding.d.ts +0 -9
  213. package/src/components/PropertyIdCopyTooltipContent.tsx +0 -27
  214. package/src/core/Drawer.tsx +0 -139
  215. package/src/form/EntityForm.tsx +0 -736
  216. package/src/form/field_bindings/MarkdownFieldBinding.tsx +0 -695
@@ -179,10 +179,18 @@ function StorageUpload({
179
179
  onDropRejected: (fileRejections, event) => {
180
180
  for (const fileRejection of fileRejections) {
181
181
  for (const error of fileRejection.errors) {
182
- snackbarContext.open({
183
- type: "error",
184
- message: `Error uploading file: File is larger than ${storage.maxSize} bytes`
185
- });
182
+ console.error("Error uploading file: ", error);
183
+ if (error.code === "file-too-large") {
184
+ snackbarContext.open({
185
+ type: "error",
186
+ message: `Error uploading file: File is larger than ${storage.maxSize} bytes`
187
+ });
188
+ } else if (error.code === "file-invalid-type") {
189
+ snackbarContext.open({
190
+ type: "error",
191
+ message: "Error uploading file: File type is not supported"
192
+ });
193
+ }
186
194
  }
187
195
  }
188
196
  }
@@ -45,22 +45,21 @@ const TableCellInner = ({
45
45
  children
46
46
  }: TableCellInnerProps) => {
47
47
  return (
48
- <div
49
- className={cls("flex flex-col max-h-full w-full",
50
- {
51
- "items-start": faded || scrollable
52
- })}
53
- style={{
54
- justifyContent,
55
- height: fullHeight ? "100%" : undefined,
56
- overflow: scrollable ? "auto" : undefined,
57
- WebkitMaskImage: faded
58
- ? "linear-gradient(to bottom, black 60%, transparent 100%)"
59
- : undefined,
60
- maskImage: faded
61
- ? "linear-gradient(to bottom, black 60%, transparent 100%)"
62
- : undefined
63
- }}
48
+ <div className={cls("flex flex-col max-h-full w-full",
49
+ {
50
+ "items-start": faded || scrollable
51
+ })}
52
+ style={{
53
+ justifyContent,
54
+ height: fullHeight ? "100%" : undefined,
55
+ overflow: scrollable ? "auto" : undefined,
56
+ WebkitMaskImage: faded
57
+ ? "linear-gradient(to bottom, black 60%, transparent 100%)"
58
+ : undefined,
59
+ maskImage: faded
60
+ ? "linear-gradient(to bottom, black 60%, transparent 100%)"
61
+ : undefined
62
+ }}
64
63
  >
65
64
  {children}
66
65
  </div>
@@ -156,8 +155,9 @@ export const EntityTableCell = React.memo<EntityTableCellProps>(
156
155
  }, [ref, onSelect, selected, disabled]);
157
156
 
158
157
  const onFocus = useCallback((event: React.SyntheticEvent<HTMLDivElement>) => {
159
- onSelectCallback();
160
158
  event.stopPropagation();
159
+ event.preventDefault();
160
+ onSelectCallback();
161
161
  }, [onSelectCallback]);
162
162
 
163
163
  const isOverflowing = useMemo(() => {
@@ -203,11 +203,9 @@ export const EntityTableCell = React.memo<EntityTableCellProps>(
203
203
  }}
204
204
  tabIndex={selected || disabled ? undefined : 0}
205
205
  onFocus={onFocus}
206
- // onClick={onClick}
207
206
  onMouseEnter={setOnHoverTrue}
208
207
  onMouseMove={setOnHoverTrue}
209
208
  onMouseLeave={setOnHoverFalse}
210
- // contain={scrollable ? "content" : "size"}
211
209
  >
212
210
 
213
211
  <ErrorBoundary>
@@ -11,7 +11,14 @@ export interface EntityTableCellActionsProps {
11
11
  children?: React.ReactNode;
12
12
  }
13
13
 
14
- export function EntityTableCellActions({ showError, disabled, showExpandIcon, selected, openPopup, children }: EntityTableCellActionsProps) {
14
+ export function EntityTableCellActions({
15
+ showError,
16
+ disabled,
17
+ showExpandIcon,
18
+ selected,
19
+ openPopup,
20
+ children
21
+ }: EntityTableCellActionsProps) {
15
22
 
16
23
  const ref = useRef<HTMLDivElement>(null);
17
24
  const doOpenPopup = useCallback(() => {
@@ -54,13 +61,18 @@ export function EntityTableCellActions({ showError, disabled, showExpandIcon, se
54
61
 
55
62
  {showError && <ErrorTooltip
56
63
  side={"left"}
57
- className={"flex items-center justify-center"}
58
- style={{ width: 32, height: 32 }}
59
64
  title={showError.message}>
60
- <ErrorOutlineIcon
61
- size={"small"}
62
- color={"error"}
63
- />
65
+ <div
66
+ className={"flex items-center justify-center"}
67
+ style={{
68
+ width: 32,
69
+ height: 32
70
+ }}>
71
+ <ErrorOutlineIcon
72
+ size={"small"}
73
+ color={"error"}
74
+ />
75
+ </div>
64
76
  </ErrorTooltip>
65
77
  }
66
78
 
@@ -27,7 +27,7 @@ import { useCustomizationController, useFireCMSContext } from "../../../../hooks
27
27
  import { OnCellValueChangeParams } from "../../../common";
28
28
 
29
29
  interface PopupFormFieldProps<M extends Record<string, any>> {
30
- entity?: Entity<M>;
30
+ entity: Entity<M>;
31
31
  customFieldValidator?: CustomFieldValidator;
32
32
  path: string;
33
33
  tableKey: string;
@@ -74,7 +74,7 @@ export function PopupFormFieldInternal<M extends Record<string, any>>({
74
74
  y: number
75
75
  }>();
76
76
 
77
- const entityId = entityProp?.id;
77
+ const entityId = entityProp.id;
78
78
  const [entity, setEntity] = useState<Entity<M> | undefined>(entityProp);
79
79
  // useEffect(() => {
80
80
  // if (entityId && inputCollection) {
@@ -217,7 +217,6 @@ export function PopupFormFieldInternal<M extends Record<string, any>>({
217
217
  if (!entity)
218
218
  return <></>;
219
219
 
220
- // enableReinitialize={true}
221
220
  // eslint-disable-next-line react-hooks/rules-of-hooks
222
221
  const formex = useCreateFormex<M>({
223
222
  initialValues: (entity?.values ?? {}) as EntityValues<M>,
@@ -264,7 +263,8 @@ export function PopupFormFieldInternal<M extends Record<string, any>>({
264
263
  values,
265
264
  path,
266
265
  setFieldValue,
267
- save: saveValue
266
+ save: saveValue,
267
+ formex
268
268
  };
269
269
 
270
270
  const property: ResolvedProperty<any> | undefined = propertyKey && getPropertyInPath(collection.properties, propertyKey as string);
@@ -276,9 +276,8 @@ export function PopupFormFieldInternal<M extends Record<string, any>>({
276
276
  includeDescription: false,
277
277
  underlyingValueHasChanged: false,
278
278
  context: formContext,
279
- tableMode: true,
280
279
  partOfArray: false,
281
- partOfBlock: false,
280
+ minimalistView: false,
282
281
  autoFocus: open
283
282
  }
284
283
  : undefined;
@@ -7,7 +7,7 @@ import {
7
7
  CollectionSize,
8
8
  Entity,
9
9
  EntityAction,
10
- EntityCollection,
10
+ EntityCollection, EntityTableController,
11
11
  FilterValues,
12
12
  PartialEntityCollection,
13
13
  PropertyOrBuilder,
@@ -45,7 +45,7 @@ import { EntityCollectionViewActions } from "./EntityCollectionViewActions";
45
45
  import {
46
46
  AddIcon,
47
47
  Button,
48
- cls,
48
+ cls, focusedDisabled,
49
49
  IconButton,
50
50
  KeyboardTabIcon,
51
51
  Markdown,
@@ -117,7 +117,7 @@ export type EntityCollectionViewProps<M extends Record<string, any>> = {
117
117
  *
118
118
  * @param fullPath
119
119
  * @param collection
120
- * @constructor
120
+
121
121
  * @group Components
122
122
  */
123
123
  export const EntityCollectionView = React.memo(
@@ -153,7 +153,7 @@ export const EntityCollectionView = React.memo(
153
153
  }, [collection]);
154
154
 
155
155
  const canCreateEntities = canCreateEntity(collection, authController, fullPath, null);
156
- const [selectedNavigationEntity, setSelectedNavigationEntity] = useState<Entity<M> | undefined>(undefined);
156
+ const [highlightedEntity, setHighlightedEntity] = useState<Entity<M> | undefined>(undefined);
157
157
  const [deleteEntityClicked, setDeleteEntityClicked] = React.useState<Entity<M> | Entity<M>[] | undefined>(undefined);
158
158
 
159
159
  const [lastDeleteTimestamp, setLastDeleteTimestamp] = React.useState<number>(0);
@@ -162,12 +162,12 @@ export const EntityCollectionView = React.memo(
162
162
  const [docsCount, setDocsCount] = useState<number>(0);
163
163
 
164
164
  const unselectNavigatedEntity = useCallback(() => {
165
- const currentSelection = selectedNavigationEntity;
165
+ const currentSelection = highlightedEntity;
166
166
  setTimeout(() => {
167
- if (currentSelection === selectedNavigationEntity)
168
- setSelectedNavigationEntity(undefined);
167
+ if (currentSelection === highlightedEntity)
168
+ setHighlightedEntity(undefined);
169
169
  }, 2400);
170
- }, [selectedNavigationEntity]);
170
+ }, [highlightedEntity]);
171
171
 
172
172
  const checkInlineEditing = useCallback((entity?: Entity<any>): boolean => {
173
173
  const collection = collectionRef.current;
@@ -186,13 +186,12 @@ export const EntityCollectionView = React.memo(
186
186
  const usedSelectionController = collection.selectionController ?? selectionController;
187
187
  const {
188
188
  selectedEntities,
189
- isEntitySelected,
190
189
  setSelectedEntities
191
190
  } = usedSelectionController;
192
191
 
193
- useEffect(() => {
194
- setDeleteEntityClicked(undefined);
195
- }, [selectedEntities]);
192
+ // useEffect(() => {
193
+ // setDeleteEntityClicked(undefined);
194
+ // }, [selectedEntities]);
196
195
 
197
196
  const tableController = useDataSourceEntityCollectionTableController<M>({
198
197
  fullPath,
@@ -208,9 +207,8 @@ export const EntityCollectionView = React.memo(
208
207
  }, [tableController.setPopupCell]);
209
208
 
210
209
  const onEntityClick = useCallback((clickedEntity: Entity<M>) => {
211
- console.log("Entity clicked", clickedEntity)
212
210
  const collection = collectionRef.current;
213
- setSelectedNavigationEntity(clickedEntity);
211
+ setHighlightedEntity(clickedEntity);
214
212
  analyticsController.onAnalyticsEvent?.("edit_entity_clicked", {
215
213
  path: clickedEntity.path,
216
214
  entityId: clickedEntity.id
@@ -266,6 +264,7 @@ export const EntityCollectionView = React.memo(
266
264
  fullPath: string,
267
265
  parentCollectionIds: string[],
268
266
  collection: EntityCollection;
267
+ tableController: EntityTableController;
269
268
  }> | undefined
270
269
 
271
270
  // we are only using the first plugin that implements this
@@ -306,7 +305,7 @@ export const EntityCollectionView = React.memo(
306
305
  value,
307
306
  property,
308
307
  entityId
309
- }) => dataSource.checkUniqueField(fullPath, name, value, entityId),
308
+ }) => dataSource.checkUniqueField(fullPath, name, value, entityId, collection),
310
309
  [fullPath]);
311
310
 
312
311
  const onValueChange: OnCellValueChange<any, any> = ({
@@ -368,12 +367,12 @@ export const EntityCollectionView = React.memo(
368
367
  return resolveProperty({
369
368
  propertyKey,
370
369
  propertyOrBuilder,
371
- path: fullPath,
370
+ path: entity.path,
372
371
  values: entity.values,
373
372
  entityId: entity.id,
374
373
  fields: customizationController.propertyConfigs
375
374
  });
376
- }, [collection.properties, customizationController.propertyConfigs, fullPath, resolvedCollection.properties]);
375
+ }, [collection.properties, customizationController.propertyConfigs, resolvedCollection.properties]);
377
376
 
378
377
  const displayedColumnIds = useColumnIds(resolvedCollection, true);
379
378
 
@@ -419,7 +418,7 @@ export const EntityCollectionView = React.memo(
419
418
  <ReferencePreview
420
419
  key={reference.path + "/" + reference.id}
421
420
  reference={reference}
422
- size={"tiny"}/>
421
+ size={"smallest"}/>
423
422
  );
424
423
  })}
425
424
  </div>
@@ -467,7 +466,7 @@ export const EntityCollectionView = React.memo(
467
466
  return (largeLayout ? (80 + actionsWidth) : (70 + actionsWidth)) + (collapsedActions.length > 0 ? (largeLayout ? 40 : 30) : 0);
468
467
  };
469
468
 
470
- const tableRowActionsBuilder = ({
469
+ const tableRowActionsBuilder = useCallback(({
471
470
  entity,
472
471
  size,
473
472
  width,
@@ -479,7 +478,7 @@ export const EntityCollectionView = React.memo(
479
478
  frozen?: boolean
480
479
  }) => {
481
480
 
482
- const isSelected = isEntitySelected(entity);
481
+ const isSelected = usedSelectionController.selectedEntities.map(e => e.id).includes(entity.id);
483
482
 
484
483
  const actions = getActionsForEntity({
485
484
  entity,
@@ -494,7 +493,7 @@ export const EntityCollectionView = React.memo(
494
493
  isSelected={isSelected}
495
494
  selectionEnabled={selectionEnabled}
496
495
  size={size}
497
- highlightEntity={setSelectedNavigationEntity}
496
+ highlightEntity={setHighlightedEntity}
498
497
  unhighlightEntity={unselectNavigatedEntity}
499
498
  collection={collection}
500
499
  fullPath={fullPath}
@@ -505,7 +504,7 @@ export const EntityCollectionView = React.memo(
505
504
  />
506
505
  );
507
506
 
508
- };
507
+ }, [updateLastDeleteTimestamp, usedSelectionController]);
509
508
 
510
509
  const title = <Popover
511
510
  open={popOverOpen}
@@ -564,6 +563,7 @@ export const EntityCollectionView = React.memo(
564
563
  property={property}
565
564
  fullPath={fullPath}
566
565
  collection={collection}
566
+ tableController={tableController}
567
567
  parentCollectionIds={parentCollectionIds ?? []}/>;
568
568
  })}
569
569
  </>;
@@ -574,7 +574,8 @@ export const EntityCollectionView = React.memo(
574
574
  if (typeof AddColumnComponent === "function")
575
575
  return <AddColumnComponent fullPath={fullPath}
576
576
  parentCollectionIds={parentCollectionIds ?? []}
577
- collection={collection}/>;
577
+ collection={collection}
578
+ tableController={tableController}/>;
578
579
  return null;
579
580
  }
580
581
  : undefined;
@@ -607,7 +608,7 @@ export const EntityCollectionView = React.memo(
607
608
  uniqueFieldValidator={uniqueFieldValidator}
608
609
  title={title}
609
610
  selectionController={usedSelectionController}
610
- highlightedEntities={selectedNavigationEntity ? [selectedNavigationEntity] : []}
611
+ highlightedEntities={highlightedEntity ? [highlightedEntity] : []}
611
612
  defaultSize={collection.defaultSize}
612
613
  properties={resolvedCollection.properties}
613
614
  getPropertyFor={getPropertyFor}
@@ -659,19 +660,19 @@ export const EntityCollectionView = React.memo(
659
660
  collection={collection}/>}
660
661
  />
661
662
 
662
- <PopupFormField
663
+ {popupCell && <PopupFormField
663
664
  key={`popup_form_${popupCell?.propertyKey}_${popupCell?.entity?.id}`}
664
665
  open={Boolean(popupCell)}
665
666
  onClose={onPopupClose}
666
667
  cellRect={popupCell?.cellRect}
667
668
  propertyKey={popupCell?.propertyKey}
668
669
  collection={collection}
669
- entity={popupCell?.entity}
670
+ entity={popupCell.entity}
670
671
  tableKey={tableKey.current}
671
672
  customFieldValidator={uniqueFieldValidator}
672
673
  path={resolvedFullPath}
673
674
  onCellValueChange={onValueChange}
674
- container={containerRef.current}/>
675
+ container={containerRef.current}/>}
675
676
 
676
677
  {deleteEntityClicked &&
677
678
  <DeleteEntityDialog
@@ -779,10 +780,13 @@ function EntityIdHeaderWidget({
779
780
  const [searchString, setSearchString] = React.useState("");
780
781
  const sideEntityController = useSideEntityController();
781
782
  return (
782
- <Tooltip title={!openPopup ? "Find by ID" : undefined}>
783
+ <Tooltip title={!openPopup ? "Find by ID" : undefined} asChild={false}>
783
784
  <Popover
784
785
  open={openPopup}
785
786
  onOpenChange={setOpenPopup}
787
+ sideOffset={0}
788
+ align={"start"}
789
+ alignOffset={-117}
786
790
  trigger={
787
791
  <IconButton size={"small"}>
788
792
  <SearchIcon size={"small"}/>
@@ -812,7 +816,7 @@ function EntityIdHeaderWidget({
812
816
  setSearchString(e.target.value);
813
817
  }}
814
818
  value={searchString}
815
- className={"flex-grow bg-transparent outline-none p-1"}/>
819
+ className={"flex-grow bg-transparent outline-none p-1 " + focusedDisabled}/>
816
820
  <Button variant={"outlined"}
817
821
  disabled={!(searchString.trim())}
818
822
  type={"submit"}
@@ -7,19 +7,31 @@ export function useSelectionController<M extends Record<string, any> = any>(
7
7
 
8
8
  const [selectedEntities, setSelectedEntities] = useState<Entity<M>[]>([]);
9
9
 
10
- const toggleEntitySelection = useCallback((entity: Entity<M>) => {
10
+ const toggleEntitySelection = useCallback((entity: Entity<M>, newSelectedState?: boolean) => {
11
11
  let newValue;
12
- if (selectedEntities.map(e => e.id).includes(entity.id)) {
13
- onSelectionChange?.(entity, false);
14
- newValue = selectedEntities.filter((item: Entity<M>) => item.id !== entity.id);
12
+ if (newSelectedState === undefined) {
13
+ if (selectedEntities.map(e => e.id).includes(entity.id)) {
14
+ onSelectionChange?.(entity, false);
15
+ newValue = selectedEntities.filter((item: Entity<M>) => item.id !== entity.id);
16
+ } else {
17
+ onSelectionChange?.(entity, true);
18
+ newValue = [...selectedEntities, entity];
19
+ }
15
20
  } else {
16
- onSelectionChange?.(entity, true);
17
- newValue = [...selectedEntities, entity];
21
+ if (newSelectedState) {
22
+ onSelectionChange?.(entity, true);
23
+ newValue = [...selectedEntities, entity];
24
+ } else {
25
+ onSelectionChange?.(entity, false);
26
+ newValue = selectedEntities.filter((item: Entity<M>) => item.id !== entity.id);
27
+ }
18
28
  }
19
29
  setSelectedEntities(newValue);
20
30
  }, [selectedEntities]);
21
31
 
22
- const isEntitySelected = useCallback((entity: Entity<M>) => selectedEntities.map(e => e.id).includes(entity.id), [selectedEntities]);
32
+ const isEntitySelected = useCallback((entity: Entity<M>) => {
33
+ return selectedEntities.map(e => e.id).includes(entity.id);
34
+ }, [selectedEntities]);
23
35
 
24
36
  return {
25
37
  selectedEntities,
@@ -8,6 +8,7 @@ import {
8
8
  getEntityPreviewKeys,
9
9
  getEntityTitlePropertyKey,
10
10
  getValueInPath,
11
+ IconForView,
11
12
  resolveCollection
12
13
  } from "../util";
13
14
  import { cls, defaultBorderMixin, IconButton, KeyboardTabIcon, Skeleton, Tooltip, Typography } from "@firecms/ui";
@@ -76,18 +77,18 @@ export function EntityPreview({
76
77
  return <EntityPreviewContainer onClick={disabled ? undefined : onClick}
77
78
  hover={disabled ? undefined : hover}
78
79
  size={size}>
79
- {imageProperty && (
80
- <div className={cls("w-10 h-10 mr-2 shrink-0 grow-0", size === "tiny" ? "my-0.5" : "m-2 self-start")}>
81
- <PropertyPreview property={imageProperty}
82
- propertyKey={imagePropertyKey as string}
83
- size={"tiny"}
84
- value={getValueInPath(entity.values, imagePropertyKey as string)}/>
85
- </div>
86
- )}
87
-
88
- <div className={"flex flex-col flex-grow w-full m-1"}>
89
-
90
- {size !== "tiny" && includeId && (
80
+ <div className={cls("flex w-10 h-10 mr-2 shrink-0", size === "smallest" ? "my-0.5" : "m-2 self-start")}>
81
+ {imageProperty && <PropertyPreview property={imageProperty}
82
+ propertyKey={imagePropertyKey as string}
83
+ size={"smallest"}
84
+ value={getValueInPath(entity.values, imagePropertyKey as string)}/>}
85
+ {!imageProperty && <IconForView collectionOrView={collection} size={size} className={"m-auto"}/>}
86
+ </div>
87
+
88
+
89
+ <div className={"flex flex-col grow-1 w-full max-w-full m-1"}>
90
+
91
+ {size !== "smallest" && includeId && (
91
92
  entity
92
93
  ? <div className={`${
93
94
  size !== "medium"
@@ -131,10 +132,10 @@ export function EntityPreview({
131
132
  propertyKey={key as string}
132
133
  value={getValueInPath(entity.values, key)}
133
134
  property={childProperty as ResolvedProperty}
134
- size={"tiny"}/>
135
+ size={"smallest"}/>
135
136
  : <SkeletonPropertyComponent
136
137
  property={childProperty as ResolvedProperty}
137
- size={"tiny"}/>
138
+ size={"smallest"}/>
138
139
  }
139
140
  </div>
140
141
  );
@@ -143,11 +144,11 @@ export function EntityPreview({
143
144
  </div>
144
145
 
145
146
  {entity && includeEntityLink &&
146
- <Tooltip title={`See details for ${entity.id}`}
147
- className={size !== "tiny" ? "self-start" : ""}>
147
+ <Tooltip title={`See details for ${entity.id}`}>
148
148
  <IconButton
149
149
  color={"inherit"}
150
150
  size={"small"}
151
+ className={size !== "smallest" ? "self-start" : ""}
151
152
  onClick={(e) => {
152
153
  e.stopPropagation();
153
154
  analyticsController.onAnalyticsEvent?.("entity_click_from_reference", {
@@ -180,16 +181,17 @@ export type EntityPreviewContainerProps = {
180
181
  onClick?: (e: React.SyntheticEvent) => void;
181
182
  };
182
183
 
183
- const EntityPreviewContainerInner = React.forwardRef<HTMLDivElement, EntityPreviewContainerProps>(({
184
- children,
185
- hover,
186
- onClick,
187
- size,
188
- style,
189
- className,
190
- fullwidth = true,
191
- ...props
192
- }, ref) => {
184
+
185
+ export const EntityPreviewContainer = React.forwardRef<HTMLDivElement, EntityPreviewContainerProps>(({
186
+ children,
187
+ hover,
188
+ onClick,
189
+ size,
190
+ style,
191
+ className,
192
+ fullwidth = true,
193
+ ...props
194
+ }, ref) => {
193
195
  return <div
194
196
  ref={ref}
195
197
  style={{
@@ -199,10 +201,11 @@ const EntityPreviewContainerInner = React.forwardRef<HTMLDivElement, EntityPrevi
199
201
  }}
200
202
  className={cls(
201
203
  "bg-white dark:bg-gray-900",
204
+ "min-h-[42px]",
202
205
  fullwidth ? "w-full" : "",
203
206
  "items-center",
204
207
  hover ? "hover:bg-slate-50 dark:hover:bg-gray-800 group-hover:bg-slate-50 dark:group-hover:bg-gray-800" : "",
205
- size === "tiny" ? "p-1" : "p-2",
208
+ size === "smallest" ? "p-1" : "px-2 py-1",
206
209
  "flex border rounded-lg",
207
210
  onClick ? "cursor-pointer" : "",
208
211
  defaultBorderMixin,
@@ -217,7 +220,3 @@ const EntityPreviewContainerInner = React.forwardRef<HTMLDivElement, EntityPrevi
217
220
  {children}
218
221
  </div>;
219
222
  });
220
-
221
- EntityPreviewContainerInner.displayName = "EntityPreviewContainer";
222
-
223
- export const EntityPreviewContainer = React.memo(EntityPreviewContainerInner) as React.FC<EntityPreviewContainerProps>;
@@ -17,7 +17,7 @@ export interface ErrorViewProps {
17
17
  * @param title
18
18
  * @param error
19
19
  * @param tooltip
20
- * @constructor
20
+
21
21
  * @group Components
22
22
  */
23
23
  export function ErrorView({