@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
@@ -1,10 +1,10 @@
1
- import React from "react";
1
+ import React, { useMemo } from "react";
2
2
 
3
3
  import { ImagePreview } from "./ImagePreview";
4
4
  import { getThumbnailMeasure } from "../util";
5
5
  import { PreviewType } from "../../types";
6
6
  import { PreviewSize } from "../PropertyPreviewProps";
7
- import { DescriptionIcon, OpenInNewIcon, Tooltip, Typography } from "@firecms/ui";
7
+ import { cls, DescriptionIcon, OpenInNewIcon, Tooltip, Typography } from "@firecms/ui";
8
8
  import { EmptyValue } from "./EmptyValue";
9
9
 
10
10
  /**
@@ -14,12 +14,15 @@ export function UrlComponentPreview({
14
14
  url,
15
15
  previewType,
16
16
  size,
17
- hint
17
+ hint,
18
+ interactive = true
18
19
  }: {
19
20
  url: string,
20
21
  previewType?: PreviewType,
21
22
  size: PreviewSize,
22
- hint?: string
23
+ hint?: string,
24
+ // for video controls
25
+ interactive?: boolean
23
26
  }): React.ReactElement {
24
27
 
25
28
  if (!previewType) {
@@ -43,17 +46,13 @@ export function UrlComponentPreview({
43
46
  size={size}/>;
44
47
  } else if (previewType === "audio") {
45
48
  return <audio controls
49
+ className={"max-w-100%"}
46
50
  src={url}>
47
51
  Your browser does not support the
48
52
  <code>audio</code> element.
49
53
  </audio>;
50
54
  } else if (previewType === "video") {
51
- return <video
52
- className={`max-w-${size === "small" ? "sm" : "md"}`}
53
- controls
54
- >
55
- <source src={url}/>
56
- </video>;
55
+ return <VideoPreview size={size} src={url} interactive={interactive}/>;
57
56
  } else {
58
57
  return (
59
58
  <a
@@ -66,7 +65,7 @@ export function UrlComponentPreview({
66
65
  width: getThumbnailMeasure(size),
67
66
  height: getThumbnailMeasure(size)
68
67
  }}>
69
- <DescriptionIcon className="flex-grow"/>
68
+ <DescriptionIcon className="text-gray-700 dark:text-gray-300"/>
70
69
  {hint &&
71
70
  <Tooltip title={hint}>
72
71
  <Typography
@@ -77,3 +76,37 @@ export function UrlComponentPreview({
77
76
  );
78
77
  }
79
78
  }
79
+
80
+ function VideoPreview({
81
+ size,
82
+ src,
83
+ interactive
84
+ }: { size: PreviewSize, src: string, interactive: boolean }) {
85
+
86
+ const imageSize = useMemo(() => {
87
+ if (size === "tiny")
88
+ return "140px";
89
+ else if (size === "small")
90
+ return "240px";
91
+ else if (size === "medium")
92
+ return "100%";
93
+ else throw new Error("Invalid size");
94
+ }, [size]);
95
+
96
+ const videoProps = {
97
+ controls: interactive
98
+ };
99
+ return <video
100
+ style={{
101
+ position: "relative",
102
+ objectFit: "cover",
103
+ width: imageSize,
104
+ minWidth: "140px",
105
+ // height: imageSize,
106
+ maxHeight: "100%"
107
+ }}
108
+ {...videoProps}
109
+ className={cls("max-w-100% rounded", { "pointer-events-none": !interactive })}>
110
+ <source src={src}/>
111
+ </video>;
112
+ }
@@ -20,7 +20,6 @@ export function ArrayOfMapsPreview({
20
20
  const property = resolveArrayProperty({
21
21
  propertyKey,
22
22
  property: inputProperty,
23
- propertyValue: value,
24
23
  fields: customizationController.propertyConfigs
25
24
  });
26
25
 
@@ -18,7 +18,6 @@ export function ArrayOfReferencesPreview({
18
18
  const property = resolveArrayProperty({
19
19
  propertyKey,
20
20
  property: inputProperty,
21
- propertyValue: value,
22
21
  fields: customizationController.propertyConfigs
23
22
  });
24
23
 
@@ -43,6 +42,8 @@ export function ArrayOfReferencesPreview({
43
42
  previewProperties={ofProperty.previewProperties}
44
43
  size={childSize}
45
44
  reference={reference}
45
+ includeId={ofProperty.includeId}
46
+ includeEntityLink={ofProperty.includeEntityLink}
46
47
  />
47
48
  </div>;
48
49
  }
@@ -23,7 +23,6 @@ export function ArrayOfStorageComponentsPreview({
23
23
  const property = resolveArrayProperty({
24
24
  propertyKey,
25
25
  property: inputProperty,
26
- propertyValue: value,
27
26
  fields: customizationController.propertyConfigs
28
27
  });
29
28
 
@@ -21,7 +21,6 @@ export function ArrayOfStringsPreview({
21
21
  const property = resolveArrayProperty({
22
22
  propertyKey,
23
23
  property: inputProperty,
24
- propertyValue: value,
25
24
  fields: customizationController.propertyConfigs
26
25
  });
27
26
 
@@ -4,7 +4,7 @@ import { ResolvedProperty } from "../../types";
4
4
  import { useCustomizationController } from "../../hooks";
5
5
  import { PreviewSize, PropertyPreviewProps } from "../PropertyPreviewProps";
6
6
  import { PropertyPreview } from "../PropertyPreview";
7
- import { cn, defaultBorderMixin } from "@firecms/ui";
7
+ import { cls, defaultBorderMixin } from "@firecms/ui";
8
8
  import { DEFAULT_ONE_OF_TYPE, DEFAULT_ONE_OF_VALUE } from "../../util/common";
9
9
  import { ErrorBoundary } from "../../components";
10
10
 
@@ -23,7 +23,6 @@ export function ArrayOneOfPreview({
23
23
  const property = resolveArrayProperty({
24
24
  propertyKey,
25
25
  property: inputProperty,
26
- propertyValue: value,
27
26
  fields: customizationController.propertyConfigs
28
27
  });
29
28
 
@@ -50,7 +49,7 @@ export function ArrayOneOfPreview({
50
49
  values.map((value, index) =>
51
50
  <React.Fragment
52
51
  key={"preview_array_" + value + "_" + index}>
53
- <div className={cn(defaultBorderMixin, "m-1 border-b last:border-b-0")}>
52
+ <div className={cls(defaultBorderMixin, "m-1 border-b last:border-b-0")}>
54
53
  <ErrorBoundary>
55
54
  {value && <PropertyPreview
56
55
  propertyKey={propertyKey}
@@ -5,7 +5,7 @@ import { ResolvedProperty } from "../../types";
5
5
  import { useCustomizationController } from "../../hooks";
6
6
  import { PreviewSize, PropertyPreviewProps } from "../PropertyPreviewProps";
7
7
  import { PropertyPreview } from "../PropertyPreview";
8
- import { cn, defaultBorderMixin } from "@firecms/ui";
8
+ import { cls, defaultBorderMixin } from "@firecms/ui";
9
9
  import { ErrorBoundary } from "../../components";
10
10
 
11
11
  /**
@@ -23,7 +23,6 @@ export function ArrayPropertyPreview({
23
23
  const property = resolveArrayProperty({
24
24
  propertyKey,
25
25
  property: inputProperty,
26
- propertyValue: value,
27
26
  fields: customizationController.propertyConfigs
28
27
  });
29
28
 
@@ -49,7 +48,7 @@ export function ArrayPropertyPreview({
49
48
  return of
50
49
  ? <React.Fragment
51
50
  key={"preview_array_" + index}>
52
- <div className={cn(defaultBorderMixin, "m-1 border-b last:border-b-0")}>
51
+ <div className={cls(defaultBorderMixin, "m-1 border-b last:border-b-0")}>
53
52
  <ErrorBoundary>
54
53
  <PropertyPreview
55
54
  propertyKey={propertyKey}
@@ -3,7 +3,7 @@ import React from "react";
3
3
  import { ResolvedMapProperty } from "../../types";
4
4
  import { PropertyPreviewProps } from "../PropertyPreviewProps";
5
5
  import { PropertyPreview } from "../PropertyPreview";
6
- import { cn, defaultBorderMixin, Typography } from "@firecms/ui";
6
+ import { cls, defaultBorderMixin, Typography } from "@firecms/ui";
7
7
  import { ErrorBoundary } from "../../components";
8
8
  import { EmptyValue } from "../components/EmptyValue";
9
9
 
@@ -61,7 +61,7 @@ export function MapPropertyPreview<T extends Record<string, any> = Record<string
61
61
  return (
62
62
  <div
63
63
  key={`map_preview_table_${key}}`}
64
- className={cn(defaultBorderMixin, "last:border-b-0 border-b")}>
64
+ className={cls(defaultBorderMixin, "last:border-b-0 border-b")}>
65
65
  <div
66
66
  className={"flex flex-row pt-0.5 pb-0.5 gap-2"}>
67
67
  <div
@@ -87,7 +87,7 @@ export function MapPropertyPreview<T extends Record<string, any> = Record<string
87
87
  </div>
88
88
 
89
89
  {(childProperty.dataType === "map" || childProperty === "array") &&
90
- <div className={cn(defaultBorderMixin, "border-l pl-4 ml-2 my-2")}>
90
+ <div className={cls(defaultBorderMixin, "border-l pl-4 ml-2 my-2")}>
91
91
  <PropertyPreview
92
92
  propertyKey={key}
93
93
  value={(value)[key]}
@@ -113,7 +113,7 @@ export function KeyValuePreview({ value }: { value: any }) {
113
113
  Object.entries(value).map(([key, childValue]) => (
114
114
  <div
115
115
  key={`map_preview_table_${key}}`}
116
- className={cn(defaultBorderMixin, "last:border-b-0 border-b")}>
116
+ className={cls(defaultBorderMixin, "last:border-b-0 border-b")}>
117
117
  <div
118
118
  className={"flex flex-row pt-0.5 pb-0.5 gap-2"}>
119
119
  <div
@@ -135,7 +135,7 @@ export function KeyValuePreview({ value }: { value: any }) {
135
135
  </div>
136
136
  </div>
137
137
  {typeof childValue === "object" &&
138
- <div className={cn(defaultBorderMixin, "border-l pl-4")}>
138
+ <div className={cls(defaultBorderMixin, "border-l pl-4")}>
139
139
  <KeyValuePreview value={childValue}/>
140
140
  </div>
141
141
  }
@@ -6,7 +6,7 @@ import { PreviewType } from "../../types";
6
6
  import { UrlComponentPreview } from "../components/UrlComponentPreview";
7
7
  import { PropertyPreviewProps } from "../PropertyPreviewProps";
8
8
  import { ErrorBoundary } from "../../components";
9
- import { Chip, cn, getColorSchemeForSeed } from "@firecms/ui";
9
+ import { Chip, cls, getColorSchemeForSeed } from "@firecms/ui";
10
10
 
11
11
  /**
12
12
  * @group Preview components
@@ -45,7 +45,7 @@ export function StringPropertyPreview({
45
45
  if (!value) return <></>;
46
46
  const lines = value.split("\n");
47
47
  return value && value.includes("\n")
48
- ? <div className={cn("overflow-x-scroll", size === "tiny" ? "text-sm" : "")}>
48
+ ? <div className={cls("overflow-x-scroll", size === "tiny" ? "text-sm" : "")}>
49
49
  {lines.map((str, index) =>
50
50
  <React.Fragment key={`string_preview_${index}`}>
51
51
  <span>{str}</span>
@@ -38,7 +38,7 @@ export type AuthController<UserType extends User = any, ExtraData extends any =
38
38
  /**
39
39
  * Sign out
40
40
  */
