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

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 (163) hide show
  1. package/dist/components/ClearFilterSortButton.d.ts +5 -0
  2. package/dist/components/EntityCollectionTable/EntityCollectionRowActions.d.ts +11 -11
  3. package/dist/components/EntityCollectionTable/EntityCollectionTable.d.ts +1 -1
  4. package/dist/components/EntityCollectionTable/EntityCollectionTableProps.d.ts +5 -3
  5. package/dist/components/EntityCollectionTable/PropertyTableCell.d.ts +1 -0
  6. package/dist/components/EntityCollectionTable/column_utils.d.ts +1 -2
  7. package/dist/components/EntityCollectionTable/fields/TableReferenceField.d.ts +2 -0
  8. package/dist/components/EntityCollectionTable/internal/CollectionTableToolbar.d.ts +1 -4
  9. package/dist/components/EntityCollectionTable/internal/EntityTableCell.d.ts +2 -2
  10. package/dist/components/EntityCollectionTable/internal/popup_field/PopupFormField.d.ts +1 -1
  11. package/dist/components/EntityCollectionView/EntityCollectionView.d.ts +11 -1
  12. package/dist/components/EntityCollectionView/EntityCollectionViewStartActions.d.ts +11 -0
  13. package/dist/components/EntityPreview.d.ts +3 -2
  14. package/dist/components/FireCMSAppBar.d.ts +4 -2
  15. package/dist/components/ReferenceWidget.d.ts +3 -1
  16. package/dist/components/SelectableTable/SelectableTable.d.ts +1 -1
  17. package/dist/components/SelectableTable/filters/ReferenceFilterField.d.ts +2 -1
  18. package/dist/components/VirtualTable/VirtualTableProps.d.ts +1 -6
  19. package/dist/components/VirtualTable/types.d.ts +3 -3
  20. package/dist/components/{EntityCollectionTable/internal → common}/default_entity_actions.d.ts +1 -1
  21. package/dist/components/common/index.d.ts +1 -0
  22. package/dist/components/common/table_height.d.ts +5 -0
  23. package/dist/components/common/types.d.ts +4 -6
  24. package/dist/components/common/useDataSourceEntityCollectionTableController.d.ts +3 -0
  25. package/dist/components/index.d.ts +1 -0
  26. package/dist/core/Drawer.d.ts +5 -12
  27. package/dist/core/DrawerNavigationItem.d.ts +9 -0
  28. package/dist/core/NavigationRoutes.d.ts +1 -1
  29. package/dist/core/Scaffold.d.ts +8 -12
  30. package/dist/core/index.d.ts +3 -4
  31. package/dist/form/components/ErrorFocus.d.ts +1 -1
  32. package/dist/hooks/data/save.d.ts +1 -2
  33. package/dist/hooks/index.d.ts +1 -0
  34. package/dist/hooks/useValidateAuthenticator.d.ts +2 -6
  35. package/dist/index.es.js +10087 -9914
  36. package/dist/index.es.js.map +1 -1
  37. package/dist/index.umd.js +5 -5
  38. package/dist/index.umd.js.map +1 -1
  39. package/dist/internal/useBuildDataSource.d.ts +1 -16
  40. package/dist/preview/components/ReferencePreview.d.ts +2 -1
  41. package/dist/types/collections.d.ts +13 -2
  42. package/dist/types/datasource.d.ts +2 -5
  43. package/dist/types/entities.d.ts +5 -1
  44. package/dist/types/entity_actions.d.ts +14 -0
  45. package/dist/types/index.d.ts +0 -1
  46. package/dist/types/navigation.d.ts +2 -2
  47. package/dist/types/plugins.d.ts +3 -1
  48. package/dist/types/properties.d.ts +10 -2
  49. package/dist/util/entities.d.ts +1 -1
  50. package/dist/util/icon_synonyms.d.ts +1 -97
  51. package/dist/util/navigation_utils.d.ts +2 -2
  52. package/dist/util/objects.d.ts +1 -1
  53. package/dist/util/resolutions.d.ts +13 -13
  54. package/package.json +139 -119
  55. package/src/components/ClearFilterSortButton.tsx +41 -0
  56. package/src/components/EntityCollectionTable/EntityCollectionRowActions.tsx +2 -2
  57. package/src/components/EntityCollectionTable/EntityCollectionTable.tsx +19 -18
  58. package/src/components/EntityCollectionTable/EntityCollectionTableProps.tsx +10 -6
  59. package/src/components/EntityCollectionTable/PropertyTableCell.tsx +38 -34
  60. package/src/components/EntityCollectionTable/column_utils.tsx +3 -3
  61. package/src/components/EntityCollectionTable/fields/TableReferenceField.tsx +9 -1
  62. package/src/components/EntityCollectionTable/fields/TableStorageUpload.tsx +2 -2
  63. package/src/components/EntityCollectionTable/internal/CollectionTableToolbar.tsx +29 -34
  64. package/src/components/EntityCollectionTable/internal/EntityTableCell.tsx +16 -12
  65. package/src/components/EntityCollectionTable/internal/popup_field/PopupFormField.tsx +2 -4
  66. package/src/components/EntityCollectionView/EntityCollectionView.tsx +47 -25
  67. package/src/components/EntityCollectionView/EntityCollectionViewStartActions.tsx +68 -0
  68. package/src/components/EntityPreview.tsx +9 -7
  69. package/src/components/EntityView.tsx +5 -5
  70. package/src/components/FireCMSAppBar.tsx +32 -15
  71. package/src/components/HomePage/DefaultHomePage.tsx +1 -1
  72. package/src/components/HomePage/NavigationCard.tsx +2 -2
  73. package/src/components/HomePage/SmallNavigationCard.tsx +5 -5
  74. package/src/components/PropertyIdCopyTooltipContent.tsx +2 -3
  75. package/src/components/ReferenceTable/ReferenceSelectionTable.tsx +1 -0
  76. package/src/components/ReferenceWidget.tsx +21 -11
  77. package/src/components/SearchIconsView.tsx +5 -5
  78. package/src/components/SelectableTable/SelectableTable.tsx +5 -3
  79. package/src/components/SelectableTable/filters/BooleanFilterField.tsx +2 -3
  80. package/src/components/SelectableTable/filters/DateTimeFilterField.tsx +22 -7
  81. package/src/components/SelectableTable/filters/ReferenceFilterField.tsx +28 -6
  82. package/src/components/SelectableTable/filters/StringNumberFilterField.tsx +35 -15
  83. package/src/components/VirtualTable/VirtualTable.tsx +36 -29
  84. package/src/components/VirtualTable/VirtualTableHeader.tsx +4 -4
  85. package/src/components/VirtualTable/VirtualTableHeaderRow.tsx +2 -2
  86. package/src/components/VirtualTable/VirtualTableProps.tsx +1 -6
  87. package/src/components/VirtualTable/VirtualTableRow.tsx +4 -5
  88. package/src/components/VirtualTable/types.tsx +2 -3
  89. package/src/components/{EntityCollectionTable/internal → common}/default_entity_actions.tsx +2 -2
  90. package/src/components/common/index.ts +1 -0
  91. package/src/components/{VirtualTable/common.tsx → common/table_height.tsx} +5 -2
  92. package/src/components/common/types.tsx +4 -6
  93. package/src/components/common/useColumnsIds.tsx +10 -2
  94. package/src/components/common/useDataSourceEntityCollectionTableController.tsx +11 -0
  95. package/src/components/index.tsx +1 -0
  96. package/src/core/Drawer.tsx +16 -68
  97. package/src/core/DrawerNavigationItem.tsx +62 -0
  98. package/src/core/EntityEditView.tsx +7 -8
  99. package/src/core/EntitySidePanel.tsx +1 -1
  100. package/src/core/FireCMS.tsx +37 -42
  101. package/src/core/NavigationRoutes.tsx +3 -4
  102. package/src/core/Scaffold.tsx +80 -66
  103. package/src/core/field_configs.tsx +2 -3
  104. package/src/core/index.tsx +3 -4
  105. package/src/form/EntityForm.tsx +29 -21
  106. package/src/form/PropertyFieldBinding.tsx +0 -2
  107. package/src/form/components/StorageItemPreview.tsx +2 -2
  108. package/src/form/components/StorageUploadProgress.tsx +3 -3
  109. package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +4 -2
  110. package/src/form/field_bindings/BlockFieldBinding.tsx +2 -2
  111. package/src/form/field_bindings/KeyValueFieldBinding.tsx +4 -4
  112. package/src/form/field_bindings/MarkdownFieldBinding.tsx +2 -2
  113. package/src/form/field_bindings/ReadOnlyFieldBinding.tsx +2 -2
  114. package/src/form/field_bindings/ReferenceFieldBinding.tsx +15 -13
  115. package/src/form/field_bindings/SelectFieldBinding.tsx +3 -3
  116. package/src/form/field_bindings/StorageUploadFieldBinding.tsx +4 -4
  117. package/src/hooks/data/save.ts +3 -1
  118. package/src/hooks/index.tsx +1 -0
  119. package/src/hooks/useBuildLocalConfigurationPersistence.tsx +8 -10
  120. package/src/hooks/useBuildModeController.tsx +11 -5
  121. package/src/hooks/useBuildNavigationController.tsx +77 -21
  122. package/src/hooks/useProjectLog.tsx +3 -3
  123. package/src/hooks/useResolvedNavigationFrom.tsx +1 -1
  124. package/src/hooks/useValidateAuthenticator.tsx +17 -37
  125. package/src/internal/useBuildDataSource.ts +42 -47
  126. package/src/internal/useBuildSideEntityController.tsx +86 -22
  127. package/src/preview/PropertyPreview.tsx +4 -14
  128. package/src/preview/components/BooleanPreview.tsx +2 -2
  129. package/src/preview/components/EnumValuesChip.tsx +1 -1
  130. package/src/preview/components/ReferencePreview.tsx +21 -22
  131. package/src/preview/property_previews/ArrayOfMapsPreview.tsx +0 -1
  132. package/src/preview/property_previews/ArrayOfReferencesPreview.tsx +2 -1
  133. package/src/preview/property_previews/ArrayOfStorageComponentsPreview.tsx +0 -1
  134. package/src/preview/property_previews/ArrayOfStringsPreview.tsx +0 -1
  135. package/src/preview/property_previews/ArrayOneOfPreview.tsx +2 -3
  136. package/src/preview/property_previews/ArrayPropertyPreview.tsx +2 -3
  137. package/src/preview/property_previews/MapPropertyPreview.tsx +5 -5
  138. package/src/preview/property_previews/StringPropertyPreview.tsx +2 -2
  139. package/src/types/collections.ts +19 -3
  140. package/src/types/datasource.ts +7 -4
  141. package/src/types/entities.ts +9 -1
  142. package/src/types/entity_actions.tsx +16 -3
  143. package/src/types/index.ts +0 -1
  144. package/src/types/navigation.ts +2 -3
  145. package/src/types/plugins.tsx +4 -3
  146. package/src/types/properties.ts +15 -4
  147. package/src/types/storage.ts +1 -1
  148. package/src/util/entities.ts +1 -1
  149. package/src/util/enums.ts +1 -1
  150. package/src/util/icon_list.ts +2 -2
  151. package/src/util/icon_synonyms.ts +3 -99
  152. package/src/util/navigation_utils.ts +6 -6
  153. package/src/util/objects.ts +8 -21
  154. package/src/util/resolutions.ts +32 -31
  155. package/dist/components/VirtualTable/common.d.ts +0 -2
  156. package/dist/core/SideEntityView.d.ts +0 -7
  157. package/dist/internal/useBuildCustomizationController.d.ts +0 -2
  158. package/dist/internal/useLocaleConfig.d.ts +0 -1
  159. package/dist/types/appcheck.d.ts +0 -26
  160. package/src/core/SideEntityView.tsx +0 -38
  161. package/src/internal/useBuildCustomizationController.tsx +0 -5
  162. package/src/internal/useLocaleConfig.tsx +0 -18
  163. package/src/types/appcheck.ts +0 -29
