@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
@@ -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>
@@ -62,7 +62,7 @@ export function EntityView<M extends Record<string, any>>(
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,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}`}
@@ -4,7 +4,7 @@ import { Entity, EntityCollection, EntityReference, FilterValues } from "../type
4
4
  import { getReferenceFrom } from "../util";
5
5
  import { PreviewSize, ReferencePreview } from "../preview";
6
6
  import { useNavigationController, useReferenceDialog } from "../hooks";
7
- import { Button, cn } from "@firecms/ui";
7
+ import { Button, cls } from "@firecms/ui";
8
8
 
9
9
  export type ReferenceWidgetProps<M extends Record<string, any>> = {
10
10
  name?: string,
@@ -27,6 +27,8 @@ export type ReferenceWidgetProps<M extends Record<string, any>> = {
27
27
  forceFilter?: FilterValues<string>;
28
28
  size: PreviewSize;
29
29
  className?: string;
30
+ includeId?: boolean;
31
+ includeEntityLink?: boolean;
30
32
  };
31
33
 
32
34
  /**
@@ -43,7 +45,9 @@ export function ReferenceWidget<M extends Record<string, any>>({
43
45
  previewProperties,
44
46
  forceFilter,
45
47
  size,
46
- className
48
+ className,
49
+ includeId,
50
+ includeEntityLink
47
51
  }: ReferenceWidgetProps<M>) {
48
52
 
49
53
  const navigationController = useNavigationController();
@@ -52,16 +56,15 @@ export function ReferenceWidget<M extends Record<string, any>>({
52
56
  return navigationController.getCollection(path);
53
57
  }, [path, navigationController.getCollection]);
54
58
 
55
- // if (!collection) {
56
- // throw Error(`Couldn't find the corresponding collection for the path: ${path}`);
57
- // }
58
-
59
59
  const onSingleEntitySelected = useCallback((entity: Entity<M> | null) => {
60
60
  if (disabled)
61
61
  return;
62
62
  if (onReferenceSelected) {
63
63
  const reference = entity ? getReferenceFrom(entity) : null;
64
- onReferenceSelected?.({ reference, entity });
64
+ onReferenceSelected?.({
65
+ reference,
66
+ entity
67
+ });
65
68
  }
66
69
  }, [disabled, onReferenceSelected]);
67
70
 
@@ -70,7 +73,10 @@ export function ReferenceWidget<M extends Record<string, any>>({
70
73
  return;
71
74
  if (onMultipleReferenceSelected) {
72
75
  const references = entities ? entities.map(e => getReferenceFrom(e)) : null;
73
- onMultipleReferenceSelected({ references, entities });
76
+ onMultipleReferenceSelected({
77
+ references,
78
+ entities
79
+ });
74
80
  }
75
81
  }, [disabled, onReferenceSelected]);
76
82
 
@@ -110,7 +116,9 @@ export function ReferenceWidget<M extends Record<string, any>>({
110
116
  reference={ref}
111
117
  disabled={disabled}
112
118
  previewProperties={previewProperties}
113
- size={size}/>
119
+ size={size}
120
+ includeId={includeId}
121
+ includeEntityLink={includeEntityLink}/>
114
122
  })}
115
123
  </div>
