@firecms/core 3.0.0-canary.9 → 3.0.0-canary.90

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 (246) hide show
  1. package/README.md +1 -1
  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 +1 -1
  11. package/dist/components/EntityCollectionTable/EntityCollectionTableProps.d.ts +5 -3
  12. package/dist/components/EntityCollectionTable/PropertyTableCell.d.ts +1 -0
  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 +12 -2
  19. package/dist/components/EntityCollectionView/EntityCollectionViewStartActions.d.ts +11 -0
  20. package/dist/components/EntityPreview.d.ts +5 -4
  21. package/dist/components/ErrorView.d.ts +1 -1
  22. package/dist/components/HomePage/DefaultHomePage.d.ts +1 -1
  23. package/dist/components/HomePage/NavigationCardBinding.d.ts +1 -1
  24. package/dist/components/ReferenceWidget.d.ts +3 -1
  25. package/dist/components/SelectableTable/SelectableTable.d.ts +1 -1
  26. package/dist/components/SelectableTable/filters/ReferenceFilterField.d.ts +2 -1
  27. package/dist/components/VirtualTable/VirtualTableProps.d.ts +15 -12
  28. package/dist/components/VirtualTable/types.d.ts +3 -3
  29. package/dist/components/{EntityCollectionTable/internal → common}/default_entity_actions.d.ts +1 -1
  30. package/dist/components/common/index.d.ts +1 -0
  31. package/dist/components/common/table_height.d.ts +5 -0
  32. package/dist/components/common/types.d.ts +4 -6
  33. package/dist/components/common/useDataSourceEntityCollectionTableController.d.ts +3 -0
  34. package/dist/components/index.d.ts +2 -1
  35. package/dist/contexts/AuthControllerContext.d.ts +1 -1
  36. package/dist/{components/FireCMSAppBar.d.ts → core/DefaultAppBar.d.ts} +6 -9
  37. package/dist/core/DefaultDrawer.d.ts +19 -0
  38. package/dist/core/DrawerNavigationItem.d.ts +9 -0
  39. package/dist/core/EntityEditView.d.ts +17 -3
  40. package/dist/core/FireCMS.d.ts +1 -1
  41. package/dist/core/NavigationRoutes.d.ts +3 -3
  42. package/dist/core/index.d.ts +3 -4
  43. package/dist/form/PropertiesForm.d.ts +8 -0
  44. package/dist/form/components/ErrorFocus.d.ts +1 -1
  45. package/dist/form/components/FieldHelperText.d.ts +3 -3
  46. package/dist/form/components/StorageItemPreview.d.ts +4 -4
  47. package/dist/form/field_bindings/MapFieldBinding.d.ts +1 -1
  48. package/dist/form/field_bindings/StorageUploadFieldBinding.d.ts +2 -4
  49. package/dist/form/index.d.ts +0 -2
  50. package/dist/hooks/data/delete.d.ts +2 -2
  51. package/dist/hooks/data/save.d.ts +2 -3
  52. package/dist/hooks/data/useDataSource.d.ts +1 -1
  53. package/dist/hooks/data/useEntityFetch.d.ts +3 -3
  54. package/dist/hooks/index.d.ts +2 -0
  55. package/dist/hooks/useBuildNavigationController.d.ts +1 -2
  56. package/dist/hooks/useProjectLog.d.ts +2 -2
  57. package/dist/hooks/useValidateAuthenticator.d.ts +21 -0
  58. package/dist/index.d.ts +1 -0
  59. package/dist/index.es.js +15552 -11933
  60. package/dist/index.es.js.map +1 -1
  61. package/dist/index.umd.js +19643 -7
  62. package/dist/index.umd.js.map +1 -1
  63. package/dist/internal/useBuildDataSource.d.ts +1 -16
  64. package/dist/internal/useRestoreScroll.d.ts +1 -1
  65. package/dist/preview/PropertyPreviewProps.d.ts +6 -4
  66. package/dist/preview/components/ReferencePreview.d.ts +2 -1
  67. package/dist/preview/components/StorageThumbnail.d.ts +2 -1
  68. package/dist/preview/components/UrlComponentPreview.d.ts +2 -1
  69. package/dist/types/auth.d.ts +26 -2
  70. package/dist/types/collections.d.ts +31 -7
  71. package/dist/types/datasource.d.ts +34 -20
  72. package/dist/types/entities.d.ts +5 -1
  73. package/dist/types/entity_actions.d.ts +14 -0
  74. package/dist/types/entity_callbacks.d.ts +2 -2
  75. package/dist/types/fields.d.ts +31 -30
  76. package/dist/types/index.d.ts +0 -1
  77. package/dist/types/navigation.d.ts +5 -5
  78. package/dist/types/plugins.d.ts +16 -6
  79. package/dist/types/properties.d.ts +17 -4
  80. package/dist/types/storage.d.ts +11 -3
  81. package/dist/util/collections.d.ts +1 -1
  82. package/dist/util/entities.d.ts +1 -1
  83. package/dist/util/icon_synonyms.d.ts +1 -97
  84. package/dist/util/icons.d.ts +2 -2
  85. package/dist/util/navigation_utils.d.ts +2 -2
  86. package/dist/util/objects.d.ts +1 -1
  87. package/dist/util/plurals.d.ts +0 -2
  88. package/dist/util/resolutions.d.ts +13 -13
  89. package/dist/util/storage.d.ts +23 -2
  90. package/dist/util/useStorageUploadController.d.ts +1 -1
  91. package/dist/util/useTraceUpdate.d.ts +1 -0
  92. package/package.json +130 -119
  93. package/src/app/AppBar.tsx +18 -0
  94. package/src/app/Drawer.tsx +25 -0
  95. package/src/app/Scaffold.tsx +249 -0
  96. package/src/app/index.ts +4 -0
  97. package/src/app/useApp.tsx +32 -0
  98. package/src/components/CircularProgressCenter.tsx +1 -1
  99. package/src/components/ClearFilterSortButton.tsx +41 -0
  100. package/src/components/EntityCollectionTable/EntityCollectionRowActions.tsx +9 -18
  101. package/src/components/EntityCollectionTable/EntityCollectionTable.tsx +21 -20
  102. package/src/components/EntityCollectionTable/EntityCollectionTableProps.tsx +10 -6
  103. package/src/components/EntityCollectionTable/PropertyTableCell.tsx +38 -34
  104. package/src/components/EntityCollectionTable/column_utils.tsx +3 -3
  105. package/src/components/EntityCollectionTable/fields/TableReferenceField.tsx +11 -2
  106. package/src/components/EntityCollectionTable/fields/TableStorageUpload.tsx +14 -6
  107. package/src/components/EntityCollectionTable/internal/CollectionTableToolbar.tsx +29 -34
  108. package/src/components/EntityCollectionTable/internal/EntityTableCell.tsx +16 -12
  109. package/src/components/EntityCollectionTable/internal/popup_field/PopupFormField.tsx +4 -5
  110. package/src/components/EntityCollectionView/EntityCollectionView.tsx +69 -45
  111. package/src/components/EntityCollectionView/EntityCollectionViewStartActions.tsx +68 -0
  112. package/src/components/EntityCollectionView/useSelectionController.tsx +19 -7
  113. package/src/components/EntityPreview.tsx +15 -9
  114. package/src/components/EntityView.tsx +5 -5
  115. package/src/components/ErrorView.tsx +1 -1
  116. package/src/components/HomePage/DefaultHomePage.tsx +3 -3
  117. package/src/components/HomePage/NavigationCard.tsx +3 -3
  118. package/src/components/HomePage/NavigationCardBinding.tsx +1 -1
  119. package/src/components/HomePage/SmallNavigationCard.tsx +5 -5
  120. package/src/components/PropertyIdCopyTooltipContent.tsx +2 -3
  121. package/src/components/ReferenceTable/ReferenceSelectionTable.tsx +1 -0
  122. package/src/components/ReferenceWidget.tsx +22 -12
  123. package/src/components/SearchIconsView.tsx +5 -5
  124. package/src/components/SelectableTable/SelectableTable.tsx +7 -7
  125. package/src/components/SelectableTable/filters/BooleanFilterField.tsx +2 -3
  126. package/src/components/SelectableTable/filters/DateTimeFilterField.tsx +22 -7
  127. package/src/components/SelectableTable/filters/ReferenceFilterField.tsx +28 -6
  128. package/src/components/SelectableTable/filters/StringNumberFilterField.tsx +35 -15
  129. package/src/components/VirtualTable/VirtualTable.tsx +70 -37
  130. package/src/components/VirtualTable/VirtualTableCell.tsx +1 -1
  131. package/src/components/VirtualTable/VirtualTableHeader.tsx +4 -4
  132. package/src/components/VirtualTable/VirtualTableHeaderRow.tsx +2 -2
  133. package/src/components/VirtualTable/VirtualTableProps.tsx +18 -14
  134. package/src/components/VirtualTable/VirtualTableRow.tsx +4 -5
  135. package/src/components/VirtualTable/fields/VirtualTableDateField.tsx +1 -1
  136. package/src/components/VirtualTable/types.tsx +2 -3
  137. package/src/components/{EntityCollectionTable/internal → common}/default_entity_actions.tsx +2 -2
  138. package/src/components/common/index.ts +1 -0
  139. package/src/components/{VirtualTable/common.tsx → common/table_height.tsx} +5 -2
  140. package/src/components/common/types.tsx +4 -6
  141. package/src/components/common/useColumnsIds.tsx +10 -2
  142. package/src/components/common/useDataSourceEntityCollectionTableController.tsx +11 -0
  143. package/src/components/common/useTableSearchHelper.ts +52 -12
  144. package/src/components/index.tsx +2 -1
  145. package/src/contexts/AuthControllerContext.tsx +1 -1
  146. package/src/contexts/DialogsProvider.tsx +2 -2
  147. package/src/{components/FireCMSAppBar.tsx → core/DefaultAppBar.tsx} +52 -37
  148. package/src/core/DefaultDrawer.tsx +177 -0
  149. package/src/core/DrawerNavigationItem.tsx +62 -0
  150. package/src/core/EntityEditView.tsx +676 -133
  151. package/src/core/EntitySidePanel.tsx +1 -2
  152. package/src/core/FireCMS.tsx +39 -44
  153. package/src/core/NavigationRoutes.tsx +7 -8
  154. package/src/core/field_configs.tsx +2 -3
  155. package/src/core/index.tsx +3 -4
  156. package/src/form/PropertiesForm.tsx +81 -0
  157. package/src/form/PropertyFieldBinding.tsx +29 -7
  158. package/src/form/components/FieldHelperText.tsx +3 -3
  159. package/src/form/components/StorageItemPreview.tsx +20 -11
  160. package/src/form/components/StorageUploadProgress.tsx +3 -3
  161. package/src/form/field_bindings/ArrayCustomShapedFieldBinding.tsx +8 -5
  162. package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +8 -5
  163. package/src/form/field_bindings/BlockFieldBinding.tsx +2 -2
  164. package/src/form/field_bindings/KeyValueFieldBinding.tsx +44 -39
  165. package/src/form/field_bindings/MapFieldBinding.tsx +11 -3
  166. package/src/form/field_bindings/MarkdownFieldBinding.tsx +2 -2
  167. package/src/form/field_bindings/ReadOnlyFieldBinding.tsx +2 -9
  168. package/src/form/field_bindings/ReferenceFieldBinding.tsx +15 -13
  169. package/src/form/field_bindings/RepeatFieldBinding.tsx +10 -7
  170. package/src/form/field_bindings/SelectFieldBinding.tsx +3 -3
  171. package/src/form/field_bindings/StorageUploadFieldBinding.tsx +22 -43
  172. package/src/form/field_bindings/SwitchFieldBinding.tsx +1 -1
  173. package/src/form/index.tsx +4 -4
  174. package/src/form/validation.ts +1 -17
  175. package/src/hooks/data/delete.ts +3 -3
  176. package/src/hooks/data/save.ts +4 -2
  177. package/src/hooks/data/useDataSource.tsx +2 -2
  178. package/src/hooks/data/useEntityFetch.tsx +3 -3
  179. package/src/hooks/index.tsx +3 -0
  180. package/src/hooks/useBuildLocalConfigurationPersistence.tsx +8 -10
  181. package/src/hooks/useBuildModeController.tsx +11 -5
  182. package/src/hooks/useBuildNavigationController.tsx +137 -61
  183. package/src/hooks/useProjectLog.tsx +21 -8
  184. package/src/hooks/useResolvedNavigationFrom.tsx +1 -1
  185. package/src/hooks/useValidateAuthenticator.tsx +115 -0
  186. package/src/index.ts +1 -0
  187. package/src/internal/useBuildDataSource.ts +56 -49
  188. package/src/internal/useBuildSideEntityController.tsx +88 -21
  189. package/src/preview/PropertyPreview.tsx +9 -16
  190. package/src/preview/PropertyPreviewProps.tsx +4 -8
  191. package/src/preview/components/BooleanPreview.tsx +4 -2
  192. package/src/preview/components/EnumValuesChip.tsx +1 -1
  193. package/src/preview/components/ImagePreview.tsx +21 -33
  194. package/src/preview/components/ReferencePreview.tsx +23 -23
  195. package/src/preview/components/StorageThumbnail.tsx +5 -1
  196. package/src/preview/components/UrlComponentPreview.tsx +44 -11
  197. package/src/preview/property_previews/ArrayOfMapsPreview.tsx +0 -1
  198. package/src/preview/property_previews/ArrayOfReferencesPreview.tsx +2 -1
  199. package/src/preview/property_previews/ArrayOfStorageComponentsPreview.tsx +0 -1
  200. package/src/preview/property_previews/ArrayOfStringsPreview.tsx +0 -1
  201. package/src/preview/property_previews/ArrayOneOfPreview.tsx +2 -3
  202. package/src/preview/property_previews/ArrayPropertyPreview.tsx +2 -3
  203. package/src/preview/property_previews/MapPropertyPreview.tsx +5 -5
  204. package/src/preview/property_previews/StringPropertyPreview.tsx +2 -2
  205. package/src/types/auth.tsx +35 -2
  206. package/src/types/collections.ts +37 -8
  207. package/src/types/customization_controller.tsx +0 -1
  208. package/src/types/datasource.ts +41 -24
  209. package/src/types/entities.ts +9 -1
  210. package/src/types/entity_actions.tsx +16 -3
  211. package/src/types/entity_callbacks.ts +2 -2
  212. package/src/types/fields.tsx +33 -33
  213. package/src/types/index.ts +0 -1
  214. package/src/types/navigation.ts +6 -7
  215. package/src/types/plugins.tsx +18 -8
  216. package/src/types/properties.ts +22 -6
  217. package/src/types/storage.ts +12 -3
  218. package/src/util/collections.ts +1 -1
  219. package/src/util/entities.ts +5 -4
  220. package/src/util/enums.ts +1 -1
  221. package/src/util/icon_list.ts +2 -2
  222. package/src/util/icon_synonyms.ts +3 -99
  223. package/src/util/navigation_utils.ts +6 -6
  224. package/src/util/objects.ts +25 -28
  225. package/src/util/permissions.ts +1 -0
  226. package/src/util/plurals.ts +0 -2
  227. package/src/util/resolutions.ts +32 -31
  228. package/src/util/storage.ts +75 -21
  229. package/src/util/strings.ts +2 -2
  230. package/src/util/useStorageUploadController.tsx +21 -3
  231. package/src/util/useTraceUpdate.tsx +2 -1
  232. package/dist/components/VirtualTable/common.d.ts +0 -2
  233. package/dist/core/Drawer.d.ts +0 -23
  234. package/dist/core/Scaffold.d.ts +0 -55
  235. package/dist/core/SideEntityView.d.ts +0 -7
  236. package/dist/form/EntityForm.d.ts +0 -77
  237. package/dist/internal/useBuildCustomizationController.d.ts +0 -2
  238. package/dist/internal/useLocaleConfig.d.ts +0 -1
  239. package/dist/types/appcheck.d.ts +0 -26
  240. package/src/core/Drawer.tsx +0 -191
  241. package/src/core/Scaffold.tsx +0 -281
  242. package/src/core/SideEntityView.tsx +0 -38
  243. package/src/form/EntityForm.tsx +0 -728
  244. package/src/internal/useBuildCustomizationController.tsx +0 -5
  245. package/src/internal/useLocaleConfig.tsx +0 -18
  246. package/src/types/appcheck.ts +0 -29