@@ -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,14 +66,11 @@ 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";
73
+ import { EntityCollectionViewStartActions } from "./EntityCollectionViewStartActions";
76
74
 
77
75
  const COLLECTION_GROUP_PARENT_ID = "collectionGroupParent";
78
76
 
@@ -80,10 +78,22 @@ const COLLECTION_GROUP_PARENT_ID = "collectionGroupParent";
80
78
  * @group Components
81
79
  */
82
80
  export type EntityCollectionViewProps<M extends Record<string, any>> = {
83
- fullPath: string;
81
+ /**
82
+ * Complete path where this collection is located.
83
+ * It defaults to the collection path if not provided.
84
+ */
85
+ fullPath?: string;
86
+ /**
87
+ * If this is a subcollection, specify the parent collection ids.
88
+ */
84
89
  parentCollectionIds?: string[];
90
+ /**
91
+ * Whether this is a subcollection or not.
92
+ */
85
93
  isSubCollection?: boolean;
94
+
86
95
  className?: string;
96
+
87
97
  } & EntityCollection<M>;
88
98
 
89
99
  /**
@@ -112,7 +122,7 @@ export type EntityCollectionViewProps<M extends Record<string, any>> = {
112
122
  */
113
123
  export const EntityCollectionView = React.memo(
114
124
  function EntityCollectionView<M extends Record<string, any>>({
115
- fullPath,
125
+ fullPath: fullPathProp,
116
126
  parentCollectionIds,
117
127
  isSubCollection,
118
128
  className,
@@ -120,6 +130,8 @@ export const EntityCollectionView = React.memo(
120
130
  }: EntityCollectionViewProps<M>
121
131
  ) {
122
132
 
133
+ const context = useFireCMSContext();
134
+ const fullPath = fullPathProp ?? collectionProp.path;
123
135
  const dataSource = useDataSource(collectionProp);
124
136
  const navigation = useNavigationController();
125
137
  const sideEntityController = useSideEntityController();
@@ -128,7 +140,6 @@ export const EntityCollectionView = React.memo(
128
140
  const analyticsController = useAnalyticsController();
129
141
  const customizationController = useCustomizationController();
130
142
 
131
-
132
143
  const containerRef = React.useRef<HTMLDivElement>(null);
133
144
 
134
145
  const collection = useMemo(() => {
@@ -175,7 +186,6 @@ export const EntityCollectionView = React.memo(
175
186
  const usedSelectionController = collection.selectionController ?? selectionController;
176
187
  const {
177
188
  selectedEntities,
178
- toggleEntitySelection,
179
189
  isEntitySelected,
180
190
  setSelectedEntities
181
191
  } = usedSelectionController;
@@ -186,8 +196,7 @@ export const EntityCollectionView = React.memo(
186
196
 
187
197
  const tableController = useDataSourceEntityCollectionTableController<M>({
188
198
  fullPath,
189
- collection: collectionRef.current,
190
- entitiesDisplayedFirst: [],
199
+ collection,
191
200
  lastDeleteTimestamp
192
201
  });
193
202
 
@@ -301,13 +310,11 @@ export const EntityCollectionView = React.memo(
301
310
  [fullPath]);
302
311
 
303
312
  const onValueChange: OnCellValueChange<any, any> = ({
304
- fullPath,
305
- context,
306
313
  value,
307
314
  propertyKey,
308
315
  onValueUpdated,
309
316
  setError,
310
- entity,
317
+ data: entity,
311
318
  }) => {
312
319
 
313
320
  const updatedValues = setIn({ ...entity.values }, propertyKey, value);
@@ -324,10 +331,12 @@ export const EntityCollectionView = React.memo(
324
331
  return saveEntityWithCallbacks({
325
332
  ...saveProps,
326
333
  collection,
327
- callbacks: collection.callbacks,
328
334
  dataSource,
329
335
  context,
330
- onSaveSuccess: () => onValueUpdated(),
336
+ onSaveSuccess: () => {
337
+ setError(undefined);
338
+ onValueUpdated();
339
+ },
331
340
  onSaveFailure: (e: Error) => {
332
341
  console.error("Save failure");
333
342
  console.error(e);
@@ -346,7 +355,6 @@ export const EntityCollectionView = React.memo(
346
355
 
347
356
  const getPropertyFor = useCallback(({
348
357
  propertyKey,
349
- propertyValue,
350
358
  entity
351
359
  }: GetPropertyForProps<M>) => {
352
360
  let propertyOrBuilder: PropertyOrBuilder<any, M> | undefined = getPropertyInPath<M>(collection.properties, propertyKey);
@@ -361,7 +369,6 @@ export const EntityCollectionView = React.memo(
361
369
  propertyKey,
362
370
  propertyOrBuilder,
363
371
  path: fullPath,
364
- propertyValue,
365
372
  values: entity.values,
366
373
  entityId: entity.id,
367
374
  fields: customizationController.propertyConfigs
@@ -406,7 +413,7 @@ export const EntityCollectionView = React.memo(
406
413
  Builder: ({ entity }) => {
407
414
  const collectionsWithPath = navigation.getParentReferencesFromPath(entity.path);
408
415
  return (
409
- <>
416
+ <div className={"flex flex-col gap-2 w-full"}>
410
417
  {collectionsWithPath.map((reference) => {
411
418
  return (
412
419
  <ReferencePreview
@@ -415,7 +422,7 @@ export const EntityCollectionView = React.memo(
415
422
  size={"tiny"}/>
416
423
  );
417
424
  })}
418
- </>
425
+ </div>
419
426
  );
420
427
  }
421
428
  }]
@@ -584,12 +591,13 @@ export const EntityCollectionView = React.memo(
584
591
  });
585
592
 
586
593
  return (
587
- <div className={cn("overflow-hidden h-full w-full rounded-md", className)}
594
+ <div className={cls("overflow-hidden h-full w-full rounded-md", className)}
588
595
  ref={containerRef}>
589
596
  <EntityCollectionTable
590
597
  key={`collection_table_${fullPath}`}
591
598
  additionalFields={additionalFields}
592
599
  tableController={tableController}
600
+ enablePopupIcon={true}
593
601
  displayedColumnIds={displayedColumnIds}
594
602
  onSizeChanged={onSizeChanged}
595
603
  onEntityClick={onEntityClick}
@@ -606,6 +614,14 @@ export const EntityCollectionView = React.memo(
606
614
  onTextSearchClick={textSearchInitialised ? undefined : onTextSearchClick}
607
615
  textSearchLoading={textSearchLoading}
608
616
  textSearchEnabled={textSearchEnabled}
617
+ actionsStart={<EntityCollectionViewStartActions
618
+ parentCollectionIds={parentCollectionIds ?? []}
619
+ collection={collection}
620
+ tableController={tableController}
621
+ path={fullPath}
622
+ relativePath={collection.path}
623
+ selectionController={usedSelectionController}
624
+ collectionEntitiesCount={docsCount}/>}
609
625
  actions={<EntityCollectionViewActions
610
626
  parentCollectionIds={parentCollectionIds ?? []}
611
627
  collection={collection}
@@ -683,8 +699,11 @@ export const EntityCollectionView = React.memo(
683
699
  equal(a.selectionController, b.selectionController) &&
684
700
  equal(a.Actions, b.Actions) &&
685
701
  equal(a.defaultSize, b.defaultSize) &&
702
+ equal(a.initialFilter, b.initialFilter) &&
703
+ equal(a.initialSort, b.initialSort) &&
686
704
  equal(a.textSearchEnabled, b.textSearchEnabled) &&
687
705
  equal(a.additionalFields, b.additionalFields) &&
706
+ equal(a.sideDialogWidth, b.sideDialogWidth) &&
688
707
  equal(a.forceFilter, b.forceFilter);
689
708
  }) as React.FunctionComponent<EntityCollectionViewProps<any>>
690
709
 
@@ -724,6 +743,7 @@ function EntitiesCount({
724
743
 
725
744
  useEffect(() => {
726
745
  if (onCountChange) {
746
+ setError(undefined);
727
747
  onCountChange(count ?? 0);
728
748
  }
729
749
  }, [onCountChange, count]);
@@ -775,7 +795,7 @@ function EntityIdHeaderWidget({
775
795
  if (!searchString) return;
776
796
  setOpenPopup(false);
777
797
  return sideEntityController.open({
778
- entityId: searchString,
798
+ entityId: searchString.trim(),
779
799
  path,
780
800
  collection,
781
801
  updateUrl: true,
@@ -788,11 +808,13 @@ function EntityIdHeaderWidget({
788
808
  autoFocus={openPopup}
789
809
  placeholder={"Find entity by ID"}
790
810
  // size={"small"}
791
- onChange={(e) => setSearchString(e.target.value)}
811
+ onChange={(e) => {
812
+ setSearchString(e.target.value);
813
+ }}
792
814
  value={searchString}
793
815
  className={"flex-grow bg-transparent outline-none p-1"}/>
794
816
  <Button variant={"outlined"}
795
- disabled={!searchString}
817
+ disabled={!(searchString.trim())}
796
818
  type={"submit"}
797
819
  >Go</Button>
798
820
  </div>
@@ -0,0 +1,68 @@
1
+ import React from "react";
2
+ import { useCustomizationController, useFireCMSContext } from "../../hooks";
3
+ import { CollectionActionsProps, EntityCollection, EntityTableController, SelectionController } from "../../types";
4
+ import { toArray } from "../../util/arrays";
5
+ import { ErrorBoundary } from "../ErrorBoundary";
6
+ import { ClearFilterSortButton } from "../ClearFilterSortButton";
7
+
8
+ export type EntityCollectionViewStartActionsProps<M extends Record<string, any>> = {
9
+ collection: EntityCollection<M>;
10
+ path: string;
11
+ relativePath: string;
12
+ parentCollectionIds: string[];
13
+ selectionController: SelectionController<M>;
14
+ tableController: EntityTableController<M>;
15
+ collectionEntitiesCount: number;
16
+ }
17
+
18
+ export function EntityCollectionViewStartActions<M extends Record<string, any>>({
19
+ collection,
20
+ relativePath,
21
+ parentCollectionIds,
22
+ path,
23
+ selectionController,
24
+ tableController,
25
+ collectionEntitiesCount
26
+ }: EntityCollectionViewStartActionsProps<M>) {
27
+
28
+ const context = useFireCMSContext();
29
+
30
+ const customizationController = useCustomizationController();
31
+ const plugins = customizationController.plugins ?? [];
32
+
33
+ const actionProps: CollectionActionsProps = {
34
+ path,
35
+ relativePath,
36
+ parentCollectionIds,
37
+ collection,
38
+ selectionController,
39
+ context,
40
+ tableController,
41
+ collectionEntitiesCount
42
+ };
43
+ const actions: React.ReactNode[] = [
44
+ <ClearFilterSortButton
45
+ key={"clear_filter"}
46
+ tableController={tableController}
47
+ enabled={!collection.forceFilter}/>
48
+ ];
49
+
50
+ if (plugins) {
51
+ plugins.forEach((plugin, i) => {
52
+ if (plugin.collectionView?.CollectionActionsStart) {
53
+ actions.push(...toArray(plugin.collectionView?.CollectionActionsStart)
54
+ .map((Action, j) => (
55
+ <ErrorBoundary key={`plugin_actions_${i}_${j}`}>
56
+ <Action {...actionProps} {...plugin.collectionView?.collectionActionsStartProps}/>
57
+ </ErrorBoundary>
58
+ )));
59
+ }
60
+ });
61
+ }
62
+
63
+ return (
64
+ <>
65
+ {actions}
66
+ </>
67
+ );
68
+ }
@@ -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",
@@ -2,7 +2,7 @@ import React, { useMemo } from "react";
2
2
  import { PropertyPreview } from "../preview";
3
3
  import { Entity, EntityCollection, ResolvedEntityCollection, ResolvedProperties } from "../types";
4
4
  import { resolveCollection } from "../util";
5
- import { cn, defaultBorderMixin, IconButton, OpenInNewIcon } from "@firecms/ui";
5
+ import { cls, defaultBorderMixin, IconButton, OpenInNewIcon } from "@firecms/ui";
6
6
  import { CustomizationController } from "../types/customization_controller";
7
7
  import { useCustomizationController } from "../hooks/useCustomizationController";
8
8
 
@@ -31,14 +31,14 @@ export function EntityView<M extends Record<string, any>>(
31
31
  entityId: entity.id,
32
32
  values: entity.values,
33
33
  fields: customizationController.propertyConfigs
34
- }), [collection, path, entity]);
34
+ }), [collection, path, entity, customizationController.propertyConfigs]);
35
35
 
36
36
  const properties: ResolvedProperties = resolvedCollection.properties;
37
37
 
38
38
  return (
39
39
  <div className={"w-full " + className}>
40
40
  <div className={"w-full mb-4"}>
41
- <div className={cn(defaultBorderMixin, "flex justify-between py-2 border-b last:border-b-0")}>
41
+ <div className={cls(defaultBorderMixin, "flex justify-between py-2 border-b last:border-b-0")}>
42
42
  <div className="flex items-center w-1/4">
43
43
  <span className="pl-2 text-sm text-gray-600">Id</span>
44
44
  </div>
@@ -58,11 +58,11 @@ export function EntityView<M extends Record<string, any>>(
58
58
  </div>
59
59
  {Object.entries(properties)
60
60
  .map(([key, property]) => {
61
- const value = (entity.values)[key];
61
+ const value = entity.values?.[key];
62
62
  return (
63
63
  <div
64
64
  key={`reference_previews_${key}`}
65
- className={cn(defaultBorderMixin, "flex justify-between py-2 border-b last:border-b-0")}>
65
+ className={cls(defaultBorderMixin, "flex justify-between py-2 border-b last:border-b-0")}>
66
66
  <div className="flex items-center w-1/4">
67
67
  <span className="pl-2 text-sm text-gray-600">{property.name}</span>
68
68
  </div>
@@ -1,10 +1,10 @@
1
1
  import React from "react";
2
2
 
3
3
  import { Link as ReactLink } from "react-router-dom";
4
- import { ErrorBoundary } from "../components";
4
+ import { ErrorBoundary, FireCMSLogo } from "../components";
5
5
  import {
6
6
  Avatar,
7
- cn,
7
+ cls,
8
8
  DarkModeIcon,
9
9
  IconButton,
10
10
  LightModeIcon,
@@ -18,7 +18,8 @@ import { useAuthController, useLargeLayout, useModeController, useNavigationCont
18
18
  import { User } from "../types";
19
19
 
20
20
  export type FireCMSAppBarProps<ADDITIONAL_PROPS = object> = {
21
- title: string;
21
+
22
+ title?: React.ReactNode;
22
23
  /**
23
24
  * A component that gets rendered on the upper side of the main toolbar
24
25
  */
@@ -30,12 +31,16 @@ export type FireCMSAppBarProps<ADDITIONAL_PROPS = object> = {
30
31
 
31
32
  includeDrawer?: boolean;
32
33
 
34
+ includeModeToggle?: boolean;
35
+
33
36
  drawerOpen: boolean;
34
37
 
35
38
  className?: string;
36
39
 
37
40
  style?: React.CSSProperties;
38
41
 
42
+ logo?: string;
43
+
39
44
  user?: User;
40
45
  } & ADDITIONAL_PROPS;
41
46
 
@@ -55,8 +60,10 @@ export const FireCMSAppBar = function FireCMSAppBar({
55
60
  drawerOpen,
56
61
  dropDownActions,
57
62
  includeDrawer,
63
+ includeModeToggle = true,
58
64
  className,
59
65
  style,
66
+ logo,
60
67
  user: userProp
61
68
  }: FireCMSAppBarProps) {
62
69
  const navigation = useNavigationController();
@@ -89,10 +96,10 @@ export const FireCMSAppBar = function FireCMSAppBar({
89
96
  return (
90
97
  <div
91
98
  style={style}
92
- className={cn("pr-2",
99
+ className={cls("pr-2",
93
100
  {
94
101
  "ml-[17rem]": drawerOpen && largeLayout,
95
- "ml-16": includeDrawer && !(drawerOpen && largeLayout) && !startAdornment,
102
+ "ml-16": includeDrawer && !(drawerOpen && largeLayout),
96
103
  "h-16": true,
97
104
  "z-10": largeLayout,
98
105
  "transition-all": true,
@@ -102,27 +109,37 @@ export const FireCMSAppBar = function FireCMSAppBar({
102
109
  "w-[calc(100%-64px)]": includeDrawer && !(drawerOpen && largeLayout),
103
110
  "w-[calc(100%-17rem)]": includeDrawer && (drawerOpen && largeLayout),
104
111
  "duration-150": drawerOpen && largeLayout,
105
- fixed: true,
112
+ fixed: true
106
113
  },
107
114
  className)}>
108
115
 
109
116
  <div className="flex flex-row gap-2 px-4 h-full items-center">
110
117
 
111
- {startAdornment}
112
-
113
118
  {navigation && <div className="mr-8 hidden lg:block">
114
119
  <ReactLink
115
120
  className="visited:text-inherit visited:dark:text-inherit"
116
121
  to={navigation?.basePath ?? "/"}
117
122
  >
118
- <Typography variant="subtitle1"
119
- noWrap
120
- className={"ml-2 !font-medium"}>
121
- {title}
122
- </Typography>
123
+ <div className={"flex flex-row gap-4"}>
124
+ {!includeDrawer && (logo
125
+ ? <img src={logo}
126
+ alt="Logo"
127
+ className={cls("w-[32px] h-[32px]")}/>
128
+ : <FireCMSLogo width={"32px"} height={"32px"}/>)}
129
+
130
+ {typeof title === "string"
131
+ ? <Typography variant="subtitle1"
132
+ noWrap
133
+ className={"ml-2 !font-medium"}>
134
+ {title}
135
+ </Typography>
136
+ : title}
137
+ </div>
123
138
  </ReactLink>
124
139
  </div>}
125
140
 
141
+ {startAdornment}
142
+
126
143
  <div className={"flex-grow"}/>
127
144
 
128
145
  {endAdornment &&
@@ -130,7 +147,7 @@ export const FireCMSAppBar = function FireCMSAppBar({
130
147
  {endAdornment}
131
148
  </ErrorBoundary>}
132
149
 
133
- <IconButton
150
+ {includeModeToggle && <IconButton
134
151
  color="inherit"
135
152
  aria-label="Open drawer"
136
153
  onClick={toggleMode}
@@ -138,7 +155,7 @@ export const FireCMSAppBar = function FireCMSAppBar({
138
155
  {mode === "dark"
139
156
  ? <DarkModeIcon/>
140
157
  : <LightModeIcon/>}
141
- </IconButton>
158
+ </IconButton>}
142
159
 
143
160
  <Menu trigger={avatarComponent}>
144
161
  {user && <div className={"px-4 py-2 mb-2"}>
@@ -191,7 +191,7 @@ export function DefaultHomePage({
191
191
  />
192
192
  </div>
193
193
  ))}
194
- {AdditionalCards &&
194
+ {group?.toLowerCase() !== "admin" && AdditionalCards &&
195
195
  AdditionalCards.map((AdditionalCard, i) => (
196
196
  <div key={`nav_${group}_add_${i}`}>
197
197
  <AdditionalCard {...actionProps} />
@@ -1,4 +1,4 @@
1
- import { ArrowForwardIcon, Card, cn, Markdown, Typography, } from "@firecms/ui";
1
+ import { ArrowForwardIcon, Card, cls, Markdown, Typography, } from "@firecms/ui";
2
2
 
3
3
  export type NavigationCardProps = {
4
4
  name: string,
@@ -17,7 +17,7 @@ export function NavigationCard({
17
17
  }: NavigationCardProps) {
18
18
 
19
19
  return (<Card
20
- className={cn("h-full p-4 cursor-pointer min-h-[230px]")}
20
+ className={cls("h-full p-4 cursor-pointer min-h-[230px]")}
21
21
  onClick={() => {
22
22
  onClick?.();
23
23
  }}>
@@ -1,6 +1,6 @@
1
- import { ArrowForwardIcon, cardClickableMixin, cardMixin, cn, focusedMixin, Typography, } from "@firecms/ui";
1
+ import { ArrowForwardIcon, cardClickableMixin, cardMixin, cls, focusedMixin, Typography, } from "@firecms/ui";
2
2
 
3
- import { Link as ReactLink } from "react-router-dom";
3
+ import { Link } from "react-router-dom";
4
4
 
5
5
  export type SmallNavigationCardProps = {
6
6
  name: string,
@@ -17,9 +17,9 @@ export function SmallNavigationCard({
17
17
  return (
18
18
  <>
19
19
 
20
- <ReactLink
20
+ <Link
21
21
  tabIndex={0}
22
- className={cn(cardMixin,
22
+ className={cls(cardMixin,
23
23
  cardClickableMixin,
24
24
  focusedMixin,
25
25
  "cursor-pointer flex flex-row items-center px-4 py-2 text-inherit dark:text-inherit visited:text-inherit visited:dark:text-inherit hover:text-inherit hover:dark:text-inherit ")}
@@ -39,7 +39,7 @@ export function SmallNavigationCard({
39
39
  <div className={"p-4"}>
40
40
  <ArrowForwardIcon color="primary"/>
41
41
  </div>
42
- </ReactLink>
42
+ </Link>
43
43
 
44
44
  </>);
45
45
  }
@@ -1,4 +1,4 @@
1
- import { ContentPasteIcon, IconButton, Typography } from "@firecms/ui";
1
+ import { ContentCopyIcon, IconButton, Typography } from "@firecms/ui";
2
2
  import { useCallback, useState } from "react";
3
3
 
4
4
  export function PropertyIdCopyTooltipContent({ propertyId }: { propertyId: string }) {
@@ -12,9 +12,8 @@ export function PropertyIdCopyTooltipContent({ propertyId }: { propertyId: strin
12
12
  color={"disabled"}>{copied ? "Copied" : "Property ID"}</Typography>
13
13
  <Typography variant={"caption"} className={"text-white"}><code>{propertyId}</code></Typography>
14
14
  </div>
15
- {/* Copy to clipboard button*/}
16
15
  <IconButton size={"small"}>
17
- <ContentPasteIcon size={"smallest"}
16
+ <ContentCopyIcon size={"smallest"}
18
17
  className={"text-white"}
19
18
  onClick={useCallback(() => {
20
19
  navigator.clipboard.writeText(propertyId);
@@ -291,6 +291,7 @@ export function ReferenceSelectionTable<M extends Record<string, any>>(
291
291
  displayedColumnIds={displayedColumnIds}
292
292
  onEntityClick={onEntityClick}
293
293
  tableController={tableController}
294
+ enablePopupIcon={false}
294
295
  tableRowActionsBuilder={tableRowActionsBuilder}
295
296
  title={<Typography variant={"subtitle2"}>
296
297
  {collection.singularName ? `Select ${collection.singularName}` : `Select from ${collection.name}`}