@firecms/core 3.0.0-beta.6 → 3.0.0-beta.8

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 (185) 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/EntityCollectionTable/EntityCollectionTable.d.ts +1 -1
  7. package/dist/components/EntityCollectionTable/EntityCollectionTableProps.d.ts +4 -2
  8. package/dist/components/EntityCollectionTable/PropertyTableCell.d.ts +1 -0
  9. package/dist/components/EntityCollectionTable/column_utils.d.ts +1 -2
  10. package/dist/components/EntityCollectionTable/fields/TableReferenceField.d.ts +2 -0
  11. package/dist/components/EntityCollectionTable/internal/EntityTableCell.d.ts +2 -2
  12. package/dist/components/EntityCollectionTable/internal/popup_field/PopupFormField.d.ts +1 -1
  13. package/dist/components/EntityPreview.d.ts +3 -2
  14. package/dist/components/ReferenceWidget.d.ts +3 -1
  15. package/dist/components/SelectableTable/filters/ReferenceFilterField.d.ts +2 -1
  16. package/dist/components/VirtualTable/VirtualTableProps.d.ts +5 -6
  17. package/dist/components/VirtualTable/types.d.ts +3 -3
  18. package/dist/components/{EntityCollectionTable/internal → common}/default_entity_actions.d.ts +1 -1
  19. package/dist/components/common/index.d.ts +1 -0
  20. package/dist/components/common/table_height.d.ts +5 -0
  21. package/dist/components/common/types.d.ts +3 -5
  22. package/dist/components/common/useDataSourceEntityCollectionTableController.d.ts +3 -0
  23. package/dist/components/index.d.ts +2 -1
  24. package/dist/{components/FireCMSAppBar.d.ts → core/DefaultAppBar.d.ts} +5 -8
  25. package/dist/core/DefaultDrawer.d.ts +19 -0
  26. package/dist/core/DrawerNavigationItem.d.ts +9 -0
  27. package/dist/core/EntityEditView.d.ts +17 -3
  28. package/dist/core/NavigationRoutes.d.ts +2 -2
  29. package/dist/core/index.d.ts +3 -4
  30. package/dist/form/PropertiesForm.d.ts +8 -0
  31. package/dist/form/components/FieldHelperText.d.ts +3 -3
  32. package/dist/form/components/StorageItemPreview.d.ts +4 -4
  33. package/dist/form/field_bindings/MapFieldBinding.d.ts +1 -1
  34. package/dist/form/field_bindings/StorageUploadFieldBinding.d.ts +2 -4
  35. package/dist/form/index.d.ts +0 -2
  36. package/dist/hooks/data/save.d.ts +1 -2
  37. package/dist/hooks/index.d.ts +1 -0
  38. package/dist/index.d.ts +1 -0
  39. package/dist/index.es.js +10199 -10140
  40. package/dist/index.es.js.map +1 -1
  41. package/dist/index.umd.js +5 -5
  42. package/dist/index.umd.js.map +1 -1
  43. package/dist/preview/PropertyPreviewProps.d.ts +5 -0
  44. package/dist/preview/components/ReferencePreview.d.ts +2 -1
  45. package/dist/preview/components/StorageThumbnail.d.ts +2 -1
  46. package/dist/preview/components/UrlComponentPreview.d.ts +2 -1
  47. package/dist/types/auth.d.ts +1 -1
  48. package/dist/types/collections.d.ts +22 -1
  49. package/dist/types/datasource.d.ts +18 -8
  50. package/dist/types/entity_actions.d.ts +14 -0
  51. package/dist/types/fields.d.ts +31 -30
  52. package/dist/types/navigation.d.ts +2 -2
  53. package/dist/types/plugins.d.ts +11 -3
  54. package/dist/types/properties.d.ts +15 -2
  55. package/dist/util/icon_synonyms.d.ts +1 -97
  56. package/dist/util/icons.d.ts +2 -2
  57. package/dist/util/objects.d.ts +1 -1
  58. package/dist/util/resolutions.d.ts +8 -8
  59. package/dist/util/storage.d.ts +23 -2
  60. package/dist/util/useStorageUploadController.d.ts +1 -1
  61. package/package.json +130 -122
  62. package/src/app/AppBar.tsx +18 -0
  63. package/src/app/Drawer.tsx +25 -0
  64. package/src/app/Scaffold.tsx +249 -0
  65. package/src/app/index.ts +4 -0
  66. package/src/app/useApp.tsx +32 -0
  67. package/src/components/EntityCollectionTable/EntityCollectionRowActions.tsx +8 -10
  68. package/src/components/EntityCollectionTable/EntityCollectionTable.tsx +9 -7
  69. package/src/components/EntityCollectionTable/EntityCollectionTableProps.tsx +9 -5
  70. package/src/components/EntityCollectionTable/PropertyTableCell.tsx +22 -15
  71. package/src/components/EntityCollectionTable/column_utils.tsx +3 -3
  72. package/src/components/EntityCollectionTable/fields/TableReferenceField.tsx +9 -1
  73. package/src/components/EntityCollectionTable/fields/TableStorageUpload.tsx +2 -2
  74. package/src/components/EntityCollectionTable/internal/CollectionTableToolbar.tsx +2 -2
  75. package/src/components/EntityCollectionTable/internal/EntityTableCell.tsx +5 -6
  76. package/src/components/EntityCollectionTable/internal/popup_field/PopupFormField.tsx +4 -5
  77. package/src/components/EntityCollectionView/EntityCollectionView.tsx +26 -24
  78. package/src/components/EntityPreview.tsx +9 -7
  79. package/src/components/EntityView.tsx +4 -4
  80. package/src/components/HomePage/NavigationCard.tsx +2 -2
  81. package/src/components/HomePage/SmallNavigationCard.tsx +5 -5
  82. package/src/components/PropertyIdCopyTooltipContent.tsx +2 -3
  83. package/src/components/ReferenceTable/ReferenceSelectionTable.tsx +1 -0
  84. package/src/components/ReferenceWidget.tsx +21 -11
  85. package/src/components/SearchIconsView.tsx +5 -5
  86. package/src/components/SelectableTable/SelectableTable.tsx +4 -2
  87. package/src/components/SelectableTable/filters/ReferenceFilterField.tsx +4 -1
  88. package/src/components/VirtualTable/VirtualTable.tsx +13 -12
  89. package/src/components/VirtualTable/VirtualTableHeader.tsx +4 -4
  90. package/src/components/VirtualTable/VirtualTableHeaderRow.tsx +2 -2
  91. package/src/components/VirtualTable/VirtualTableProps.tsx +6 -6
  92. package/src/components/VirtualTable/VirtualTableRow.tsx +4 -5
  93. package/src/components/VirtualTable/types.tsx +2 -3
  94. package/src/components/{EntityCollectionTable/internal → common}/default_entity_actions.tsx +2 -2
  95. package/src/components/common/index.ts +1 -0
  96. package/src/components/{VirtualTable/common.tsx → common/table_height.tsx} +5 -2
  97. package/src/components/common/types.tsx +3 -5
  98. package/src/components/common/useColumnsIds.tsx +10 -2
  99. package/src/components/common/useDataSourceEntityCollectionTableController.tsx +11 -0
  100. package/src/components/common/useTableSearchHelper.ts +52 -12
  101. package/src/components/index.tsx +2 -1
  102. package/src/contexts/DialogsProvider.tsx +2 -2
  103. package/src/{components/FireCMSAppBar.tsx → core/DefaultAppBar.tsx} +51 -36
  104. package/src/core/DefaultDrawer.tsx +177 -0
  105. package/src/core/DrawerNavigationItem.tsx +62 -0
  106. package/src/core/EntityEditView.tsx +673 -134
  107. package/src/core/EntitySidePanel.tsx +1 -2
  108. package/src/core/FireCMS.tsx +36 -40
  109. package/src/core/NavigationRoutes.tsx +6 -7
  110. package/src/core/field_configs.tsx +1 -1
  111. package/src/core/index.tsx +3 -4
  112. package/src/form/PropertiesForm.tsx +81 -0
  113. package/src/form/PropertyFieldBinding.tsx +29 -7
  114. package/src/form/components/FieldHelperText.tsx +3 -3
  115. package/src/form/components/StorageItemPreview.tsx +20 -11
  116. package/src/form/components/StorageUploadProgress.tsx +3 -3
  117. package/src/form/field_bindings/ArrayCustomShapedFieldBinding.tsx +8 -5
  118. package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +8 -5
  119. package/src/form/field_bindings/BlockFieldBinding.tsx +2 -2
  120. package/src/form/field_bindings/KeyValueFieldBinding.tsx +44 -39
  121. package/src/form/field_bindings/MapFieldBinding.tsx +11 -3
  122. package/src/form/field_bindings/MarkdownFieldBinding.tsx +2 -2
  123. package/src/form/field_bindings/ReadOnlyFieldBinding.tsx +2 -9
  124. package/src/form/field_bindings/ReferenceFieldBinding.tsx +15 -13
  125. package/src/form/field_bindings/RepeatFieldBinding.tsx +10 -7
  126. package/src/form/field_bindings/SelectFieldBinding.tsx +3 -3
  127. package/src/form/field_bindings/StorageUploadFieldBinding.tsx +10 -39
  128. package/src/form/field_bindings/SwitchFieldBinding.tsx +1 -1
  129. package/src/form/index.tsx +4 -4
  130. package/src/form/validation.ts +1 -17
  131. package/src/hooks/data/save.ts +2 -1
  132. package/src/hooks/index.tsx +1 -0
  133. package/src/hooks/useBuildLocalConfigurationPersistence.tsx +2 -3
  134. package/src/hooks/useBuildNavigationController.tsx +1 -2
  135. package/src/hooks/useResolvedNavigationFrom.tsx +1 -1
  136. package/src/hooks/useValidateAuthenticator.tsx +15 -15
  137. package/src/index.ts +1 -0
  138. package/src/internal/useBuildDataSource.ts +12 -0
  139. package/src/internal/useBuildSideEntityController.tsx +72 -11
  140. package/src/preview/PropertyPreview.tsx +7 -4
  141. package/src/preview/PropertyPreviewProps.tsx +6 -0
  142. package/src/preview/components/BooleanPreview.tsx +2 -2
  143. package/src/preview/components/EnumValuesChip.tsx +1 -1
  144. package/src/preview/components/ImagePreview.tsx +21 -33
  145. package/src/preview/components/ReferencePreview.tsx +22 -22
  146. package/src/preview/components/StorageThumbnail.tsx +5 -1
  147. package/src/preview/components/UrlComponentPreview.tsx +44 -11
  148. package/src/preview/property_previews/ArrayOfMapsPreview.tsx +0 -1
  149. package/src/preview/property_previews/ArrayOfReferencesPreview.tsx +2 -1
  150. package/src/preview/property_previews/ArrayOfStorageComponentsPreview.tsx +0 -1
  151. package/src/preview/property_previews/ArrayOfStringsPreview.tsx +0 -1
  152. package/src/preview/property_previews/ArrayOneOfPreview.tsx +2 -3
  153. package/src/preview/property_previews/ArrayPropertyPreview.tsx +2 -3
  154. package/src/preview/property_previews/MapPropertyPreview.tsx +5 -5
  155. package/src/preview/property_previews/StringPropertyPreview.tsx +2 -2
  156. package/src/types/auth.tsx +1 -1
  157. package/src/types/collections.ts +28 -2
  158. package/src/types/customization_controller.tsx +0 -1
  159. package/src/types/datasource.ts +20 -16
  160. package/src/types/entity_actions.tsx +16 -3
  161. package/src/types/fields.tsx +33 -33
  162. package/src/types/navigation.ts +1 -2
  163. package/src/types/plugins.tsx +12 -3
  164. package/src/types/properties.ts +17 -2
  165. package/src/types/storage.ts +1 -1
  166. package/src/util/entities.ts +4 -3
  167. package/src/util/enums.ts +1 -1
  168. package/src/util/icon_list.ts +2 -2
  169. package/src/util/icon_synonyms.ts +3 -99
  170. package/src/util/objects.ts +25 -28
  171. package/src/util/permissions.ts +1 -0
  172. package/src/util/resolutions.ts +32 -31
  173. package/src/util/storage.ts +75 -21
  174. package/src/util/useStorageUploadController.tsx +21 -3
  175. package/dist/components/VirtualTable/common.d.ts +0 -2
  176. package/dist/core/Drawer.d.ts +0 -23
  177. package/dist/core/Scaffold.d.ts +0 -55
  178. package/dist/core/SideEntityView.d.ts +0 -7
  179. package/dist/form/EntityForm.d.ts +0 -77
  180. package/dist/internal/useBuildCustomizationController.d.ts +0 -2
  181. package/src/core/Drawer.tsx +0 -191
  182. package/src/core/Scaffold.tsx +0 -281
  183. package/src/core/SideEntityView.tsx +0 -38
  184. package/src/form/EntityForm.tsx +0 -728
  185. package/src/internal/useBuildCustomizationController.tsx +0 -5