41
- signOut: () => void;
41
+ signOut: () => Promise<void>;
42
42
 
43
43
  /**
44
44
  * Error initializing the authentication
@@ -112,7 +112,7 @@ export interface EntityCollection<M extends Record<string, any> = any, UserType
112
112
  * `hidden` in the property definition,will be ignored.
113
113
  * `propertiesOrder` has precedence over `hidden`.
114
114
  */
115
- propertiesOrder?: Extract<keyof M, string>[];
115
+ propertiesOrder?: (Extract<keyof M, string> | `subcollection:${string}`)[];
116
116
 
117
117
  /**
118
118
  * If enabled, content is loaded in batches. If `false` all entities in the
@@ -294,7 +294,16 @@ export interface EntityCollection<M extends Record<string, any> = any, UserType
294
294
  * are writing custom code
295
295
  */
296
296
  ownerId?: string;
297
+
298
+ /**
299
+ * Overrides for the entity view, like the data source or the storage source.
300
+ */
297
301
  overrides?: EntityOverrides;
302
+
303
+ /**
304
+ * Width of the side dialog (in pixels) when opening an entity in this collection.
305
+ */
306
+ sideDialogWidth?: number | string;
298
307
  }
299
308
 
300
309
  /**
@@ -455,7 +464,10 @@ export interface AdditionalFieldDelegate<M extends Record<string, any> = any,
455
464
  * view.
456
465
  * @param entity
457
466
  */
