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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (271) hide show
  1. package/README.md +2 -2
  2. package/dist/app/AppBar.d.ts +12 -0
  3. package/dist/app/Drawer.d.ts +17 -0
  4. package/dist/app/Scaffold.d.ts +30 -0
  5. package/dist/app/index.d.ts +4 -0
  6. package/dist/app/useApp.d.ts +16 -0
  7. package/dist/components/ClearFilterSortButton.d.ts +5 -0
  8. package/dist/components/EntityCollectionTable/EntityCollectionRowActions.d.ts +11 -11
  9. package/dist/components/EntityCollectionTable/EntityCollectionTable.d.ts +2 -2
  10. package/dist/components/EntityCollectionTable/EntityCollectionTableProps.d.ts +5 -3
  11. package/dist/components/EntityCollectionTable/PropertyTableCell.d.ts +3 -2
  12. package/dist/components/EntityCollectionTable/column_utils.d.ts +1 -2
  13. package/dist/components/EntityCollectionTable/fields/TableReferenceField.d.ts +2 -0
  14. package/dist/components/EntityCollectionTable/internal/CollectionTableToolbar.d.ts +1 -4
  15. package/dist/components/EntityCollectionTable/internal/EntityTableCell.d.ts +2 -2
  16. package/dist/components/EntityCollectionTable/internal/popup_field/PopupFormField.d.ts +1 -1
  17. package/dist/components/EntityCollectionView/EntityCollectionView.d.ts +12 -3
  18. package/dist/components/EntityCollectionView/EntityCollectionViewStartActions.d.ts +11 -0
  19. package/dist/components/EntityCollectionView/useSelectionController.d.ts +2 -0
  20. package/dist/components/EntityPreview.d.ts +26 -7
  21. package/dist/components/EntityView.d.ts +11 -0
  22. package/dist/components/FieldCaption.d.ts +5 -0
  23. package/dist/components/HomePage/NavigationCard.d.ts +8 -0
  24. package/dist/components/HomePage/{NavigationCollectionCard.d.ts → NavigationCardBinding.d.ts} +2 -2
  25. package/dist/components/HomePage/SmallNavigationCard.d.ts +6 -0
  26. package/dist/components/HomePage/index.d.ts +3 -1
  27. package/dist/components/ReferenceWidget.d.ts +3 -1
  28. package/dist/components/SelectableTable/SelectableTable.d.ts +1 -1
  29. package/dist/components/SelectableTable/filters/ReferenceFilterField.d.ts +2 -1
  30. package/dist/components/VirtualTable/VirtualTableProps.d.ts +6 -7
  31. package/dist/components/VirtualTable/types.d.ts +3 -3
  32. package/dist/components/{EntityCollectionTable/internal → common}/default_entity_actions.d.ts +1 -1
  33. package/dist/components/common/index.d.ts +1 -0
  34. package/dist/components/common/table_height.d.ts +5 -0
  35. package/dist/components/common/types.d.ts +4 -6
  36. package/dist/components/common/useDataSourceEntityCollectionTableController.d.ts +3 -0
  37. package/dist/components/index.d.ts +6 -3
  38. package/dist/contexts/AuthControllerContext.d.ts +1 -1
  39. package/dist/{components/FireCMSAppBar.d.ts → core/DefaultAppBar.d.ts} +5 -8
  40. package/dist/core/DefaultDrawer.d.ts +19 -0
  41. package/dist/core/DrawerNavigationItem.d.ts +9 -0
  42. package/dist/core/EntityEditView.d.ts +36 -0
  43. package/dist/core/NavigationRoutes.d.ts +2 -2
  44. package/dist/core/index.d.ts +3 -4
  45. package/dist/form/PropertiesForm.d.ts +8 -0
  46. package/dist/form/components/ErrorFocus.d.ts +1 -1
  47. package/dist/form/components/FieldHelperText.d.ts +3 -3
  48. package/dist/form/components/StorageItemPreview.d.ts +2 -3
  49. package/dist/form/components/StorageUploadProgress.d.ts +1 -1
  50. package/dist/form/field_bindings/KeyValueFieldBinding.d.ts +1 -1
  51. package/dist/form/field_bindings/MapFieldBinding.d.ts +1 -1
  52. package/dist/form/field_bindings/StorageUploadFieldBinding.d.ts +3 -4
  53. package/dist/form/field_bindings/TextFieldBinding.d.ts +2 -2
  54. package/dist/form/index.d.ts +0 -2
  55. package/dist/form/validation.d.ts +1 -1
  56. package/dist/hooks/data/delete.d.ts +2 -2
  57. package/dist/hooks/data/save.d.ts +2 -3
  58. package/dist/hooks/data/useDataSource.d.ts +2 -2
  59. package/dist/hooks/data/useEntityFetch.d.ts +3 -3
  60. package/dist/hooks/index.d.ts +2 -0
  61. package/dist/hooks/useBuildNavigationController.d.ts +6 -4
  62. package/dist/hooks/useProjectLog.d.ts +6 -2
  63. package/dist/hooks/useStorageSource.d.ts +2 -2
  64. package/dist/hooks/useValidateAuthenticator.d.ts +21 -0
  65. package/dist/index.d.ts +1 -0
  66. package/dist/index.es.js +10507 -9993
  67. package/dist/index.es.js.map +1 -1
  68. package/dist/index.umd.js +5 -5
  69. package/dist/index.umd.js.map +1 -1
  70. package/dist/internal/useBuildDataSource.d.ts +1 -16
  71. package/dist/preview/PropertyPreview.d.ts +1 -1
  72. package/dist/preview/PropertyPreviewProps.d.ts +1 -4
  73. package/dist/preview/components/BooleanPreview.d.ts +5 -1
  74. package/dist/preview/components/EnumValuesChip.d.ts +1 -1
  75. package/dist/preview/components/ReferencePreview.d.ts +3 -8
  76. package/dist/types/analytics.d.ts +1 -1
  77. package/dist/types/auth.d.ts +37 -1
  78. package/dist/types/collections.d.ts +44 -6
  79. package/dist/types/datasource.d.ts +21 -14
  80. package/dist/types/entities.d.ts +5 -1
  81. package/dist/types/entity_actions.d.ts +14 -0
  82. package/dist/types/entity_callbacks.d.ts +2 -2
  83. package/dist/types/entity_overrides.d.ts +6 -0
  84. package/dist/types/fields.d.ts +31 -30
  85. package/dist/types/index.d.ts +2 -1
  86. package/dist/types/navigation.d.ts +15 -14
  87. package/dist/types/permissions.d.ts +5 -1
  88. package/dist/types/plugins.d.ts +22 -22
  89. package/dist/types/properties.d.ts +13 -5
  90. package/dist/types/property_config.d.ts +2 -2
  91. package/dist/types/roles.d.ts +31 -0
  92. package/dist/types/storage.d.ts +11 -3
  93. package/dist/types/user.d.ts +5 -0
  94. package/dist/util/collections.d.ts +9 -1
  95. package/dist/util/entities.d.ts +1 -1
  96. package/dist/util/icon_synonyms.d.ts +1 -97
  97. package/dist/util/icons.d.ts +8 -2
  98. package/dist/util/navigation_utils.d.ts +2 -2
  99. package/dist/util/objects.d.ts +1 -1
  100. package/dist/util/permissions.d.ts +4 -4
  101. package/dist/util/references.d.ts +4 -2
  102. package/dist/util/resolutions.d.ts +14 -14
  103. package/dist/util/storage.d.ts +23 -2
  104. package/dist/util/useStorageUploadController.d.ts +1 -1
  105. package/dist/util/useTraceUpdate.d.ts +1 -0
  106. package/package.json +139 -119
  107. package/src/app/AppBar.tsx +18 -0
  108. package/src/app/Drawer.tsx +25 -0
  109. package/src/app/Scaffold.tsx +249 -0
  110. package/src/app/index.ts +4 -0
  111. package/src/app/useApp.tsx +32 -0
  112. package/src/components/ClearFilterSortButton.tsx +41 -0
  113. package/src/components/DeleteEntityDialog.tsx +4 -4
  114. package/src/components/EntityCollectionTable/EntityCollectionRowActions.tsx +4 -4
  115. package/src/components/EntityCollectionTable/EntityCollectionTable.tsx +276 -279
  116. package/src/components/EntityCollectionTable/EntityCollectionTableProps.tsx +9 -5
  117. package/src/components/EntityCollectionTable/PropertyTableCell.tsx +48 -45
  118. package/src/components/EntityCollectionTable/column_utils.tsx +3 -3
  119. package/src/components/EntityCollectionTable/fields/TableReferenceField.tsx +18 -17
  120. package/src/components/EntityCollectionTable/fields/TableStorageUpload.tsx +5 -5
  121. package/src/components/EntityCollectionTable/internal/CollectionTableToolbar.tsx +29 -34
  122. package/src/components/EntityCollectionTable/internal/EntityTableCell.tsx +16 -12
  123. package/src/components/EntityCollectionTable/internal/popup_field/PopupFormField.tsx +4 -5
  124. package/src/components/EntityCollectionView/EntityCollectionView.tsx +75 -74
  125. package/src/components/EntityCollectionView/EntityCollectionViewActions.tsx +5 -6
  126. package/src/components/EntityCollectionView/EntityCollectionViewStartActions.tsx +68 -0
  127. package/src/components/EntityCollectionView/useSelectionController.tsx +30 -0
  128. package/src/components/EntityPreview.tsx +209 -70
  129. package/src/components/EntityView.tsx +84 -0
  130. package/src/components/FieldCaption.tsx +14 -0
  131. package/src/components/HomePage/DefaultHomePage.tsx +15 -11
  132. package/src/components/HomePage/NavigationCard.tsx +69 -0
  133. package/src/components/HomePage/NavigationCardBinding.tsx +116 -0
  134. package/src/components/HomePage/SmallNavigationCard.tsx +45 -0
  135. package/src/components/HomePage/index.tsx +3 -1
  136. package/src/components/PropertyIdCopyTooltipContent.tsx +2 -3
  137. package/src/components/ReferenceTable/ReferenceSelectionTable.tsx +4 -4
  138. package/src/components/ReferenceWidget.tsx +22 -12
  139. package/src/components/SearchIconsView.tsx +5 -5
  140. package/src/components/SelectableTable/SelectableTable.tsx +5 -3
  141. package/src/components/SelectableTable/filters/BooleanFilterField.tsx +2 -3
  142. package/src/components/SelectableTable/filters/DateTimeFilterField.tsx +23 -8
  143. package/src/components/SelectableTable/filters/ReferenceFilterField.tsx +38 -24
  144. package/src/components/SelectableTable/filters/StringNumberFilterField.tsx +35 -15
  145. package/src/components/VirtualTable/VirtualTable.tsx +38 -29
  146. package/src/components/VirtualTable/VirtualTableHeader.tsx +4 -4
  147. package/src/components/VirtualTable/VirtualTableHeaderRow.tsx +2 -2
  148. package/src/components/VirtualTable/VirtualTableProps.tsx +7 -7
  149. package/src/components/VirtualTable/VirtualTableRow.tsx +4 -5
  150. package/src/components/VirtualTable/fields/VirtualTableDateField.tsx +1 -1
  151. package/src/components/VirtualTable/types.tsx +2 -3
  152. package/src/components/{EntityCollectionTable/internal → common}/default_entity_actions.tsx +11 -7
  153. package/src/components/common/index.ts +1 -0
  154. package/src/components/{VirtualTable/common.tsx → common/table_height.tsx} +5 -2
  155. package/src/components/common/types.tsx +4 -6
  156. package/src/components/common/useColumnsIds.tsx +10 -2
  157. package/src/components/common/useDataSourceEntityCollectionTableController.tsx +12 -1
  158. package/src/components/common/useTableSearchHelper.ts +39 -9
  159. package/src/components/index.tsx +6 -3
  160. package/src/contexts/AuthControllerContext.tsx +1 -1
  161. package/src/{components/FireCMSAppBar.tsx → core/DefaultAppBar.tsx} +51 -34
  162. package/src/core/DefaultDrawer.tsx +177 -0
  163. package/src/core/DrawerNavigationItem.tsx +62 -0
  164. package/src/core/EntityEditView.tsx +1100 -0
  165. package/src/core/EntitySidePanel.tsx +3 -4
  166. package/src/core/FireCMS.tsx +54 -43
  167. package/src/core/NavigationRoutes.tsx +14 -7
  168. package/src/core/field_configs.tsx +2 -3
  169. package/src/core/index.tsx +3 -4
  170. package/src/form/PropertiesForm.tsx +81 -0
  171. package/src/form/PropertyFieldBinding.tsx +29 -7
  172. package/src/form/components/FieldHelperText.tsx +3 -3
  173. package/src/form/components/StorageItemPreview.tsx +5 -7
  174. package/src/form/components/StorageUploadProgress.tsx +9 -8
  175. package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +10 -12
  176. package/src/form/field_bindings/BlockFieldBinding.tsx +2 -2
  177. package/src/form/field_bindings/DateTimeFieldBinding.tsx +1 -1
  178. package/src/form/field_bindings/KeyValueFieldBinding.tsx +19 -19
  179. package/src/form/field_bindings/MapFieldBinding.tsx +25 -17
  180. package/src/form/field_bindings/MarkdownFieldBinding.tsx +2 -2
  181. package/src/form/field_bindings/ReadOnlyFieldBinding.tsx +2 -9
  182. package/src/form/field_bindings/ReferenceFieldBinding.tsx +16 -13
  183. package/src/form/field_bindings/SelectFieldBinding.tsx +3 -3
  184. package/src/form/field_bindings/StorageUploadFieldBinding.tsx +14 -35
  185. package/src/form/field_bindings/TextFieldBinding.tsx +7 -5
  186. package/src/form/index.tsx +4 -4
  187. package/src/form/validation.ts +4 -21
  188. package/src/hooks/data/delete.ts +3 -3
  189. package/src/hooks/data/save.ts +4 -2
  190. package/src/hooks/data/useCollectionFetch.tsx +1 -1
  191. package/src/hooks/data/useDataSource.tsx +8 -3
  192. package/src/hooks/data/useEntityFetch.tsx +4 -4
  193. package/src/hooks/index.tsx +3 -0
  194. package/src/hooks/useBuildLocalConfigurationPersistence.tsx +8 -10
  195. package/src/hooks/useBuildModeController.tsx +11 -5
  196. package/src/hooks/useBuildNavigationController.tsx +200 -83
  197. package/src/hooks/useProjectLog.tsx +17 -7
  198. package/src/hooks/useReferenceDialog.tsx +2 -2
  199. package/src/hooks/useResolvedNavigationFrom.tsx +1 -1
  200. package/src/hooks/useStorageSource.tsx +7 -2
  201. package/src/hooks/useValidateAuthenticator.tsx +115 -0
  202. package/src/index.ts +1 -0
  203. package/src/internal/useBuildDataSource.ts +54 -47
  204. package/src/internal/useBuildSideEntityController.tsx +88 -21
  205. package/src/preview/PropertyPreview.tsx +5 -15
  206. package/src/preview/PropertyPreviewProps.tsx +1 -11
  207. package/src/preview/components/BooleanPreview.tsx +19 -4
  208. package/src/preview/components/EnumValuesChip.tsx +2 -2
  209. package/src/preview/components/ReferencePreview.tsx +72 -165
  210. package/src/preview/property_previews/ArrayOfMapsPreview.tsx +0 -1
  211. package/src/preview/property_previews/ArrayOfReferencesPreview.tsx +2 -1
  212. package/src/preview/property_previews/ArrayOfStorageComponentsPreview.tsx +0 -1
  213. package/src/preview/property_previews/ArrayOfStringsPreview.tsx +0 -1
  214. package/src/preview/property_previews/ArrayOneOfPreview.tsx +2 -3
  215. package/src/preview/property_previews/ArrayPropertyPreview.tsx +2 -3
  216. package/src/preview/property_previews/MapPropertyPreview.tsx +5 -5
  217. package/src/preview/property_previews/StringPropertyPreview.tsx +8 -7
  218. package/src/types/analytics.ts +1 -0
  219. package/src/types/auth.tsx +50 -1
  220. package/src/types/collections.ts +51 -6
  221. package/src/types/customization_controller.tsx +0 -1
  222. package/src/types/datasource.ts +24 -17
  223. package/src/types/entities.ts +9 -1
  224. package/src/types/entity_actions.tsx +17 -0
  225. package/src/types/entity_callbacks.ts +2 -2
  226. package/src/types/entity_overrides.tsx +7 -0
  227. package/src/types/fields.tsx +33 -33
  228. package/src/types/firecms.tsx +0 -1
  229. package/src/types/index.ts +2 -1
  230. package/src/types/navigation.ts +17 -17
  231. package/src/types/permissions.ts +6 -1
  232. package/src/types/plugins.tsx +28 -30
  233. package/src/types/properties.ts +19 -7
  234. package/src/types/property_config.tsx +2 -2
  235. package/src/types/roles.ts +41 -0
  236. package/src/types/side_entity_controller.tsx +1 -0
  237. package/src/types/storage.ts +12 -3
  238. package/src/types/user.ts +7 -0
  239. package/src/util/collections.ts +22 -0
  240. package/src/util/entities.ts +2 -1
  241. package/src/util/enums.ts +1 -1
  242. package/src/util/icon_list.ts +2 -2
  243. package/src/util/icon_synonyms.ts +3 -99
  244. package/src/util/icons.tsx +11 -3
  245. package/src/util/navigation_utils.ts +6 -6
  246. package/src/util/objects.ts +8 -21
  247. package/src/util/permissions.ts +12 -8
  248. package/src/util/references.ts +36 -5
  249. package/src/util/resolutions.ts +32 -31
  250. package/src/util/storage.ts +75 -21
  251. package/src/util/strings.ts +2 -2
  252. package/src/util/useStorageUploadController.tsx +21 -3
  253. package/src/util/useTraceUpdate.tsx +2 -1
  254. package/dist/components/VirtualTable/common.d.ts +0 -2
  255. package/dist/core/Drawer.d.ts +0 -23
  256. package/dist/core/EntityView.d.ts +0 -22
  257. package/dist/core/Scaffold.d.ts +0 -55
  258. package/dist/core/SideEntityView.d.ts +0 -7
  259. package/dist/form/EntityForm.d.ts +0 -77
  260. package/dist/internal/useBuildCustomizationController.d.ts +0 -2
  261. package/dist/internal/useLocaleConfig.d.ts +0 -1
  262. package/dist/types/appcheck.d.ts +0 -26
  263. package/src/components/HomePage/NavigationCollectionCard.tsx +0 -146
  264. package/src/core/Drawer.tsx +0 -164
  265. package/src/core/EntityView.tsx +0 -578
  266. package/src/core/Scaffold.tsx +0 -281
  267. package/src/core/SideEntityView.tsx +0 -38
  268. package/src/form/EntityForm.tsx +0 -720
  269. package/src/internal/useBuildCustomizationController.tsx +0 -5
  270. package/src/internal/useLocaleConfig.tsx +0 -18
  271. package/src/types/appcheck.ts +0 -29