@@ -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,6 +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";
17
+ import { cls } from "@firecms/ui";
18
+ import { getRowHeight } from "../common/table_height";
18
19
 
19
20
  /**
20
21
  * This component is in charge of rendering a collection table with a high
@@ -42,6 +43,8 @@ import { SelectableTable } from "../SelectableTable/SelectableTable";
42
43
  */
43
44
  export const EntityCollectionTable = function EntityCollectionTable<M extends Record<string, any>, UserType extends User>
44
45
  ({
46
+ className,
47
+ style,
45
48
  forceFilter,
46
49
  actionsStart,
47
50
  actions,
@@ -72,13 +75,13 @@ export const EntityCollectionTable = function EntityCollectionTable<M extends Re
72
75
  emptyComponent,
73
76
  getIdColumnWidth,
74
77
  onTextSearchClick,
75
- textSearchLoading
78
+ textSearchLoading,
79
+ enablePopupIcon
76
80
  }: EntityCollectionTableProps<M>) {
77
81
 
78
82
  const ref = useRef<HTMLDivElement>(null);
79
83
 
80
84
  const largeLayout = useLargeLayout();
81
- const disabledFilterChange = Boolean(forceFilter);
82
85
  const selectedEntities = (selectionController?.selectedEntities?.length > 0 ? selectionController?.selectedEntities : highlightedEntities)?.filter(Boolean);
83
86
 
84
87
  const context: FireCMSContext<UserType> = useFireCMSContext();
@@ -117,10 +120,8 @@ export const EntityCollectionTable = function EntityCollectionTable<M extends Re
117
120
  const propertyKey = column.key;
118
121
 
119
122
  let disabled = column.custom?.disabled;
120
- const propertyValue = entity.values ? getValueInPath(entity.values, propertyKey) : undefined;
121
123
  const property = getPropertyFor?.({
122
124
  propertyKey,
123
- propertyValue,
124
125
  entity
125
126
  }) ?? column.custom.resolvedProperty;
126
127
  if (!property?.disabled) {
@@ -147,6 +148,7 @@ export const EntityCollectionTable = function EntityCollectionTable<M extends Re
147
148
  height={getRowHeight(size)}
148
149
  entity={entity}
149
150
  disabled={disabled}
151
+ enablePopupIcon={enablePopupIcon}
150
152
  path={entity.path}/>
151
153
  : renderSkeletonText()
152
154
  }
@@ -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
 
@@ -290,7 +291,8 @@ export const EntityCollectionTable = function EntityCollectionTable<M extends Re
290
291
  return (
291
292
 
292
293
  <div ref={ref}
293
- 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)}>
294
296
 