458
- value?: (props: { entity: Entity<M>, context: FireCMSContext<any> }) => string | number | Promise<string | number> | undefined;
467
+ value?: (props: {
468
+ entity: Entity<M>,
469
+ context: FireCMSContext<any>
470
+ }) => string | number | Promise<string | number> | undefined;
459
471
  }
460
472
 
461
473
  /**
@@ -465,8 +477,22 @@ export interface AdditionalFieldDelegate<M extends Record<string, any> = any,
465
477
  */
466
478
  export type EntityCustomView<M extends Record<string, any> = any> =
467
479
  {
480
+ /**
481
+ * Key of this custom view.
482
+ */
468
483
  key: string,
484
+ /**
485
+ * Name of this custom view.
486
+ */
469
487
  name: string,
488
+ /**
489
+ * If set to true, the actions of the entity will be included in the
490
+ * bottom of the panel (save buttons, delete buttons, etc.)
491
+ */
492
+ includeActions?: boolean;
493
+ /**
494
+ * Builder for rendering the custom view
495
+ */
470
496
  Builder?: React.ComponentType<EntityCustomViewParams<M>>;
471
497
  }
472
498
 
@@ -24,7 +24,6 @@ export type CustomizationController = {
24
24
  *
25
25
  * You can also define an entity view from the UI.
26
26
  */
27
-
28
27
  entityViews?: EntityCustomView[];
29
28
 
30
29
  /**
@@ -1,6 +1,7 @@
1
1
  import { Entity, EntityReference, EntityStatus, EntityValues, GeoPoint } from "./entities";
2
2
  import { EntityCollection, FilterValues } from "./collections";
3
3
  import { ResolvedEntityCollection } from "./resolved_entities";
4
+ import { FireCMSContext } from "./firecms_context";
4
5
 
5
6
  /**
6
7
  * @group Datasource
@@ -217,6 +218,18 @@ export interface DataSource {
217
218
  */
218
219
  isFilterCombinationValid?(props: FilterCombinationValidProps): boolean;
219
220
 
221
+ /**
222
+ * Called when the user clicks on the search bar in a collection view.
223
+ * Useful for initializing a text search index.
224
+ * @param props
225
+ */
226
+ initTextSearch?: (props: {
227
+ context: FireCMSContext,
228
+ path: string,
229
+ collection: EntityCollection,
230
+ parentCollectionIds?: string[]
231
+ }) => Promise<boolean>;
232
+
220
233
  }