116
124
  } else if (value?.isEntityReference && value?.isEntityReference()) {
@@ -119,10 +127,12 @@ export function ReferenceWidget<M extends Record<string, any>>({
119
127
  onClick={onEntryClick}
120
128
  disabled={disabled}
121
129
  previewProperties={previewProperties}
122
- size={size}/>
130
+ size={size}
131
+ includeId={includeId}
132
+ includeEntityLink={includeEntityLink}/>
123
133
 
124
134
  }
125
- return <div className={cn("text-sm font-medium text-gray-500",
135
+ return <div className={cls("text-sm font-medium",
126
136
  "min-w-80 flex flex-col gap-4",
127
137
  "relative transition-colors duration-200 ease-in rounded font-medium",
128
138
  disabled ? "bg-opacity-50" : "hover:bg-opacity-75",
@@ -1,14 +1,14 @@
1
1
  import React from "react";
2
2
 
3
3
  import { coolIconKeys, debounce, Icon, IconButton, iconKeys, SearchBar, Tooltip } from "@firecms/ui";
4
- import { icon_synonyms, iconsSearch } from "../util";
4
+ import { iconSynonyms, iconsSearch } from "../util";
5
5
 
6
6
  const UPDATE_SEARCH_INDEX_WAIT_MS = 220;
7
7
 
8
- if (process.env.NODE_ENV !== "production") {
9
- Object.keys(icon_synonyms).forEach((icon: string) => {
8
+ if (iconSynonyms && process.env.NODE_ENV !== "production") {
9
+ Object.keys(iconSynonyms).forEach((icon: string) => {
10
10
  if (!iconKeys.includes(icon)) {
11
- console.warn(`The icon ${icon} no longer exists. Remove it from \`icon_synonyms\``);
11
+ console.warn(`The icon ${icon} no longer exists. Remove it from \`iconSynonyms\``);
12
12
  }
13
13
  });
14
14
  }
@@ -48,7 +48,7 @@ export function SearchIconsView({
48
48
  return (
49
49
  <>
50
50
  <SearchBar
51
- autoFocus
51
+ autoFocus={false}
52
52
  innerClassName={"w-full sticky top-0 z-10"}
53
53
  onTextSearch={(value?: string) => setQuery(value ?? "")}
54
54
  placeholder="Search for more icons…"
@@ -18,6 +18,7 @@ import { BooleanFilterField } from "./filters/BooleanFilterField";
18
18
  import { DateTimeFilterField } from "./filters/DateTimeFilterField";
19
19
  import { useOutsideAlerter } from "@firecms/ui";
20
20
  import { SelectableTableContext } from "./SelectableTableContext";
21
+ import { getRowHeight } from "../common/table_height";
21
22
 
22
23
  export type SelectableTableProps<M extends Record<string, any>> = {
23
24
 
@@ -115,7 +116,7 @@ export const SelectableTable = React.memo<SelectableTableProps<any>>(
115
116
  onEntityClick,
116
117
  onColumnResize,
117
118
  hoverRow = true,
118
- size,
119
+ size = "m",
119
120
  inlineEditing = false,
120
121
  tableController:
121
122
  {
@@ -224,7 +225,7 @@ export const SelectableTable = React.memo<SelectableTableProps<any>>(
224
225
  error={dataLoadingError}
225
226
  paginationEnabled={paginationEnabled}
226
227
  onColumnResize={onColumnResize}
227
- size={size}
228
+ rowHeight={getRowHeight(size)}
228
229
  loading={dataLoading}
229
230
  filter={filterValues}
230
231
  onFilterUpdate={setFilterValues ? onFilterUpdate : undefined}
@@ -280,6 +281,7 @@ function createFilterField({
280
281
  isArray={isArray}
281
282
  path={baseProperty.path}
282
283
  title={resolvedProperty?.name}
284
+ includeId={baseProperty.includeId}
283
285
  previewProperties={baseProperty?.previewProperties}
284
286
  hidden={hidden}
285
287
  setHidden={setHidden}/>;
@@ -13,6 +13,7 @@ interface ReferenceFilterFieldProps {
13
13
  isArray?: boolean;
14
14
  path?: string;
15
15
  title?: string;
16
+ includeId?: boolean;
16
17
  previewProperties?: string[];
17
18
  hidden: boolean;
18
19
  setHidden: (hidden: boolean) => void;
@@ -40,6 +41,7 @@ export function ReferenceFilterField({
40
41
  isArray,
41
42
  path,
42
43
  title,
44
+ includeId = true,
43
45
  previewProperties,
44
46
  setHidden
45
47
  }: ReferenceFilterFieldProps) {
@@ -134,7 +136,8 @@ export function ReferenceFilterField({
134
136
  onClick={doOpenDialog}
135
137
  reference={reference}
136
138
  hover={true}
137
- allowEntityNavigation={false}
139
+ includeId={includeId}
140
+ includeEntityLink={false}
138
141
  />
139
142
  );
140
143
  };
@@ -15,12 +15,11 @@ import {
15
15
  VirtualTableWhereFilterOp
16
16
  } from "./VirtualTableProps";
17
17
 
18
- import { getRowHeight } from "./common";
19
18
  import { VirtualTableContextProps } from "./types";
20
19
  import { VirtualTableHeaderRow } from "./VirtualTableHeaderRow";
21
20
  import { VirtualTableRow } from "./VirtualTableRow";
22
21
  import { VirtualTableCell } from "./VirtualTableCell";
23
- import { AssignmentIcon, CenteredView, cn, Typography } from "@firecms/ui";
22
+ import { AssignmentIcon, CenteredView, cls, Typography } from "@firecms/ui";
24
23
 
25
24
  const VirtualListContext = createContext<VirtualTableContextProps<any>>({} as any);
26
25
  VirtualListContext.displayName = "VirtualListContext";
@@ -92,7 +91,7 @@ export const VirtualTable = React.memo<VirtualTableProps<any>>(
92
91
  data,
93
92
  onResetPagination,
94
93
  onEndReached,
95
- size = "m",
94
+ rowHeight = 54,
96
95
  columns: columnsProp,
97
96
  onRowClick,
98
97
  onColumnResize,
@@ -108,6 +107,7 @@ export const VirtualTable = React.memo<VirtualTableProps<any>>(
108
107
  hoverRow,
109
108
  createFilterField,
110
109
  rowClassName,
110
+ style,
111
111
  className,
112
112
  endAdornment,
113
113
  AddColumnComponent
@@ -187,7 +187,7 @@ export const VirtualTable = React.memo<VirtualTableProps<any>>(
187
187
  onSortByUpdate(undefined);
188
188
  }, [onSortByUpdate]);
189
189
 
190
- const maxScroll = Math.max((data?.length ?? 0) * getRowHeight(size) - bounds.height, 0);
190
+ const maxScroll = Math.max((data?.length ?? 0) * rowHeight - bounds.height, 0);
191
191
  const onEndReachedInternal = useCallback((scrollOffset: number) => {
192
192
  if (onEndReached && (data?.length ?? 0) > 0 && scrollOffset > endReachCallbackThreshold.current + 600) {
193
193
  endReachCallbackThreshold.current = scrollOffset;
@@ -240,7 +240,7 @@ export const VirtualTable = React.memo<VirtualTableProps<any>>(
240
240
  const empty = !loading && (data?.length ?? 0) === 0;
241
241
  const customView = error
242
242
  ? <CenteredView maxWidth={"2xl"}
243
- className="flex flex-col gap-2">
243
+ className="flex flex-col gap-2">
244
244
 
245
245
  <Typography variant={"h6"}>
246
246
  {"Error fetching data from the data source"}
@@ -253,7 +253,7 @@ export const VirtualTable = React.memo<VirtualTableProps<any>>(
253
253
 
254
254
  const virtualListController = {
255
255
  data,
256
- size,
256
+ rowHeight: rowHeight,
257
257
  cellRenderer,
258
258
  columns,
259
259
  currentSort,
@@ -276,19 +276,20 @@ export const VirtualTable = React.memo<VirtualTableProps<any>>(
276
276
  return (
277
277
  <div
278
278
  ref={measureRef}
279
- className={cn("h-full w-full", className)}>
279
+ style={style}
280
+ className={cls("h-full w-full", className)}>
280
281
  <VirtualListContext.Provider
281
282
  value={virtualListController}>
282
283
 
283
284
  <MemoizedList
284
285
  outerRef={tableRef}
285
- key={size}
286
+ key={rowHeight}
286
287
  width={bounds.width}
287
288
  height={bounds.height}
288
289
  itemCount={(data?.length ?? 0) + (endAdornment ? 1 : 0)}
289
290
  onScroll={onScroll}
290
291
  includeAddColumn={Boolean(AddColumnComponent)}
291
- itemSize={getRowHeight(size)}/>
292
+ itemSize={rowHeight}/>
292
293
 
293
294
  </VirtualListContext.Provider>
294
295
  </div>
@@ -328,7 +329,7 @@ function MemoizedList({
328
329
  onRowClick,
329
330
  data,
330
331
  columns,
331
- size = "m",
332
+ rowHeight = 54,
332
333
  cellRenderer,
333
334
  hoverRow,
334
335
  rowClassName,
@@ -361,7 +362,7 @@ function MemoizedList({
361
362
  ...style,
362
363
  top: `calc(${style.top}px + 48px)`
363
364
  }}
364
- size={size}>
365
+ rowHeight={rowHeight}>
365
366
 
366
367
  {columns.map((column: VirtualTableColumn, columnIndex: number) => {
367
368
  const cellData = rowData && rowData[column.key];
@@ -404,7 +405,7 @@ const SafeLinkRenderer: React.FC<{
404
405
  const urlRegex = /https?:\/\/[^\s]+/g;
405
406
  const htmlContent = text.replace(urlRegex, (url) => {
406
407
  // For each URL found, replace it with an HTML <a> tag
407
- return `<a href="${url}" target="_blank">Link</a><br/>`;
408
+ return `<a href="${url}" class="underline" target="_blank">Link</a><br/>`;
408
409
  });
409
410
 
410
411
  return (
@@ -7,7 +7,7 @@ import {
7
7
  ArrowUpwardIcon,
8
8
  Badge,
9
9
  Button,
10
- cn,
10
+ cls,
11
11
  defaultBorderMixin,
12
12
  FilterListIcon,
13
13
  IconButton,
@@ -85,7 +85,7 @@ export const VirtualTableHeader = React.memo<VirtualTableHeaderProps<any>>(
85
85
  return (
86
86
  <ErrorBoundary>
87
87
  <div
88
- className={cn("flex py-0 px-3 h-full text-xs uppercase font-semibold relative select-none items-center bg-gray-50 dark:bg-gray-900",
88
+ className={cls("flex py-0 px-3 h-full text-xs uppercase font-semibold relative select-none items-center bg-gray-50 dark:bg-gray-900",
89
89
  "text-gray-600 hover:text-gray-800 dark:text-gray-400 dark:hover:text-gray-200 ",
90
90
  "hover:bg-gray-100 dark:hover:bg-gray-800 hover:bg-opacity-50 dark:hover:bg-opacity-50",
91
91
  column.frozen ? "sticky left-0 z-10" : "relative z-0"
@@ -179,7 +179,7 @@ export const VirtualTableHeader = React.memo<VirtualTableHeaderProps<any>>(
179
179
 
180
180
  {column.resizable && <div
181
181
  ref={resizeHandleRef}
182
- className={cn(
182
+ className={cls(
183
183
  "absolute h-full w-[6px] top-0 right-0 cursor-col-resize",
184
184
  hovered && "bg-gray-300 dark:bg-gray-700"
185
185
  )}
@@ -240,7 +240,7 @@ function FilterForm<M>({
240
240
  }}
241
241
  className={"text-gray-900 dark:text-white"}>
242
242
  <div
243
- className={cn(defaultBorderMixin, "py-4 px-6 text-xs font-semibold uppercase border-b")}>
243
+ className={cls(defaultBorderMixin, "py-4 px-6 text-xs font-semibold uppercase border-b")}>
244
244
  {column.title ?? id}
245
245
  </div>
246
246
  {filterField && <div className="m-4">
@@ -4,7 +4,7 @@ import { VirtualTableColumn, VirtualTableWhereFilterOp } from "./VirtualTablePro
4
4
  import { ErrorBoundary } from "../ErrorBoundary";
5
5
  import { VirtualTableHeader } from "./VirtualTableHeader";
6
6
  import { VirtualTableContextProps } from "./types";
7
- import { cn, defaultBorderMixin } from "@firecms/ui";
7
+ import { cls, defaultBorderMixin } from "@firecms/ui";
8
8
 
9
9
  export const VirtualTableHeaderRow = ({
10
10
  columns,
@@ -100,7 +100,7 @@ export const VirtualTableHeaderRow = ({
100
100
 
101
101
  return (
102
102
  <div
103
- className={cn(defaultBorderMixin, "z-20 sticky min-w-full flex w-fit flex-row top-0 left-0 h-12 border-b bg-gray-50 dark:bg-gray-900")}>
103
+ className={cls(defaultBorderMixin, "z-20 sticky min-w-full flex w-fit flex-row top-0 left-0 h-12 border-b bg-gray-50 dark:bg-gray-900")}>
104
104
  {columns.map((c, columnIndex) => {
105
105
  const column = columns[columnIndex];
106
106
 
@@ -69,7 +69,7 @@ export interface VirtualTableProps<T extends Record<string, any>> {
69
69
  /**
70
70
  * Size of the table
71
71
  */
72
- size?: VirtualTableSize,
72
+ rowHeight?: number,
73
73
 
74
74
  /**
75
75
  * In case this table should have some filters set by default
@@ -131,6 +131,11 @@ export interface VirtualTableProps<T extends Record<string, any>> {
131
131
  */
132
132
  className?: string;
133
133
 
134
+ /**
135
+ * Style applied to the table
136
+ */
137
+ style?: React.CSSProperties;
138
+
134
139
  /**
135
140
  * Component rendered at the end of the table, after scroll
136
141
  */
@@ -232,11 +237,6 @@ export type OnVirtualTableColumnResizeParams = {
232
237
  column: VirtualTableColumn
233
238
  };
234
239
 
235
- /**
236
- * @see Table
237
- * @group Components
238
- */
239
- export type VirtualTableSize = "xs" | "s" | "m" | "l" | "xl";
240
240
 
241
241
  /**
242
242
  * @see Table
@@ -2,9 +2,8 @@ import React, { useCallback } from "react";
2
2
 
3
3
  import equal from "react-fast-compare"
4
4
 
5
- import { getRowHeight } from "./common";
6
5
  import { VirtualTableRowProps } from "./types";
7
- import { cn } from "@firecms/ui";
6
+ import { cls } from "@firecms/ui";
8
7
 
9
8
  export const VirtualTableRow = React.memo<VirtualTableRowProps<any>>(
10
9
  function VirtualTableRow<T>({
@@ -12,7 +11,7 @@ export const VirtualTableRow = React.memo<VirtualTableRowProps<any>>(
12
11
  rowIndex,
13
12
  children,
14
13
  onRowClick,
15
- size,
14
+ rowHeight,
16
15
  style,
17
16
  hoverRow,
18
17
  rowClassName
@@ -29,7 +28,7 @@ export const VirtualTableRow = React.memo<VirtualTableRowProps<any>>(
29
28
 
30
29
  return (
31
30
  <div
32
- className={cn(
31
+ className={cls(
33
32
  "flex min-w-full text-sm border-b border-gray-200 dark:border-gray-800 border-opacity-40 dark:border-opacity-40",
34
33
  rowClassName ? rowClassName(rowData) : "",
35
34
  {
@@ -40,7 +39,7 @@ export const VirtualTableRow = React.memo<VirtualTableRowProps<any>>(
40
39
  onClick={onClick}
41
40
  style={{
42
41
  ...(style),
43
- height: getRowHeight(size),
42
+ height: rowHeight,
44
43
  width: "fit-content"
45
44
  }}
46
45
  >
@@ -5,14 +5,13 @@ import {
5
5
  OnVirtualTableColumnResizeParams,
6
6
  VirtualTableColumn,
7
7
  VirtualTableFilterValues,
8
- VirtualTableSize,
9
8
  VirtualTableWhereFilterOp
10
9
  } from "./VirtualTableProps";
11
10
  import { FilterFormFieldProps } from "./VirtualTableHeader";
12
11
 
13
12
  export type VirtualTableRowProps<T> = {
14
13
  style: any,
15
- size: VirtualTableSize,
14
+ rowHeight: number,
16
15
  rowData: T;
17
16
  rowIndex: number;
18
17
  onRowClick?: (props: OnRowClickParams<any>) => void;
@@ -24,7 +23,7 @@ export type VirtualTableRowProps<T> = {
24
23
 
25
24
  export type VirtualTableContextProps<T extends any> = {
26
25
  data?: T[];
27
- size?: VirtualTableSize,
26
+ rowHeight?: number,
28
27
  columns: VirtualTableColumn[];
29
28
  cellRenderer: React.ComponentType<CellRendererParams<T>>;
30
29
  currentSort: "asc" | "desc" | undefined;
@@ -1,6 +1,6 @@
1
- import { EntityAction } from "../../../types";
2
1
  import { ArchiveIcon, DeleteIcon, FileCopyIcon, KeyboardTabIcon, OpenInNewIcon } from "@firecms/ui";
3
- import { DeleteEntityDialog } from "../../DeleteEntityDialog";
2
+ import { EntityAction } from "../../types";
3
+ import { DeleteEntityDialog } from "../DeleteEntityDialog";
4
4
 
5
5
  export const editEntityAction: EntityAction = {
6
6
  icon: <KeyboardTabIcon/>,
@@ -3,3 +3,4 @@ export * from "./useDebouncedData";
3
3
  export * from "./useColumnsIds";
4
4
  export * from "./useDataSourceEntityCollectionTableController";
5
5
  export * from "./useTableSearchHelper";
6
+ export * from "./default_entity_actions";
@@ -1,6 +1,9 @@
1
- import { VirtualTableSize } from "./VirtualTableProps";
1
+ /**
2
+ * @group Components
3
+ */
4
+ export type TableSize = "xs" | "s" | "m" | "l" | "xl";
2
5
 
3
- export function getRowHeight(size: VirtualTableSize): number {
6
+ export function getRowHeight(size: TableSize): number {
4
7
  switch (size) {
5
8
  case "xl":
6
9
  return 400;
@@ -1,4 +1,4 @@
1
- import { CollectionSize, Entity, FireCMSContext, ResolvedProperty, SelectedCellProps } from "../../types";
1
+ import { CollectionSize, ResolvedProperty, SelectedCellProps } from "../../types";
2
2
 
3
3
  export type EntityCollectionTableController<M extends Record<string, any>> = {
4
4
 
@@ -31,14 +31,12 @@ export type EntityCollectionTableController<M extends Record<string, any>> = {
31
31
  * Props passed in a callback when the content of a cell in a table has been edited
32
32
  * @group Collection components
33
33
  */
34
- export interface OnCellValueChangeParams<T = any, M extends Record<string, any> = any> {
34
+ export interface OnCellValueChangeParams<T = any, D = any> {
35
35
  value: T,
36
36
  propertyKey: string,
37
- entity: Entity<M>,
37
+ data?: D,
38
38
  onValueUpdated: () => void
39
39
  setError: (e: Error | undefined) => void
40
- fullPath: string
41
- context: FireCMSContext
42
40
  }
43
41
 
44
42
  /**
@@ -7,8 +7,16 @@ const COLLECTION_GROUP_PARENT_ID = "collectionGroupParent";
7
7
 
8
8
  export function useColumnIds<M extends Record<string, any>>(collection: ResolvedEntityCollection<M>, includeSubcollections: boolean): PropertyColumnConfig[] {
9
9
  return useMemo(() => {
10
- if (collection.propertiesOrder)
11
- return hideAndExpandKeys(collection, collection.propertiesOrder);
10
+ if (collection.propertiesOrder) {
11
+ const propertyColumnConfigs = hideAndExpandKeys(collection, collection.propertiesOrder);
12
+ if (collection.collectionGroup) {
13
+ propertyColumnConfigs.push({
14
+ key: COLLECTION_GROUP_PARENT_ID,
15
+ disabled: true
16
+ });
17
+ }
18
+ return propertyColumnConfigs;
19
+ }
12
20
  return getDefaultColumnKeys(collection, includeSubcollections);
13
21
  }, [collection, includeSubcollections]);
14
22
  }
@@ -12,6 +12,7 @@ import {
12
12
  User
13
13
  } from "../../types";
14
14
  import { useDebouncedData } from "./useDebouncedData";
15
+ import equal from "react-fast-compare"
15
16
 
16
17
  const DEFAULT_PAGE_SIZE = 50;
17
18
 
@@ -31,6 +32,10 @@ export type DataSourceEntityCollectionTableControllerProps<M extends Record<stri
31
32
  entitiesDisplayedFirst?: Entity<M>[];
32
33
 
33
34
  lastDeleteTimestamp?: number;
35
+
36
+ /**
37
+ * Force filter to be applied to the table.
38
+ */
34
39
  forceFilter?: FilterValues<string>;
35
40
  }
36
41
 
@@ -83,6 +88,12 @@ export function useDataSourceEntityCollectionTableController<M extends Record<st
83
88
  return initialSort;
84
89
  }, [initialSort, forceFilter]);
85
90
 
91
+ useEffect(() => {
92
+ if (!equal(forceFilter, filterValues)) {
93
+ setFilterValues(forceFilter)
94
+ }
95
+ }, [forceFilter]);
96
+
86
97
  const [filterValues, setFilterValues] = React.useState<FilterValues<Extract<keyof M, string>> | undefined>(forceFilter ?? initialFilter ?? undefined);
87
98
  const [sortBy, setSortBy] = React.useState<[Extract<keyof M, string>, "asc" | "desc"] | undefined>(initialSortInternal);
88
99