@@ -24,16 +24,15 @@ 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
- export interface PropertyTableCellProps<T extends CMSType, M extends Record<string, any>> {
35
+ export interface PropertyTableCellProps<T extends CMSType> {
37
36
  propertyKey: string;
38
37
  columnIndex: number;
39
38
  align: "right" | "left" | "center";
@@ -46,6 +45,7 @@ export interface PropertyTableCellProps<T extends CMSType, M extends Record<stri
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) {
@@ -62,7 +62,7 @@ function isStorageProperty(property: ResolvedProperty) {
62
62
  return false;
63
63
  }
64
64
 
65
- export const PropertyTableCell = React.memo<PropertyTableCellProps<any, any>>(
65
+ export const PropertyTableCell = React.memo<PropertyTableCellProps<any>>(
66
66
  function PropertyTableCell<T extends CMSType, M extends Record<string, any>>({
67
67
  propertyKey,
68
68
  customFieldValidator,
@@ -74,10 +74,9 @@ export const PropertyTableCell = React.memo<PropertyTableCellProps<any, any>>(
74
74
  path,
75
75
  entity,
76
76
  readonly,
77
- disabled: disabledProp
78
- }: PropertyTableCellProps<T, M>) {
79
-
80
- const context = useFireCMSContext();
77
+ disabled: disabledProp,
78
+ enablePopupIcon = true
79
+ }: PropertyTableCellProps<T>) {
81
80
 
82
81
  const {
83
82
  onValueChange,
@@ -95,6 +94,7 @@ export const PropertyTableCell = React.memo<PropertyTableCellProps<any, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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,16 +406,14 @@ export const PropertyTableCell = React.memo<PropertyTableCellProps<any, 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
407
- width={width}
408
- height={height}
409
- // entity={entity}
410
- propertyKey={propertyKey as string}
411
- value={internalValue}
412
- property={property}
413
- size={getPreviewSizeFrom(size)}
411
+ <PropertyPreview width={width}
412
+ height={height}
413
+ propertyKey={propertyKey as string}
414
+ value={internalValue}
415
+ property={property}
416
+ size={getPreviewSizeFrom(size)}
414
417
  />
415
418
  );
416
419
  }
@@ -427,7 +430,7 @@ export const PropertyTableCell = React.memo<PropertyTableCellProps<any, any>>(
427
430
  removePadding={removePadding}
428
431
  fullHeight={fullHeight}
429
432
  saved={saved}
430
- error={error}
433
+ error={validationError ?? error}
431
434
  align={align}
432
435
  allowScroll={allowScroll}
433
436
  showExpandIcon={showExpandIcon}
@@ -447,9 +450,9 @@ export const PropertyTableCell = React.memo<PropertyTableCellProps<any, any>>(
447
450
  );
448
451
 
449
452
  },
450
- areEqual) as React.FunctionComponent<PropertyTableCellProps<any, any>>;
453
+ areEqual) as React.FunctionComponent<PropertyTableCellProps<any>>;
451
454
 
452
- function areEqual(prevProps: PropertyTableCellProps<any, any>, nextProps: PropertyTableCellProps<any, any>) {
455
+ function areEqual(prevProps: PropertyTableCellProps<any>, nextProps: PropertyTableCellProps<any>) {
453
456
  return prevProps.height === nextProps.height &&
454
457
  prevProps.propertyKey === nextProps.propertyKey &&
455
458
  prevProps.align === nextProps.align &&
@@ -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,
@@ -1,7 +1,7 @@
1
1
  import React, { useCallback, useState } from "react";
2
2
  import equal from "react-fast-compare"
3
3
 
4
- import { ReferencePreview, ReferencePreviewContainer } from "../../../preview";
4
+ import { ReferencePreview } from "../../../preview";
5
5
  import { CollectionSize, Entity, EntityCollection, EntityReference, FilterValues } from "../../../types";
6
6
 
7
7
  import { getPreviewSizeFrom } from "../../../preview/util";
@@ -9,6 +9,7 @@ import { getReferenceFrom } from "../../../util";
9
9
  import { useCustomizationController, useNavigationController, useReferenceDialog } from "../../../hooks";
10
10
  import { ErrorView } from "../../ErrorView";
11
11
  import { Button } from "@firecms/ui";
12
+ import { EntityPreviewContainer } from "../../EntityPreview";
12
13
 
13
14
  type TableReferenceFieldProps = {
14
15
  name: string;
@@ -21,6 +22,8 @@ type TableReferenceFieldProps = {
21
22
  title?: string;
22
23
  path: string;
23
24
  forceFilter?: FilterValues<string>;
25
+ includeId?: boolean;
26
+ includeEntityLink?: boolean;
24
27
  };
25
28
 
26
29
  export function TableReferenceField(props: TableReferenceFieldProps) {
@@ -28,7 +31,7 @@ export function TableReferenceField(props: TableReferenceFieldProps) {
28
31
 
29
32
  const navigationController = useNavigationController();
30
33
  const { path } = props;
31
- const collection = navigationController.getCollection<EntityCollection>(path);
34
+ const collection = navigationController.getCollection(path);
32
35
  if (!collection) {
33
36
  if (customizationController.components?.missingReference) {
34
37
  return <customizationController.components.missingReference path={path}/>;
@@ -54,14 +57,11 @@ export const TableReferenceFieldSuccess = React.memo(
54
57
  title,
55
58
  disabled,
56
59
  forceFilter,
57
- collection
60
+ collection,
61
+ includeId,
62
+ includeEntityLink
58
63
  } = props;
59
64
 
60
- const [onHover, setOnHover] = useState(false);
61
-
62
- const hoverTrue = useCallback(() => setOnHover(true), []);
63
- const hoverFalse = useCallback(() => setOnHover(false), []);
64
-
65
65
  const onSingleEntitySelected = useCallback((entity: Entity<any>) => {
66
66
  updateValue(entity ? getReferenceFrom(entity) : null);
67
67
  }, [updateValue]);
@@ -101,31 +101,35 @@ export const TableReferenceFieldSuccess = React.memo(
101
101
  onClick={disabled ? undefined : handleOpen}
102
102
  size={getPreviewSizeFrom(size)}
103
103
  reference={internalValue as EntityReference}
104
- onHover={onHover}
104
+ hover={!disabled}
105
105
  disabled={!path}
106
106
  previewProperties={previewProperties}
107
+ includeId={includeId}
108
+ includeEntityLink={includeEntityLink}
107
109
  />;
108
110
  else
109
- return <ReferencePreviewContainer
111
+ return <EntityPreviewContainer
110
112
  onClick={disabled ? undefined : handleOpen}
111
113
  size={getPreviewSizeFrom(size)}>
112
114
  <ErrorView title="Value is not a reference." error={"Click to edit"}/>
113
- </ReferencePreviewContainer>;
115
+ </EntityPreviewContainer>;
114
116
  };
115
117
 
116
118
  const buildMultipleReferenceField = () => {
117
119
  if (Array.isArray(internalValue))
118
120
  return <>
119
121
  {internalValue.map((reference, index) =>
120
- <div className="m-1 w-full"
122
+ <div className="w-full my-0.5"
121
123
  key={`preview_array_ref_${name}_${index}`}>
122
124
  <ReferencePreview
123
125
  onClick={disabled ? undefined : handleOpen}
124
126
  size={"tiny"}
125
127
  reference={reference}
126
- onHover={onHover}
128
+ hover={!disabled}
127
129
  disabled={!path}
128
130
  previewProperties={previewProperties}
131
+ includeId={includeId}
132
+ includeEntityLink={includeEntityLink}
129
133
  />
130
134
  </div>
131
135
  )
@@ -139,10 +143,7 @@ export const TableReferenceFieldSuccess = React.memo(
139
143
  return <ErrorView error={"The specified collection does not exist"}/>;
140
144
 
141
145
  return (
142
- <div className="w-full"
143
- onMouseEnter={hoverTrue}
144
- onMouseMove={hoverTrue}
145
- onMouseLeave={hoverFalse}>
146
+ <div className="w-full group">
146
147
 
147
148
  {internalValue && !multiselect && buildSingleReferenceField()}
148
149
 
@@ -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";
@@ -51,7 +51,7 @@ export function TableStorageUpload(props: {
51
51
  entity,
52
52
  path,
53
53
  previewSize,
54
- updateValue
54
+ updateValue,
55
55
  } = props;
56
56
 
57
57
  const storageSource = useStorageSource();
@@ -137,7 +137,7 @@ function StorageUpload({
137
137
  storage,
138
138
  onFilesAdded,
139
139
  onFileUploadComplete,
140
- storagePathBuilder
140
+ storagePathBuilder,
141
141
  }: StorageUploadProps) {
142
142
 
143
143
  const [onHover, setOnHover] = useState(false);
@@ -207,7 +207,7 @@ function StorageUpload({
207
207
  onMouseEnter={() => setOnHover(true)}
208
208
  onMouseMove={() => setOnHover(true)}
209
209
  onMouseLeave={() => setOnHover(false)}
210
- className={cn(dropZoneClasses,
210
+ className={cls(dropZoneClasses,
211
211
  "relative w-full h-full flex",
212
212
  `justify-${hasValue ? "start" : "center"}`,
213
213
  isDragActive ? activeDropClasses : "",
@@ -293,7 +293,7 @@ export function TableStorageItemPreview({
293
293
 
294
294
  return (
295
295
  <div
296
- className={"relative m-2"}
296
+ className={"relative p-2 max-w-full"}
297
297
  >
298
298
 
299
299
  {value &&
@@ -3,7 +3,7 @@ import React, { useEffect } from "react";
3
3
  import {
4
4
  Button,
5
5
  CircularProgress,
6
- cn,
6
+ cls,
7
7
  defaultBorderMixin,
8
8
  FilterListOffIcon,
9
9
  SearchBar,
@@ -16,20 +16,27 @@ import { useLargeLayout } from "../../../hooks";
16
16
 
17
17
  interface CollectionTableToolbarProps {
18
18
  size: CollectionSize;
19
- filterIsSet: boolean;
20
19
  loading: boolean;
21
- forceFilter?: boolean;
22
20
  actionsStart?: React.ReactNode;
23
21
  actions?: React.ReactNode;
24
22
  title?: React.ReactNode,
25
23
  onTextSearchClick?: () => void;
26
24
  onTextSearch?: (searchString?: string) => void;
27
25
  onSizeChanged: (size: CollectionSize) => void;
28
- clearFilter?: () => void;
29
26
  textSearchLoading?: boolean;
30
27
  }
31
28
 
32
- export function CollectionTableToolbar(props: CollectionTableToolbarProps) {
29
+ export function CollectionTableToolbar({
30
+ actions,
31
+ actionsStart,
32
+ loading,
33
+ onSizeChanged,
34
+ onTextSearch,
35
+ onTextSearchClick,
36
+ size,
37
+ textSearchLoading,
38
+ title
39
+ }: CollectionTableToolbarProps) {
33
40
 
34
41
  const searchInputRef = React.useRef<HTMLInputElement>(null);
35
42
  const largeLayout = useLargeLayout();
@@ -37,30 +44,20 @@ export function CollectionTableToolbar(props: CollectionTableToolbarProps) {
37
44
  const searchLoading = React.useRef<boolean>(false);
38
45
 
39
46
  useEffect(() => {
40
- if (searchInputRef.current && searchLoading.current && !props.textSearchLoading) {
47
+ if (searchInputRef.current && searchLoading.current && !textSearchLoading) {
41
48
  searchInputRef.current.focus();
42
49
  }
43
- searchLoading.current = props.textSearchLoading ?? false;
44
- }, [props.textSearchLoading]);
45
-
46
- const clearFilterButton = !props.forceFilter && props.filterIsSet && props.clearFilter &&
47
- <Button
48
- variant={"outlined"}
49
- className="h-fit-content"
50
- aria-label="filter clear"
51
- onClick={props.clearFilter}
52
- size="small">
53
- <FilterListOffIcon/>
54
- Clear filter
55
- </Button>;
50
+ searchLoading.current = textSearchLoading ?? false;
51
+ }, [textSearchLoading]);
52
+
56
53
 
57
54
  const sizeSelect = (
58
55
  <Tooltip title={"Table row size"} side={"right"} sideOffset={4}>
59
56
  <Select
60
- value={props.size as string}
57
+ value={size as string}
61
58
  className="w-16 h-10"
62
59
  size={"small"}
63
- onValueChange={(v) => props.onSizeChanged(v as CollectionSize)}
60
+ onValueChange={(v) => onSizeChanged(v as CollectionSize)}
64
61
  renderValue={(v) => <div className={"font-medium"}>{v.toUpperCase()}</div>}
65
62
  >
66
63
  {["xs", "s", "m", "l", "xl"].map((size) => (
@@ -74,40 +71,38 @@ export function CollectionTableToolbar(props: CollectionTableToolbarProps) {
74
71
 
75
72
  return (
76
73
  <div
77
- className={cn(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-gray-50 dark:bg-gray-900 border-b flex flex-row justify-between items-center w-full")}>
78
75
 
79
76
  <div className="flex items-center gap-2 md:mr-4 mr-2">
80
77
 
81
- {props.title && <div className={"hidden lg:block"}>
82
- {props.title}
78
+ {title && <div className={"hidden lg:block"}>
79
+ {title}
83
80
  </div>}
84
81
 
85
82
  {sizeSelect}
86
83
 
87
- {props.actionsStart}
88
-
89
- {clearFilterButton}
84
+ {actionsStart}
90
85
 
91
86
  </div>
92
87
 
93
88
  <div className="flex items-center gap-2">
94
89
 
95
90
  {largeLayout && <div className="w-[22px]">
96
- {props.loading &&
91
+ {loading &&
97
92
  <CircularProgress size={"small"}/>}
98
93
  </div>}
99
94
 
100
- {(props.onTextSearch || props.onTextSearchClick) &&
95
+ {(onTextSearch || onTextSearchClick) &&
101
96
  <SearchBar
102
97
  key={"search-bar"}
103
98
  inputRef={searchInputRef}
104
- loading={props.textSearchLoading}
105
- disabled={Boolean(props.onTextSearchClick)}
106
- onClick={props.onTextSearchClick}
107
- onTextSearch={props.onTextSearchClick ? undefined : props.onTextSearch}
99
+ loading={textSearchLoading}
100
+ disabled={Boolean(onTextSearchClick)}
101
+ onClick={onTextSearchClick}
102
+ onTextSearch={onTextSearchClick ? undefined : onTextSearch}
108
103
  expandable={true}/>}
109
104
 
110
- {props.actions}
105
+ {actions}
111
106
 
112
107
  </div>
113
108
 
@@ -2,10 +2,9 @@ import React, { useCallback, useEffect, useMemo, useRef, useState } from "react"
2
2
 
3
3
  import useMeasure from "react-use-measure";
4
4
 
5
- import { VirtualTableSize } from "../../VirtualTable";
6
- import { getRowHeight } from "../../VirtualTable/common";
7
- import { cn, RemoveCircleIcon, Tooltip } from "@firecms/ui";
5
+ import { cls, RemoveCircleIcon, Tooltip } from "@firecms/ui";
8
6
  import { ErrorBoundary } from "../../../components";
7
+ import { getRowHeight, TableSize } from "../../common/table_height";
9
8
 
10
9
  interface EntityTableCellProps {
11
10
  children: React.ReactNode;
@@ -19,7 +18,7 @@ interface EntityTableCellProps {
19
18
  error?: Error;
20
19
  allowScroll?: boolean;
21
20
  align: "right" | "left" | "center";
22
- size: VirtualTableSize;
21
+ size: TableSize;
23
22
  disabledTooltip?: string;
24
23
  width: number;
25
24
  showExpandIcon?: boolean;
@@ -47,7 +46,7 @@ const TableCellInner = ({
47
46
  }: TableCellInnerProps) => {
48
47
  return (
49
48
  <div
50
- className={cn("flex flex-col max-h-full w-full",
49
+ className={cls("flex flex-col max-h-full w-full",
51
50
  {
52
51
  "items-start": faded || scrollable
53
52
  })}
@@ -96,7 +95,7 @@ export const EntityTableCell = React.memo<EntityTableCellProps>(
96
95
  const [onHover, setOnHover] = useState(false);
97
96
  const [internalSaved, setInternalSaved] = useState(saved);
98
97
 
99
- const showError = !disabled && error;
98
+ const showError = !disabled && Boolean(error);
100
99
 
101
100
  useEffect(() => {
102
101
  if (saved) {
@@ -176,21 +175,26 @@ export const EntityTableCell = React.memo<EntityTableCellProps>(
176
175
  const setOnHoverTrue = useCallback(() => setOnHover(true), []);
177
176
  const setOnHoverFalse = useCallback(() => setOnHover(false), []);
178
177
 
178
+ const borderClass = showError
179
+ ? "border-red-500"
180
+ : internalSaved
181
+ ? "border-green-500"
182
+ : isSelected
183
+ ? "border-primary"
184
+ : "border-transparent";
185
+
179
186
  return (
180
187
  <div
181
- ref={ref}
182
- className={cn(
188
+ className={cls(
183
189
  "transition-colors duration-100 ease-in-out",
184
190
  `flex relative h-full rounded-md p-${p} border border-4 border-opacity-75`,
185
191
  onHover && !disabled ? "bg-gray-50 dark:bg-gray-900" : "",
186
192
  saved ? "bg-gray-100 bg-opacity-75 dark:bg-gray-800 dark:bg-opacity-75" : "",
187
- !isSelected && !internalSaved && !showError ? "border-transparent" : "",
188
193
  hideOverflow ? "overflow-hidden" : "",
189
194
  isSelected ? "bg-gray-50 dark:bg-gray-900" : "",
190
- isSelected && !internalSaved ? "border-primary" : "",
191
- internalSaved ? "border-green-500 " : "",
192
- showError ? "border-red-500" : ""
195
+ borderClass
193
196
  )}
197
+ ref={ref}
194
198
  style={{
195
199
  justifyContent,
196
200
  alignItems: disabled || !isOverflowing ? "center" : undefined,