295
297
  <CollectionTableToolbar
296
298
  onTextSearch={textSearchEnabled ? onTextSearch : undefined}
@@ -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
  */
@@ -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,
@@ -140,15 +139,19 @@ export const PropertyTableCell = React.memo<PropertyTableCellProps<any>>(
140
139
  setValidationError(undefined);
141
140
  internalValueRef.current = value;
142
141
  if (onValueChange) {
143
- onValueChange({
144
- value,
145
- propertyKey,
146
- setError,
147
- onValueUpdated,
148
- entity,
149
- fullPath: path,
150
- context
151
- });
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
+
152
155
  }
153
156
  })
154
157
  .catch((e) => {
@@ -344,6 +347,8 @@ export const PropertyTableCell = React.memo<PropertyTableCellProps<any>>(
344
347
  path={property.path}
345
348
  multiselect={false}
346
349
  previewProperties={property.previewProperties}
350
+ includeId={property.includeId}
351
+ includeEntityLink={property.includeEntityLink}
347
352
  title={property.name}
348
353
  forceFilter={property.forceFilter}
349
354
  />;
@@ -388,6 +393,8 @@ export const PropertyTableCell = React.memo<PropertyTableCellProps<any>>(
388
393
  previewProperties={arrayProperty.of.previewProperties}
389
394
  title={arrayProperty.name}
390
395
  forceFilter={arrayProperty.of.forceFilter}
396
+ includeId={arrayProperty.of.includeId}
397
+ includeEntityLink={arrayProperty.of.includeEntityLink}
391
398
  />;
392
399
  }
393
400
  allowScroll = false;
@@ -399,7 +406,7 @@ export const PropertyTableCell = React.memo<PropertyTableCellProps<any>>(
399
406
 
400
407
  if (!innerComponent) {
401
408
  allowScroll = false;
402
- showExpandIcon = selected && !innerComponent && !disabled && !readOnlyProperty;
409
+ showExpandIcon = enablePopupIcon && selected && !innerComponent && !disabled && !readOnlyProperty;
403
410
  innerComponent = (
404
411
  <PropertyPreview width={width}
405
412
  height={height}
@@ -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) {
@@ -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>) => {
@@ -100,6 +104,8 @@ export const TableReferenceFieldSuccess = React.memo(
100
104
  hover={!disabled}
101
105
  disabled={!path}
102
106
  previewProperties={previewProperties}
107
+ includeId={includeId}
108
+ includeEntityLink={includeEntityLink}
103
109
  />;
104
110
  else
105
111
  return <EntityPreviewContainer
@@ -122,6 +128,8 @@ export const TableReferenceFieldSuccess = React.memo(
122
128
  hover={!disabled}
123
129
  disabled={!path}
124
130
  previewProperties={previewProperties}
131
+ includeId={includeId}
132
+ includeEntityLink={includeEntityLink}
125
133
  />
126
134
  </div>
127
135
  )
@@ -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";
@@ -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 : "",
@@ -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,
@@ -71,7 +71,7 @@ export function CollectionTableToolbar({
71
71
 
72
72
  return (
73
73
  <div
74
- 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")}>
75
75
 
76
76
  <div className="flex items-center gap-2 md:mr-4 mr-2">
77
77
 
@@ -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
  })}
@@ -186,7 +185,7 @@ export const EntityTableCell = React.memo<EntityTableCellProps>(
186
185
 
187
186
  return (
188
187
  <div
189
- className={cn(
188
+ className={cls(
190
189
  "transition-colors duration-100 ease-in-out",
191
190
  `flex relative h-full rounded-md p-${p} border border-4 border-opacity-75`,
192
191
  onHover && !disabled ? "bg-gray-50 dark:bg-gray-900" : "",
@@ -41,7 +41,7 @@ interface PopupFormFieldProps<M extends Record<string, any>> {
41
41
  * Callback when the value of a cell has been edited
42
42
  * @param params
43
43
  */
44
- onCellValueChange?: (params: OnCellValueChangeParams<any, M>) => Promise<void> | void;
44
+ onCellValueChange?: (params: OnCellValueChangeParams<any, any>) => Promise<void> | void;
45
45
  }
46
46
 
47
47
  export function PopupFormField<M extends Record<string, any>>(props: PopupFormFieldProps<M>) {
@@ -205,12 +205,10 @@ export function PopupFormFieldInternal<M extends Record<string, any>>({
205
205
  return onCellValueChange({
206
206
  value: values[propertyKey as string],
207
207
  propertyKey: propertyKey as string,
208
- entity,
208
+ data: entity,
209
209
  setError: setSavingError,
210
210
  onValueUpdated: () => {
211
211
  },
212
- fullPath: path,
213
- context: fireCMSContext
214
212
  });
215
213
  }
216
214
  return Promise.resolve();
@@ -266,7 +264,8 @@ export function PopupFormFieldInternal<M extends Record<string, any>>({
266
264
  values,
267
265
  path,
268
266
  setFieldValue,
269
- save: saveValue
267
+ save: saveValue,
268
+ formex
270
269
  };
271
270
 
272
271
  const property: ResolvedProperty<any> | undefined = propertyKey && getPropertyInPath(collection.properties, propertyKey as string);
@@ -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,
@@ -35,6 +35,7 @@ import {
35
35
  useAuthController,
36
36
  useCustomizationController,
37
37
  useDataSource,
38
+ useFireCMSContext,
38
39
  useLargeLayout,
39
40
  useNavigationController,
40
41
  useSideEntityController
@@ -44,7 +45,7 @@ import { EntityCollectionViewActions } from "./EntityCollectionViewActions";
44
45
  import {
45
46
  AddIcon,
46
47
  Button,
47
- cn,
48
+ cls,
48
49
  IconButton,
49
50
  KeyboardTabIcon,
50
51
  Markdown,
@@ -65,11 +66,7 @@ import {
65
66
  } from "../common";
66
67
  import { PopupFormField } from "../EntityCollectionTable/internal/popup_field/PopupFormField";
67
68
  import { GetPropertyForProps } from "../EntityCollectionTable/EntityCollectionTableProps";
68
- import {
69
- copyEntityAction,
70
- deleteEntityAction,
71
- editEntityAction
72
- } from "../EntityCollectionTable/internal/default_entity_actions";
69
+ import { copyEntityAction, deleteEntityAction, editEntityAction } from "../common/default_entity_actions";
73
70
  import { DeleteEntityDialog } from "../DeleteEntityDialog";
74
71
  import { useAnalyticsController } from "../../hooks/useAnalyticsController";
75
72
  import { useSelectionController } from "./useSelectionController";
@@ -94,7 +91,9 @@ export type EntityCollectionViewProps<M extends Record<string, any>> = {
94
91
  * Whether this is a subcollection or not.
95
92
  */
96
93
  isSubCollection?: boolean;
94
+
97
95
  className?: string;
96
+
98
97
  } & EntityCollection<M>;
99
98
 
100
99
  /**
@@ -131,6 +130,7 @@ export const EntityCollectionView = React.memo(
131
130
  }: EntityCollectionViewProps<M>
132
131
  ) {
133
132
 
133
+ const context = useFireCMSContext();
134
134
  const fullPath = fullPathProp ?? collectionProp.path;
135
135
  const dataSource = useDataSource(collectionProp);
136
136
  const navigation = useNavigationController();
@@ -196,8 +196,7 @@ export const EntityCollectionView = React.memo(
196
196
 
197
197
  const tableController = useDataSourceEntityCollectionTableController<M>({
198
198
  fullPath,
199
- collection: collectionRef.current,
200
- entitiesDisplayedFirst: [],
199
+ collection,
201
200
  lastDeleteTimestamp
202
201
  });
203
202
 
@@ -267,6 +266,7 @@ export const EntityCollectionView = React.memo(
267
266
  fullPath: string,
268
267
  parentCollectionIds: string[],
269
268
  collection: EntityCollection;
269
+ tableController: EntityTableController;
270
270
  }> | undefined
271
271
 
272
272
  // we are only using the first plugin that implements this
@@ -311,13 +311,11 @@ export const EntityCollectionView = React.memo(
311
311
  [fullPath]);
312
312
 
313
313
  const onValueChange: OnCellValueChange<any, any> = ({
314
- fullPath,
315
- context,
316
314
  value,
317
315
  propertyKey,
318
316
  onValueUpdated,
319
317
  setError,
320
- entity,
318
+ data: entity,
321
319
  }) => {
322
320
 
323
321
  const updatedValues = setIn({ ...entity.values }, propertyKey, value);
@@ -334,7 +332,6 @@ export const EntityCollectionView = React.memo(
334
332
  return saveEntityWithCallbacks({
335
333
  ...saveProps,
336
334
  collection,
337
- callbacks: collection.callbacks,
338
335
  dataSource,
339
336
  context,
340
337
  onSaveSuccess: () => {
@@ -359,7 +356,6 @@ export const EntityCollectionView = React.memo(
359
356
 
360
357
  const getPropertyFor = useCallback(({
361
358
  propertyKey,
362
- propertyValue,
363
359
  entity
364
360
  }: GetPropertyForProps<M>) => {
365
361
  let propertyOrBuilder: PropertyOrBuilder<any, M> | undefined = getPropertyInPath<M>(collection.properties, propertyKey);
@@ -373,13 +369,12 @@ export const EntityCollectionView = React.memo(
373
369
  return resolveProperty({
374
370
  propertyKey,
375
371
  propertyOrBuilder,
376
- path: fullPath,
377
- propertyValue,
372
+ path: entity.path,
378
373
  values: entity.values,
379
374
  entityId: entity.id,
380
375
  fields: customizationController.propertyConfigs
381
376
  });
382
- }, [collection.properties, customizationController.propertyConfigs, fullPath, resolvedCollection.properties]);
377
+ }, [collection.properties, customizationController.propertyConfigs, resolvedCollection.properties]);
383
378
 
384
379
  const displayedColumnIds = useColumnIds(resolvedCollection, true);
385
380
 
@@ -419,7 +414,7 @@ export const EntityCollectionView = React.memo(
419
414
  Builder: ({ entity }) => {
420
415
  const collectionsWithPath = navigation.getParentReferencesFromPath(entity.path);
421
416
  return (
422
- <>
417
+ <div className={"flex flex-col gap-2 w-full"}>
423
418
  {collectionsWithPath.map((reference) => {
424
419
  return (
425
420
  <ReferencePreview
@@ -428,7 +423,7 @@ export const EntityCollectionView = React.memo(
428
423
  size={"tiny"}/>
429
424
  );
430
425
  })}
431
- </>
426
+ </div>
432
427
  );
433
428
  }
434
429
  }]
@@ -570,6 +565,7 @@ export const EntityCollectionView = React.memo(
570
565
  property={property}
571
566
  fullPath={fullPath}
572
567
  collection={collection}
568
+ tableController={tableController}
573
569
  parentCollectionIds={parentCollectionIds ?? []}/>;
574
570
  })}
575
571
  </>;
@@ -580,7 +576,8 @@ export const EntityCollectionView = React.memo(
580
576
  if (typeof AddColumnComponent === "function")
581
577
  return <AddColumnComponent fullPath={fullPath}
582
578
  parentCollectionIds={parentCollectionIds ?? []}
583
- collection={collection}/>;
579
+ collection={collection}
580
+ tableController={tableController}/>;
584
581
  return null;
585
582
  }
586
583
  : undefined;
@@ -597,12 +594,13 @@ export const EntityCollectionView = React.memo(
597
594
  });
598
595
 
599
596
  return (
600
- <div className={cn("overflow-hidden h-full w-full rounded-md", className)}
597
+ <div className={cls("overflow-hidden h-full w-full rounded-md", className)}
601
598
  ref={containerRef}>
602
599
  <EntityCollectionTable
603
600
  key={`collection_table_${fullPath}`}
604
601
  additionalFields={additionalFields}
605
602
  tableController={tableController}
603
+ enablePopupIcon={true}
606
604
  displayedColumnIds={displayedColumnIds}
607
605
  onSizeChanged={onSizeChanged}
608
606
  onEntityClick={onEntityClick}
@@ -708,6 +706,7 @@ export const EntityCollectionView = React.memo(
708
706
  equal(a.initialSort, b.initialSort) &&
709
707
  equal(a.textSearchEnabled, b.textSearchEnabled) &&
710
708
  equal(a.additionalFields, b.additionalFields) &&
709
+ equal(a.sideDialogWidth, b.sideDialogWidth) &&
711
710
  equal(a.forceFilter, b.forceFilter);
712
711
  }) as React.FunctionComponent<EntityCollectionViewProps<any>>
713
712
 
@@ -747,6 +746,7 @@ function EntitiesCount({
747
746
 
748
747
  useEffect(() => {
749
748
  if (onCountChange) {
749
+ setError(undefined);
750
750
  onCountChange(count ?? 0);
751
751
  }
752
752
  }, [onCountChange, count]);
@@ -798,7 +798,7 @@ function EntityIdHeaderWidget({
798
798
  if (!searchString) return;
799
799
  setOpenPopup(false);
800
800
  return sideEntityController.open({
801
- entityId: searchString,
801
+ entityId: searchString.trim(),
802
802
  path,
803
803
  collection,
804
804
  updateUrl: true,
@@ -811,11 +811,13 @@ function EntityIdHeaderWidget({
811
811
  autoFocus={openPopup}
812
812
  placeholder={"Find entity by ID"}
813
813
  // size={"small"}
814
- onChange={(e) => setSearchString(e.target.value)}
814
+ onChange={(e) => {
815
+ setSearchString(e.target.value);
816
+ }}
815
817
  value={searchString}
816
818
  className={"flex-grow bg-transparent outline-none p-1"}/>
817
819
  <Button variant={"outlined"}
818
- disabled={!searchString}
820
+ disabled={!(searchString.trim())}
819
821
  type={"submit"}
820
822
  >Go</Button>
821
823
  </div>
@@ -10,7 +10,7 @@ import {
10
10
  getValueInPath,
11
11
  resolveCollection
12
12
  } from "../util";
13
- import { cn, defaultBorderMixin, IconButton, KeyboardTabIcon, Skeleton, Tooltip, Typography } from "@firecms/ui";
13
+ import { cls, defaultBorderMixin, IconButton, KeyboardTabIcon, Skeleton, Tooltip, Typography } from "@firecms/ui";
14
14
  import { PreviewSize, PropertyPreview, SkeletonPropertyComponent } from "../preview";
15
15
  import { useCustomizationController, useNavigationController, useSideEntityController } from "../hooks";
16
16
  import { useAnalyticsController } from "../hooks/useAnalyticsController";
@@ -23,7 +23,8 @@ export type EntityPreviewProps = {
23
23
  previewProperties?: string[],
24
24
  disabled: undefined | boolean,
25
25
  entity: Entity<any>,
26
- includeEntityNavigation?: boolean,
26
+ includeId?: boolean,
27
+ includeEntityLink?: boolean,
27
28
  onClick?: (e: React.SyntheticEvent) => void;
28
29
  };
29
30
 
@@ -39,7 +40,8 @@ export function EntityPreview({
39
40
  previewProperties,
40
41
  onClick,
41
42
  size,
42
- includeEntityNavigation,
43
+ includeId = true,
44
+ includeEntityLink = true,
43
45
  entity
44
46
  }: EntityPreviewProps) {
45
47
 
@@ -75,7 +77,7 @@ export function EntityPreview({
75
77
  hover={disabled ? undefined : hover}
76
78
  size={size}>
77
79
  {imageProperty && (
78
- <div className={cn("w-10 h-10 mr-2 shrink-0 grow-0", size === "tiny" ? "my-0.5" : "m-2 self-start")}>
80
+ <div className={cls("w-10 h-10 mr-2 shrink-0 grow-0", size === "tiny" ? "my-0.5" : "m-2 self-start")}>
79
81
  <PropertyPreview property={imageProperty}
80
82
  propertyKey={imagePropertyKey as string}
81
83
  size={"tiny"}
@@ -85,7 +87,7 @@ export function EntityPreview({
85
87
 
86
88
  <div className={"flex flex-col flex-grow w-full m-1"}>
87
89
 
88
- {size !== "tiny" && (
90
+ {size !== "tiny" && includeId && (
89
91
  entity
90
92
  ? <div className={`${
91
93
  size !== "medium"
@@ -140,7 +142,7 @@ export function EntityPreview({
140
142
 
141
143
  </div>
142
144
 
143
- {entity && includeEntityNavigation &&
145
+ {entity && includeEntityLink &&
144
146
  <Tooltip title={`See details for ${entity.id}`}
145
147
  className={size !== "tiny" ? "self-start" : ""}>
146
148
  <IconButton
@@ -195,7 +197,7 @@ const EntityPreviewContainerInner = React.forwardRef<HTMLDivElement, EntityPrevi
195
197
  // @ts-ignore
196
198
  tabindex: 0
197
199
  }}
198
- className={cn(
200
+ className={cls(
199
201
  "bg-white dark:bg-gray-900",
200
202
  fullwidth ? "w-full" : "",
201
203
  "items-center",