@@ -1,7 +1,7 @@
1
1
  import React, { MouseEvent, useCallback } from "react";
2
2
 
3
3
  import { CollectionSize, Entity, EntityAction, EntityCollection, SelectionController } from "../../types";
4
- import { Checkbox, cn, IconButton, Menu, MenuItem, MoreVertIcon, Skeleton, Tooltip, Typography } from "@firecms/ui";
4
+ import { Checkbox, cls, IconButton, Menu, MenuItem, MoreVertIcon, Skeleton, Tooltip } from "@firecms/ui";
5
5
  import { useFireCMSContext, useLargeLayout } from "../../hooks";
6
6
 
7
7
  /**
@@ -14,7 +14,6 @@ import { useFireCMSContext, useLargeLayout } from "../../hooks";
14
14
  * @param size
15
15
  * @param toggleEntitySelection
16
16
  * @param hideId
17
- * @constructor
18
17
  *
19
18
  * @group Collection components
20
19
  */
@@ -56,12 +55,7 @@ export const EntityCollectionRowActions = function EntityCollectionRowActions({
56
55
  const context = useFireCMSContext();
57
56
 
58
57
  const onCheckedChange = useCallback((checked: boolean) => {
59
- selectionController?.toggleEntitySelection(entity);
60
- }, [entity, selectionController?.toggleEntitySelection]);
61
-
62
- const onClick = useCallback((event: MouseEvent) => {
63
- event.stopPropagation();
64
- selectionController?.toggleEntitySelection(entity);
58
+ selectionController?.toggleEntitySelection(entity, checked);
65
59
  }, [entity, selectionController?.toggleEntitySelection]);
66
60
 
67
61
  const hasActions = actions.length > 0;
@@ -71,8 +65,7 @@ export const EntityCollectionRowActions = function EntityCollectionRowActions({
71
65
  const uncollapsedActions = actions.filter(a => a.collapsed === false);
72
66
  return (
73
67
  <div
74
- onClick={onClick}
75
- className={cn(
68
+ className={cls(
76
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",
77
70
  frozen ? "sticky left-0" : ""
78
71
  )}
@@ -149,16 +142,14 @@ export const EntityCollectionRowActions = function EntityCollectionRowActions({
149
142
  </div>}
150
143
 
151
144
  {!hideId && size !== "xs" && (
152
- <div className="w-[138px] text-center overflow-hidden truncate">
145
+ <div
146
+ 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"
147
+ onClick={(event) => {
148
+ event.stopPropagation();
149
+ }}>
153
150
 
154
151
  {entity
155
- ? <Typography
156
- onClick={(event) => {
157
- event.stopPropagation();
158
- }}
159
- className={"font-mono select-all"}
160
- variant={"caption"}
161
- color={"secondary"}> {entity.id} </Typography>
152
+ ? entity.id
162
153
  : <Skeleton/>
163
154
  }
164
155
  </div>
@@ -5,7 +5,6 @@ import { ErrorBoundary } from "../ErrorBoundary";
5
5
  import { useFireCMSContext, useLargeLayout } from "../../hooks";
6
6
  import { CellRendererParams, VirtualTableColumn } from "../VirtualTable";
7
7
  import { getValueInPath } from "../../util";
8
- import { getRowHeight } from "../VirtualTable/common";
9
8
  import { EntityCollectionRowActions } from "./EntityCollectionRowActions";
10
9
  import { CollectionTableToolbar } from "./internal/CollectionTableToolbar";
11
10
  import { EntityCollectionTableProps } from "./EntityCollectionTableProps";
@@ -15,7 +14,8 @@ import { renderSkeletonText } from "../../preview";
15
14
  import { propertiesToColumns } from "./column_utils";
16
15
  import { ErrorView } from "../ErrorView";
17
16
  import { SelectableTable } from "../SelectableTable/SelectableTable";
18
-
17
+ import { cls } from "@firecms/ui";
18
+ import { getRowHeight } from "../common/table_height";
19
19
 
20
20
  /**
21
21
  * This component is in charge of rendering a collection table with a high
@@ -43,6 +43,8 @@ import { SelectableTable } from "../SelectableTable/SelectableTable";
43
43
  */
44
44
  export const EntityCollectionTable = function EntityCollectionTable<M extends Record<string, any>, UserType extends User>
45
45
  ({
46
+ className,
47
+ style,
46
48
  forceFilter,
47
49
  actionsStart,
48
50
  actions,
@@ -73,13 +75,13 @@ export const EntityCollectionTable = function EntityCollectionTable<M extends Re
73
75
  emptyComponent,
74
76
  getIdColumnWidth,
75
77
  onTextSearchClick,
76
- textSearchLoading
78
+ textSearchLoading,
79
+ enablePopupIcon
77
80
  }: EntityCollectionTableProps<M>) {
78
81
 
79
82
  const ref = useRef<HTMLDivElement>(null);
80
83
 
81
84
  const largeLayout = useLargeLayout();
82
- const disabledFilterChange = Boolean(forceFilter);
83
85
  const selectedEntities = (selectionController?.selectedEntities?.length > 0 ? selectionController?.selectedEntities : highlightedEntities)?.filter(Boolean);
84
86
 
85
87
  const context: FireCMSContext<UserType> = useFireCMSContext();
@@ -88,8 +90,6 @@ export const EntityCollectionTable = function EntityCollectionTable<M extends Re
88
90
 
89
91
  const selectedEntityIds = selectedEntities?.map(e => e.id);
90
92
 
91
- const filterIsSet = !!tableController.filterValues && Object.keys(tableController.filterValues).length > 0;
92
-
93
93
  const updateSize = useCallback((size: CollectionSize) => {
94
94
  if (onSizeChanged)
95
95
  onSizeChanged(size);
@@ -120,10 +120,8 @@ export const EntityCollectionTable = function EntityCollectionTable<M extends Re
120
120
  const propertyKey = column.key;
121
121
 
122
122
  let disabled = column.custom?.disabled;
123
- const propertyValue = entity.values ? getValueInPath(entity.values, propertyKey) : undefined;
124
123
  const property = getPropertyFor?.({
125
124
  propertyKey,
126
- propertyValue,
127
125
  entity
128
126
  }) ?? column.custom.resolvedProperty;
129
127
  if (!property?.disabled) {
@@ -150,6 +148,7 @@ export const EntityCollectionTable = function EntityCollectionTable<M extends Re
150
148
  height={getRowHeight(size)}
151
149
  entity={entity}
152
150
  disabled={disabled}
151
+ enablePopupIcon={enablePopupIcon}
153
152
  path={entity.path}/>
154
153
  : renderSkeletonText()
155
154
  }
@@ -179,7 +178,10 @@ export const EntityCollectionTable = function EntityCollectionTable<M extends Re
179
178
 
180
179
  const child = Builder
181
180
  ? <Builder entity={entity} context={context}/>
182
- : <>{additionalField.value?.({ entity, context })}</>;
181
+ : <>{additionalField.value?.({
182
+ entity,
183
+ context
184
+ })}</>;
183
185
 
184
186
  return (
185
187
  <EntityTableCell
@@ -207,7 +209,6 @@ export const EntityCollectionTable = function EntityCollectionTable<M extends Re
207
209
  properties,
208
210
  sortable,
209
211
  forceFilter,
210
- disabledFilter: disabledFilterChange,
211
212
  AdditionalHeaderWidget
212
213
  });
213
214
 
@@ -237,13 +238,15 @@ export const EntityCollectionTable = function EntityCollectionTable<M extends Re
237
238
 
238
239
  const columns: VirtualTableColumn[] = [
239
240
  idColumn,
240
- ...displayedColumnIds
241
- .map((p) => {
242
- return collectionColumns.find(c => c.key === p.key);
243
- }).filter(Boolean) as VirtualTableColumn[]
241
+ ...(displayedColumnIds
242
+ ? displayedColumnIds
243
+ .map((p) => {
244
+ return collectionColumns.find(c => c.key === p.key);
245
+ }).filter(Boolean)
246
+ : collectionColumns) as VirtualTableColumn[]
244
247
  ];
245
248
 
246
- const cellRenderer = (props: CellRendererParams<any>) => {
249
+ const cellRenderer = useCallback((props: CellRendererParams<any>) => {
247
250
  const column = props.column;
248
251
  const columns = props.columns;
249
252
  const columnKey = column.key;
@@ -283,20 +286,18 @@ export const EntityCollectionTable = function EntityCollectionTable<M extends Re
283
286
  <ErrorView error={e}/>
284
287
  </EntityTableCell>;
285
288
  }
286
- }
289
+ }, [tableRowActionsBuilder, additionalCellRenderer, propertyCellRenderer, size]);
287
290
 
288
291
  return (
289
292
 
290
293
  <div ref={ref}
291
- className="h-full w-full flex flex-col bg-white dark:bg-gray-950">
294
+ style={style}
295
+ className={cls("h-full w-full flex flex-col bg-white dark:bg-gray-950", className)}>
292
296
 
293
297
  <CollectionTableToolbar
294
- forceFilter={disabledFilterChange}
295
- filterIsSet={filterIsSet}
296
298
  onTextSearch={textSearchEnabled ? onTextSearch : undefined}
297
299
  textSearchLoading={textSearchLoading}
298
300
  onTextSearchClick={textSearchEnabled ? onTextSearchClick : undefined}
299
- clearFilter={tableController.clearFilter}
300
301
  size={size}
301
302
  onSizeChanged={updateSize}
302
303
  title={title}
@@ -2,7 +2,7 @@ import React from "react";
2
2
  import {
3
3
  AdditionalFieldDelegate,
4
4
  CollectionSize,
5
- Entity, EntityCollection,
5
+ Entity,
6
6
  EntityTableController,
7
7
  FilterValues,
8
8
  ResolvedProperties,
@@ -12,13 +12,16 @@ import {
12
12
  } from "../../types";
13
13
  import { OnCellValueChange, OnColumnResizeParams, UniqueFieldValidator } from "../common/types";
14
14
 
15
-
16
15
  /**
17
16
  * @group Collection components
18
17
  */
19
18
  export type EntityCollectionTableProps<M extends Record<string, any>,
20
19
  UserType extends User = User> = {
21
20
 
21
+ className?: string;
22
+
23
+ style?: React.CSSProperties;
24
+
22
25
  /**
23
26
  * Display these entities as selected
24
27
  */
@@ -92,7 +95,7 @@ export type EntityCollectionTableProps<M extends Record<string, any>,
92
95
  */
93
96
  tableController: EntityTableController<M>;
94
97
 
95
- displayedColumnIds: PropertyColumnConfig[];
98
+ displayedColumnIds?: PropertyColumnConfig[];
96
99
 
97
100
  forceFilter?: FilterValues<Extract<keyof M, string>>;
98
101
 
@@ -131,15 +134,16 @@ export type EntityCollectionTableProps<M extends Record<string, any>,
131
134
  onTextSearchClick?: () => void;
132
135
 
133
136
  textSearchLoading?: boolean;
134
- }
137
+
138
+ enablePopupIcon: boolean;
139
+ };
135
140
 
136
141
  export type GetPropertyForProps<M extends Record<string, any>> = {
137
142
  propertyKey: string,
138
- propertyValue: any,
139
143
  entity: Entity<M>
140
144
  };
141
145
 
142
146
  export type PropertyColumnConfig = {
143
147
  key: string,
144
- disabled: boolean,
148
+ disabled?: boolean,
145
149
  };
@@ -24,14 +24,13 @@ import { getPreviewSizeFrom } from "../../preview/util";
24
24
  import { isReadOnly } from "../../util";
25
25
 
26
26
  import { CustomFieldValidator, mapPropertyToYup } from "../../form/validation";
27
- import { useFireCMSContext } from "../../hooks";
28
27
 
29
28
  import { EntityTableCell } from "./internal/EntityTableCell";
30
29
  import { EntityTableCellActions } from "./internal/EntityTableCellActions";
31
30
 
32
- import { getRowHeight } from "../VirtualTable/common";
33
31
  import { useSelectableTableController } from "../SelectableTable/SelectableTableContext";
34
32
  import { useClearRestoreValue } from "../../form/useClearRestoreValue";
33
+ import { getRowHeight } from "../common/table_height";
35
34
 
36
35
  export interface PropertyTableCellProps<T extends CMSType> {
37
36
  propertyKey: string;
@@ -46,6 +45,7 @@ export interface PropertyTableCellProps<T extends CMSType> {
46
45
  entity: Entity<any>;
47
46
  path: string;
48
47
  disabled: boolean;
48
+ enablePopupIcon?: boolean;
49
49
  }
50
50
 
51
51
  function isStorageProperty(property: ResolvedProperty) {
@@ -74,11 +74,10 @@ export const PropertyTableCell = React.memo<PropertyTableCellProps<any>>(
74
74
  path,
75
75
  entity,
76
76
  readonly,
77
- disabled: disabledProp
77
+ disabled: disabledProp,
78
+ enablePopupIcon = true
78
79
  }: PropertyTableCellProps<T>) {
79
80
 
80
- const context = useFireCMSContext();
81
-
82
81
  const {
83
82
  onValueChange,
84
83
  size,
@@ -95,6 +94,7 @@ export const PropertyTableCell = React.memo<PropertyTableCellProps<any>>(
95
94
  const internalValueRef = useRef(value);
96
95
 
97
96
  const [error, setError] = useState<Error | undefined>();
97
+ const [validationError, setValidationError] = useState<Error | undefined>();
98
98
  const [saved, setSaved] = useState<boolean>(false);
99
99
 
100
100
  const onValueUpdated = useCallback(() => {
@@ -120,7 +120,7 @@ export const PropertyTableCell = React.memo<PropertyTableCellProps<any>>(
120
120
  useEffect(
121
121
  () => {
122
122
  if (!equal(value, internalValueRef.current)) {
123
- setError(undefined);
123
+ setValidationError(undefined);
124
124
  setInternalValue(value);
125
125
  internalValueRef.current = value;
126
126
  onValueUpdated();
@@ -136,32 +136,34 @@ export const PropertyTableCell = React.memo<PropertyTableCellProps<any>>(
136
136
  validation
137
137
  .validate(value)
138
138
  .then(() => {
139
- setError(undefined);
139
+ setValidationError(undefined);
140
140
  internalValueRef.current = value;
141
141
  if (onValueChange) {
142
- onValueChange({
143
- value,
144
- propertyKey,
145
- setError,
146
- onValueUpdated,
147
- entity,
148
- fullPath: path,
149
- context
150
- });
142
+ try {
143
+ onValueChange({
144
+ value,
145
+ propertyKey,
146
+ setError,
147
+ onValueUpdated,
148
+ data: entity,
149
+ });
150
+ } catch (e:any) {
151
+ console.error("onValueChange error", e);
152
+ setError(e);
153
+ }
154
+
151
155
  }
152
156
  })
153
157
  .catch((e) => {
154
- setError(e);
158
+ setValidationError(e);
155
159
  });
156
160
  };
157
161
 
158
162
  useEffect(() => {
159
163
  validation
160
164
  .validate(internalValue)
161
- .then(() => setError(undefined))
162
- .catch((e) => {
163
- setError(e);
164
- });
165
+ .then(() => setValidationError(undefined))
166
+ .catch(setValidationError);
165
167
  }, [internalValue, validation, propertyKey, property, entity]);
166
168
 
167
169
  const updateValue = (newValue: any | null) => {
@@ -237,7 +239,6 @@ export const PropertyTableCell = React.memo<PropertyTableCellProps<any>>(
237
239
  height={getRowHeight(size)}
238
240
  propertyKey={propertyKey}
239
241
  property={property}
240
- // entity={entity}
241
242
  value={internalValue}
242
243
  size={getPreviewSizeFrom(size)}
243
244
  />
@@ -247,7 +248,7 @@ export const PropertyTableCell = React.memo<PropertyTableCellProps<any>>(
247
248
  if (!customField && (!customPreview || selected)) {
248
249
  const isAStorageProperty = isStorageProperty(property);
249
250
  if (isAStorageProperty) {
250
- innerComponent = <TableStorageUpload error={error}
251
+ innerComponent = <TableStorageUpload error={validationError ?? error}
251
252
  disabled={disabled}
252
253
  focused={selected}
253
254
  selected={selected}
@@ -274,7 +275,7 @@ export const PropertyTableCell = React.memo<PropertyTableCellProps<any>>(
274
275
  valueType={"number"}
275
276
  small={getPreviewSizeFrom(size) !== "medium"}
276
277
  enumValues={numberProperty.enumValues}
277
- error={error}
278
+ error={validationError ?? error}
278
279
  internalValue={internalValue as string | number}
279
280
  updateValue={updateValue}
280
281
  />;
@@ -282,7 +283,7 @@ export const PropertyTableCell = React.memo<PropertyTableCellProps<any>>(
282
283
  } else {
283
284
  innerComponent = <VirtualTableNumberInput
284
285
  align={align}
285
- error={error}
286
+ error={validationError ?? error}
286
287
  focused={selected}
287
288
  disabled={disabled}
288
289
  value={internalValue as number}
@@ -300,14 +301,14 @@ export const PropertyTableCell = React.memo<PropertyTableCellProps<any>>(
300
301
  valueType={"string"}
301
302
  small={getPreviewSizeFrom(size) !== "medium"}
302
303
  enumValues={stringProperty.enumValues}
303
- error={error}
304
+ error={validationError ?? error}
304
305
  internalValue={internalValue as string | number}
305
306
  updateValue={updateValue}
306
307
  />;
307
308
  fullHeight = true;
308
309
  } else if (!stringProperty.storage) {
309
310
  const multiline = Boolean(stringProperty.multiline) || Boolean(stringProperty.markdown);
310
- innerComponent = <VirtualTableInput error={error}
311
+ innerComponent = <VirtualTableInput error={validationError ?? error}
311
312
  disabled={disabled}
312
313
  multiline={multiline}
313
314
  focused={selected}
@@ -317,7 +318,7 @@ export const PropertyTableCell = React.memo<PropertyTableCellProps<any>>(
317
318
  allowScroll = true;
318
319
  }
319
320
  } else if (property.dataType === "boolean") {
320
- innerComponent = <VirtualTableSwitch error={error}
321
+ innerComponent = <VirtualTableSwitch error={validationError ?? error}
321
322
  disabled={disabled}
322
323
  focused={selected}
323
324
  internalValue={internalValue as boolean}
@@ -325,7 +326,7 @@ export const PropertyTableCell = React.memo<PropertyTableCellProps<any>>(
325
326
  />;
326
327
  } else if (property.dataType === "date") {
327
328
  innerComponent = <VirtualTableDateField name={propertyKey as string}
328
- error={error}
329
+ error={validationError ?? error}
329
330
  disabled={disabled}
330
331
  mode={property.mode}
331
332
  focused={selected}
@@ -346,6 +347,8 @@ export const PropertyTableCell = React.memo<PropertyTableCellProps<any>>(
346
347
  path={property.path}
347
348
  multiselect={false}
348
349
  previewProperties={property.previewProperties}
350
+ includeId={property.includeId}
351
+ includeEntityLink={property.includeEntityLink}
349
352
  title={property.name}
350
353
  forceFilter={property.forceFilter}
351
354
  />;
@@ -368,7 +371,7 @@ export const PropertyTableCell = React.memo<PropertyTableCellProps<any>>(
368
371
  small={getPreviewSizeFrom(size) !== "medium"}
369
372
  valueType={arrayProperty.of.dataType}
370
373
  enumValues={arrayProperty.of.enumValues}
371
- error={error}
374
+ error={validationError ?? error}
372
375
  internalValue={internalValue as string | number}
373
376
  updateValue={updateValue}
374
377
  />;
@@ -390,6 +393,8 @@ export const PropertyTableCell = React.memo<PropertyTableCellProps<any>>(
390
393
  previewProperties={arrayProperty.of.previewProperties}
391
394
  title={arrayProperty.name}
392
395
  forceFilter={arrayProperty.of.forceFilter}
396
+ includeId={arrayProperty.of.includeId}
397
+ includeEntityLink={arrayProperty.of.includeEntityLink}
393
398
  />;
394
399
  }
395
400
  allowScroll = false;
@@ -401,11 +406,10 @@ export const PropertyTableCell = React.memo<PropertyTableCellProps<any>>(
401
406
 
402
407
  if (!innerComponent) {
403
408
  allowScroll = false;
404
- showExpandIcon = selected && !innerComponent && !disabled && !readOnlyProperty;
409
+ showExpandIcon = enablePopupIcon && selected && !innerComponent && !disabled && !readOnlyProperty;
405
410
  innerComponent = (
406
- <PropertyPreview width={width}
411
+ <PropertyPreview width={width}
407
412
  height={height}
408
- // entity={entity}
409
413
  propertyKey={propertyKey as string}
410
414
  value={internalValue}
411
415
  property={property}
@@ -426,7 +430,7 @@ export const PropertyTableCell = React.memo<PropertyTableCellProps<any>>(
426
430
  removePadding={removePadding}
427
431
  fullHeight={fullHeight}
428
432
  saved={saved}
429
- error={error}
433
+ error={validationError ?? error}
430
434
  align={align}
431
435
  allowScroll={allowScroll}
432
436
  showExpandIcon={showExpandIcon}
@@ -21,7 +21,6 @@ export interface PropertiesToColumnsParams<M extends Record<string, any>> {
21
21
  properties: ResolvedProperties<M>;
22
22
  sortable?: boolean;
23
23
  forceFilter?: FilterValues<keyof M extends string ? keyof M : never>;
24
- disabledFilter?: boolean;
25
24
  AdditionalHeaderWidget?: React.ComponentType<{
26
25
  property: ResolvedProperty,
27
26
  propertyKey: string,
@@ -29,7 +28,8 @@ export interface PropertiesToColumnsParams<M extends Record<string, any>> {
29
28
  }>;
30
29
  }
31
30
 
32
- export function propertiesToColumns<M extends Record<string, any>>({ properties, sortable, forceFilter, disabledFilter, AdditionalHeaderWidget }: PropertiesToColumnsParams<M>): VirtualTableColumn[] {
31
+ export function propertiesToColumns<M extends Record<string, any>>({ properties, sortable, forceFilter, AdditionalHeaderWidget }: PropertiesToColumnsParams<M>): VirtualTableColumn[] {
32
+ const disabledFilter = Boolean(forceFilter);
33
33
  return Object.entries<ResolvedProperty>(properties)
34
34
  .flatMap(([key, property]) => getColumnKeysForProperty(property, key))
35
35
  .map(({
@@ -45,7 +45,7 @@ export function propertiesToColumns<M extends Record<string, any>>({ properties,
45
45
  align: getTableCellAlignment(property),
46
46
  icon: getIconForProperty(property, "small"),
47
47
  title: property.name ?? key as string,
48
- sortable: sortable && (forceFilter ? Object.keys(forceFilter).includes(key) : true),
48
+ sortable: sortable,
49
49
  filter: !disabledFilter && filterable,
50
50
  width: getTablePropertyColumnWidth(property),
51
51
  resizable: true,
@@ -22,6 +22,8 @@ type TableReferenceFieldProps = {
22
22
  title?: string;
23
23
  path: string;
24
24
  forceFilter?: FilterValues<string>;
25
+ includeId?: boolean;
26
+ includeEntityLink?: boolean;
25
27
  };
26
28
 
27
29
  export function TableReferenceField(props: TableReferenceFieldProps) {
@@ -29,7 +31,7 @@ export function TableReferenceField(props: TableReferenceFieldProps) {
29
31
 
30
32
  const navigationController = useNavigationController();
31
33
  const { path } = props;
32
- const collection = navigationController.getCollection<EntityCollection>(path);
34
+ const collection = navigationController.getCollection(path);
33
35
  if (!collection) {
34
36
  if (customizationController.components?.missingReference) {
35
37
  return <customizationController.components.missingReference path={path}/>;
@@ -55,7 +57,9 @@ export const TableReferenceFieldSuccess = React.memo(
55
57
  title,
56
58
  disabled,
57
59
  forceFilter,
58
- collection
60
+ collection,
61
+ includeId,
62
+ includeEntityLink
59
63
  } = props;
60
64
 
61
65
  const onSingleEntitySelected = useCallback((entity: Entity<any>) => {
@@ -63,6 +67,7 @@ export const TableReferenceFieldSuccess = React.memo(
63
67
  }, [updateValue]);
64
68
 
65
69
  const onMultipleEntitiesSelected = useCallback((entities: Entity<any>[]) => {
70
+ console.log("onMultipleEntitiesSelected", entities);
66
71
  updateValue(entities.map((e) => getReferenceFrom(e)));
67
72
  }, [updateValue]);
68
73
 
@@ -100,6 +105,8 @@ export const TableReferenceFieldSuccess = React.memo(
100
105
  hover={!disabled}
101
106
  disabled={!path}
102
107
  previewProperties={previewProperties}
108
+ includeId={includeId}
109
+ includeEntityLink={includeEntityLink}
103
110
  />;
104
111
  else
105
112
  return <EntityPreviewContainer
@@ -122,6 +129,8 @@ export const TableReferenceFieldSuccess = React.memo(
122
129
  hover={!disabled}
123
130
  disabled={!path}
124
131
  previewProperties={previewProperties}
132
+ includeId={includeId}
133
+ includeEntityLink={includeEntityLink}
125
134
  />
126
135
  </div>
127
136
  )
@@ -9,7 +9,7 @@ import { useSnackbarController, useStorageSource } from "../../../hooks";
9
9
  import { getThumbnailMeasure } from "../../../preview/util";
10
10
  import { StorageFieldItem, useStorageUploadController } from "../../../util/useStorageUploadController";
11
11
  import { StorageUploadProgress } from "../../../form/components/StorageUploadProgress";
12
- import { cn, EditIcon, IconButton, Typography } from "@firecms/ui";
12
+ import { cls, EditIcon, IconButton, Typography } from "@firecms/ui";
13
13
  import { EntityTableCellActions } from "../internal/EntityTableCellActions";
14
14
 
15
15
  const dropZoneClasses = "max-w-full box-border relative pt-[2px] items-center border border-transparent outline-none rounded-md duration-200 ease-[cubic-bezier(0.4,0,0.2,1)] focus:border-primary-solid";
@@ -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.log("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
  }
@@ -207,7 +215,7 @@ function StorageUpload({
207
215
  onMouseEnter={() => setOnHover(true)}
208
216
  onMouseMove={() => setOnHover(true)}
209
217
  onMouseLeave={() => setOnHover(false)}
210
- className={cn(dropZoneClasses,
218
+ className={cls(dropZoneClasses,
211
219
  "relative w-full h-full flex",
212
220
  `justify-${hasValue ? "start" : "center"}`,
213
221
  isDragActive ? activeDropClasses : "",