221
234
 
222
235
  export type FilterCombinationValidProps = {
@@ -363,30 +376,21 @@ export interface DataSourceDelegate {
363
376
  */
364
377
  isFilterCombinationValid?(props: Omit<FilterCombinationValidProps, "collection">): boolean;
365
378
 
366
- /**
367
- * Convert a FireCMS reference to a reference that can be used by the datasource
368
- * @param reference
369
- */
370
- // buildReference: (reference: EntityReference) => any,
371
-
372
- /**
373
- * Convert a FireCMS GeoPoint to a GeoPoint that can be used by the datasource
374
- * @param geoPoint
375
- */
376
- // buildGeoPoint: (geoPoint: GeoPoint) => any,
377
-
378
379
  /**
379
380
  * Get the object to generate the current time in the datasource
380
381
  */
381
382
  currentTime(): any;
382
383
 
383
- // buildDate: (date: Date) => any;
384
-
385
- // buildDeleteFieldValue: () => any;
386
-
387
384
  delegateToCMSModel: (data: any) => any;
388
385
 
389
386
  cmsToDelegateModel: (data: any) => any;
390
387
 
391
388
  setDateToMidnight: (input?: any) => any;
389
+
390
+ initTextSearch?: (props: {
391
+ context: FireCMSContext,
392
+ path: string,
393
+ collection: EntityCollection,
394
+ parentCollectionIds?: string[]
395
+ }) => Promise<boolean>;
392
396
  }
@@ -4,11 +4,26 @@ import { Entity } from "./entities";
4
4
  import { EntityCollection, SelectionController } from "./collections";
5
5
  import { User } from "./user";
6
6
  import { SideEntityController } from "./side_entity_controller";
7
- import { EntityOverrides } from "./entity_overrides";
8
7
 
8
+ /**
9
+ * An entity action is a custom action that can be performed on an entity.
10
+ * They are displayed in the entity view and in the collection view.
11
+ */
9
12
  export type EntityAction<M extends object = any, UserType extends User = User> = {
13
+ /**
14
+ * Title of the action
15
+ */
10
16
  name: string;
17
+
18
+ /**
19
+ * Icon of the action
20
+ */
11
21
  icon?: React.ReactElement;
22
+
23
+ /**
24
+ * Callback when the action is clicked
25
+ * @param props
26
+ */
12
27
  onClick: (props: EntityActionClickProps<M, UserType>) => Promise<void> | void;
13
28
 
14
29
  /**
@@ -25,8 +40,6 @@ export type EntityAction<M extends object = any, UserType extends User = User> =
25
40
 
26
41
  }
27
42
 
28
-
29
-
30
43
  export type EntityActionClickProps<M extends object, UserType extends User = User> = {
31
44
  entity: Entity<M>;
32
45
  context: FireCMSContext<UserType>;
@@ -1,6 +1,6 @@
1
- import { EntityValues } from "./entities";
2
1
  import { CMSType, PropertyOrBuilder } from "./properties";
3
2
  import { ResolvedEntityCollection, ResolvedProperty } from "./resolved_entities";
3
+ import { FormexController } from "@firecms/formex";
4
4
 
5
5
  /**
6
6
  * When building a custom field you need to create a React component that takes
@@ -21,11 +21,6 @@ export interface FieldProps<T extends CMSType = any, CustomProps = any, M extend
21
21
  */
22
22
  value: T;
23
23
 
24
- /**
25
- * Initial value of this field
26
- */
27
- // initialValue: T | undefined;
28
-
29
24
  /**
30
25
  * Set value of field directly
31
26
  */
@@ -42,7 +37,7 @@ export interface FieldProps<T extends CMSType = any, CustomProps = any, M extend
42
37
  /**
43
38
  * Is the form currently submitting
44
39
  */
45
- isSubmitting: boolean;
40
+ isSubmitting?: boolean;
46
41
 
47
42
  /**
48
43
  * Should this field show the error indicator.
@@ -50,19 +45,19 @@ export interface FieldProps<T extends CMSType = any, CustomProps = any, M extend
50
45
  * filled) but we don't want to show the error until the user has tried
51
46
  * saving.
52
47
  */
53
- showError: boolean;
48
+ showError?: boolean;
54
49
 
55
50
  /**
56
51
  * Is there an error in this field. The error field has the same shape as
57
52
  * the field, replacing values with a string containing the error.
58
53
  * It takes the value `null` if there is no error
59
54
  */
60
- error: any | null;
55
+ error?: any | null;
61
56
 
62
57
  /**
63
58
  * Has this field been touched
64
59
  */
65
- touched: boolean;
60
+ touched?: boolean;
66
61
 
67
62
  /**
68
63
  * Property related to this field
@@ -72,38 +67,38 @@ export interface FieldProps<T extends CMSType = any, CustomProps = any, M extend
72
67
  /**
73
68
  * Should this field include a description
74
69
  */
75
- includeDescription: boolean;
70
+ includeDescription?: boolean;
76
71
 
77
72
  /**
78
73
  * Flag to indicate that the underlying value has been updated in the
79
74
  * datasource
80
75
  */
81
- underlyingValueHasChanged: boolean;
76
+ underlyingValueHasChanged?: boolean;
82
77
 
83
78
  /**
84
79
  * Is this field part of an array
85
80
  */
86
- partOfArray: boolean;
81
+ partOfArray?: boolean;
87
82
 
88
83
  /**
89
84
  * Is this field part of a block (oneOf array)
90
85
  */
91
- partOfBlock: boolean;
86
+ partOfBlock?: boolean;
92
87
 
93
88
  /**
94
89
  * Is this field being rendered in the entity table popup
95
90
  */
96
- tableMode: boolean;
91
+ tableMode?: boolean;
97
92
 
98
93
  /**
99
94
  * Should this field autofocus on mount
100
95
  */
101
- autoFocus: boolean;
96
+ autoFocus?: boolean;
102
97
 
103
98
  /**
104
99
  * Additional properties set by the developer
105
100
  */
106
- customProps: CustomProps
101
+ customProps?: CustomProps
107
102
 
108
103
  /**
109
104
  * Additional values related to the state of the form or the entity
@@ -113,7 +108,7 @@ export interface FieldProps<T extends CMSType = any, CustomProps = any, M extend
113
108
  /**
114
109
  * Flag to indicate if this field should be disabled
115
110
  */
116
- disabled: boolean;
111
+ disabled?: boolean;
117
112
 
118
113
  }
119
114
 
@@ -124,37 +119,42 @@ export interface FieldProps<T extends CMSType = any, CustomProps = any, M extend
124
119
  export interface FormContext<M extends Record<string, any> = any> {
125
120
 
126
121
  /**
127
- * Collection of the entity being modified
122
+ * Current values of the entity
128
123
  */
129
- collection: ResolvedEntityCollection<M>;
124
+ values: M;
130
125
 
131
126
  /**
132
- * Current values of the entity
127
+ * Update the value of a field
128
+ * @param key
129
+ * @param value
130
+ * @param shouldValidate
133
131
  */
134
- values: EntityValues<M>;
132
+ setFieldValue: (key: string, value: any, shouldValidate?: boolean) => void;
135
133
 
136
134
  /**
137
- * Entity id, it can be null if it's a new entity
135
+ * Save the entity.
138
136
  */
139
- entityId?: string;
137
+ save: (values: M) => void;
140
138
 
141
139
  /**
142
- * Path this entity is located at
140
+ * Collection of the entity being modified
143
141
  */
144
- path: string;
142
+ collection?: ResolvedEntityCollection<M>;
145
143
 
146
144
  /**
147
- * Update the value of a field
148
- * @param key
149
- * @param value
150
- * @param shouldValidate
145
+ * Entity id, it can be null if it's a new entity
151
146
  */
152
- setFieldValue: (key: string, value: any, shouldValidate?: boolean) => void;
147
+ entityId?: string;
148
+
149
+ /**
150
+ * Path this entity is located at
151
+ */
152
+ path?: string;
153
153
 
154
154
  /**
155
- * Save the entity
155
+ * This is the underlying formex controller that powers the form
156
156
  */
157
- save: (values: EntityValues<M>) => void;
157
+ formex: FormexController<M>;
158
158
  }
159
159
 
160
160
  /**
@@ -57,10 +57,9 @@ export type NavigationController<EC extends EntityCollection = EntityCollection<
57
57
  * The collection is resolved from the given path or alias.
58
58
  */
59
59
  getCollection: (pathOrId: string,
60
- entityId?: string,
61
60
  includeUserOverride?: boolean) => EC | undefined;
62
61
  /**
63
- * Get the collection configuration from its parent path segments.
62
+ * Get the collection configuration from its parent ids.
64
63
  */
65
64
  getCollectionFromIds: (ids: string[]) => EC | undefined;
66
65
 
@@ -1,7 +1,7 @@
1
1
  import React, { PropsWithChildren } from "react";
2
2
 
3
3
  import { FireCMSContext } from "./firecms_context";
4
- import { CollectionActionsProps, EntityCollection } from "./collections";
4
+ import { CollectionActionsProps, EntityCollection, EntityTableController } from "./collections";
5
5
  import { User } from "./user";
6
6
  import { FieldProps, FormContext } from "./fields";
7
7
  import { CMSType, Property } from "./properties";
@@ -98,6 +98,13 @@ export type FireCMSPlugin<PROPS = any, FORM_PROPS = any, EC extends EntityCollec
98
98
  CollectionActionsStart?: React.ComponentType<CollectionActionsProps<any, any, EC> & COL_ACTIONS_START__PROPS> | React.ComponentType<CollectionActionsProps<any, any, EC> & COL_ACTIONS_START__PROPS>[];
99
99
  collectionActionsStartProps?: COL_ACTIONS_START__PROPS;
100
100
 
101
+ blockSearch?: (props: {
102
+ context: FireCMSContext,
103
+ path: string,
104
+ collection: EC,
105
+ parentCollectionIds?: string[]
106
+ }) => boolean;
107
+
101
108
  showTextSearchBar?: (props: {
102
109
  context: FireCMSContext,
103
110
  path: string,
@@ -123,6 +130,7 @@ export type FireCMSPlugin<PROPS = any, FORM_PROPS = any, EC extends EntityCollec
123
130
  parentCollectionIds: string[],
124
131
  onHover: boolean,
125
132
  collection: EC;
133
+ tableController: EntityTableController;
126
134
  }>;
127
135
 
128
136
  /**
@@ -133,6 +141,7 @@ export type FireCMSPlugin<PROPS = any, FORM_PROPS = any, EC extends EntityCollec
133
141
  fullPath: string,
134
142
  parentCollectionIds: string[],
135
143
  collection: EC;
144
+ tableController: EntityTableController;
136
145
  }>;
137
146
  }
138
147
 
@@ -194,8 +203,8 @@ export type PluginFieldBuilderParams<T extends CMSType = CMSType, M extends Reco
194
203
  property: Property<T> | ResolvedProperty<T>;
195
204
  Field: React.ComponentType<FieldProps<T, any, M>>;
196
205
  plugin: FireCMSPlugin;
197
- path: string;
198
- collection: EC;
206
+ path?: string;
207
+ collection?: EC;
199
208
  };
200
209
 
201
210
  export interface PluginGenericProps<UserType extends User = User> {