@firecms/core 3.0.0-canary.11 → 3.0.0-canary.111

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 (269) hide show
  1. package/README.md +1 -1
  2. package/dist/app/AppBar.d.ts +12 -0
  3. package/dist/app/Drawer.d.ts +17 -0
  4. package/dist/app/Scaffold.d.ts +30 -0
  5. package/dist/app/index.d.ts +4 -0
  6. package/dist/app/useApp.d.ts +16 -0
  7. package/dist/components/CircularProgressCenter.d.ts +1 -1
  8. package/dist/components/ClearFilterSortButton.d.ts +5 -0
  9. package/dist/components/EntityCollectionTable/EntityCollectionRowActions.d.ts +11 -12
  10. package/dist/components/EntityCollectionTable/EntityCollectionTable.d.ts +1 -1
  11. package/dist/components/EntityCollectionTable/EntityCollectionTableProps.d.ts +5 -3
  12. package/dist/components/EntityCollectionTable/PropertyTableCell.d.ts +1 -0
  13. package/dist/components/EntityCollectionTable/column_utils.d.ts +1 -2
  14. package/dist/components/EntityCollectionTable/fields/TableReferenceField.d.ts +2 -0
  15. package/dist/components/EntityCollectionTable/internal/CollectionTableToolbar.d.ts +1 -4
  16. package/dist/components/EntityCollectionTable/internal/EntityTableCell.d.ts +2 -2
  17. package/dist/components/EntityCollectionTable/internal/popup_field/PopupFormField.d.ts +2 -2
  18. package/dist/components/EntityCollectionView/EntityCollectionView.d.ts +12 -2
  19. package/dist/components/EntityCollectionView/EntityCollectionViewStartActions.d.ts +11 -0
  20. package/dist/components/EntityPreview.d.ts +5 -4
  21. package/dist/components/ErrorView.d.ts +1 -1
  22. package/dist/components/HomePage/DefaultHomePage.d.ts +1 -1
  23. package/dist/components/HomePage/NavigationCardBinding.d.ts +1 -1
  24. package/dist/components/PropertyIdCopyTooltip.d.ts +8 -0
  25. package/dist/components/ReferenceWidget.d.ts +3 -1
  26. package/dist/components/SelectableTable/SelectableTable.d.ts +1 -1
  27. package/dist/components/SelectableTable/filters/ReferenceFilterField.d.ts +2 -1
  28. package/dist/components/VirtualTable/VirtualTableProps.d.ts +15 -12
  29. package/dist/components/VirtualTable/types.d.ts +3 -3
  30. package/dist/components/{EntityCollectionTable/internal → common}/default_entity_actions.d.ts +1 -1
  31. package/dist/components/common/index.d.ts +1 -0
  32. package/dist/components/common/table_height.d.ts +5 -0
  33. package/dist/components/common/types.d.ts +4 -6
  34. package/dist/components/common/useColumnsIds.d.ts +2 -1
  35. package/dist/components/common/useDataSourceEntityCollectionTableController.d.ts +3 -0
  36. package/dist/components/index.d.ts +3 -1
  37. package/dist/{components/FireCMSAppBar.d.ts → core/DefaultAppBar.d.ts} +6 -9
  38. package/dist/core/DefaultDrawer.d.ts +19 -0
  39. package/dist/core/DrawerNavigationItem.d.ts +9 -0
  40. package/dist/core/EntityEditView.d.ts +18 -4
  41. package/dist/core/FireCMS.d.ts +1 -1
  42. package/dist/core/NavigationRoutes.d.ts +3 -3
  43. package/dist/core/index.d.ts +3 -4
  44. package/dist/form/PropertyFieldBinding.d.ts +1 -1
  45. package/dist/form/components/ErrorFocus.d.ts +1 -1
  46. package/dist/form/components/FieldHelperText.d.ts +3 -3
  47. package/dist/form/components/LabelWithIcon.d.ts +1 -1
  48. package/dist/form/components/LabelWithIconAndTooltip.d.ts +15 -0
  49. package/dist/form/components/StorageItemPreview.d.ts +4 -4
  50. package/dist/form/components/index.d.ts +1 -0
  51. package/dist/form/field_bindings/ArrayCustomShapedFieldBinding.d.ts +1 -1
  52. package/dist/form/field_bindings/ArrayOfReferencesFieldBinding.d.ts +1 -1
  53. package/dist/form/field_bindings/BlockFieldBinding.d.ts +1 -1
  54. package/dist/form/field_bindings/KeyValueFieldBinding.d.ts +1 -1
  55. package/dist/form/field_bindings/MapFieldBinding.d.ts +1 -1
  56. package/dist/form/field_bindings/MarkdownEditorFieldBinding.d.ts +11 -0
  57. package/dist/form/field_bindings/MultiSelectBinding.d.ts +1 -1
  58. package/dist/form/field_bindings/ReadOnlyFieldBinding.d.ts +1 -1
  59. package/dist/form/field_bindings/RepeatFieldBinding.d.ts +1 -1
  60. package/dist/form/field_bindings/SelectFieldBinding.d.ts +1 -1
  61. package/dist/form/field_bindings/StorageUploadFieldBinding.d.ts +3 -5
  62. package/dist/form/field_bindings/TextFieldBinding.d.ts +1 -1
  63. package/dist/form/index.d.ts +2 -4
  64. package/dist/hooks/data/save.d.ts +1 -2
  65. package/dist/hooks/index.d.ts +1 -0
  66. package/dist/hooks/useBuildNavigationController.d.ts +1 -2
  67. package/dist/hooks/useProjectLog.d.ts +2 -2
  68. package/dist/hooks/useValidateAuthenticator.d.ts +4 -8
  69. package/dist/index.d.ts +1 -0
  70. package/dist/index.es.js +15632 -12442
  71. package/dist/index.es.js.map +1 -1
  72. package/dist/index.umd.js +19871 -587
  73. package/dist/index.umd.js.map +1 -1
  74. package/dist/internal/useBuildDataSource.d.ts +1 -16
  75. package/dist/preview/PropertyPreviewProps.d.ts +6 -1
  76. package/dist/preview/components/EnumValuesChip.d.ts +1 -1
  77. package/dist/preview/components/ReferencePreview.d.ts +2 -1
  78. package/dist/preview/components/StorageThumbnail.d.ts +2 -1
  79. package/dist/preview/components/UrlComponentPreview.d.ts +2 -1
  80. package/dist/types/auth.d.ts +3 -3
  81. package/dist/types/collections.d.ts +39 -5
  82. package/dist/types/datasource.d.ts +45 -31
  83. package/dist/types/entities.d.ts +6 -1
  84. package/dist/types/entity_actions.d.ts +14 -0
  85. package/dist/types/fields.d.ts +45 -39
  86. package/dist/types/index.d.ts +0 -1
  87. package/dist/types/navigation.d.ts +6 -5
  88. package/dist/types/plugins.d.ts +14 -4
  89. package/dist/types/properties.d.ts +32 -19
  90. package/dist/types/storage.d.ts +11 -3
  91. package/dist/util/entities.d.ts +1 -1
  92. package/dist/util/icon_list.d.ts +5 -1
  93. package/dist/util/icon_synonyms.d.ts +1 -97
  94. package/dist/util/icons.d.ts +2 -2
  95. package/dist/util/index.d.ts +1 -0
  96. package/dist/util/navigation_utils.d.ts +2 -2
  97. package/dist/util/objects.d.ts +1 -1
  98. package/dist/util/plurals.d.ts +0 -2
  99. package/dist/util/resolutions.d.ts +14 -13
  100. package/dist/util/storage.d.ts +23 -2
  101. package/dist/util/useStorageUploadController.d.ts +1 -1
  102. package/package.json +128 -119
  103. package/src/app/AppBar.tsx +18 -0
  104. package/src/app/Drawer.tsx +25 -0
  105. package/src/app/Scaffold.tsx +245 -0
  106. package/src/app/index.ts +4 -0
  107. package/src/app/useApp.tsx +32 -0
  108. package/src/components/ArrayContainer.tsx +9 -7
  109. package/src/components/CircularProgressCenter.tsx +1 -1
  110. package/src/components/ClearFilterSortButton.tsx +41 -0
  111. package/src/components/EntityCollectionTable/EntityCollectionRowActions.tsx +12 -19
  112. package/src/components/EntityCollectionTable/EntityCollectionTable.tsx +21 -20
  113. package/src/components/EntityCollectionTable/EntityCollectionTableProps.tsx +10 -6
  114. package/src/components/EntityCollectionTable/PropertyTableCell.tsx +41 -35
  115. package/src/components/EntityCollectionTable/column_utils.tsx +3 -3
  116. package/src/components/EntityCollectionTable/fields/TableReferenceField.tsx +22 -12
  117. package/src/components/EntityCollectionTable/fields/TableStorageUpload.tsx +14 -6
  118. package/src/components/EntityCollectionTable/internal/CollectionTableToolbar.tsx +29 -34
  119. package/src/components/EntityCollectionTable/internal/EntityTableCell.tsx +17 -13
  120. package/src/components/EntityCollectionTable/internal/EntityTableCellActions.tsx +19 -7
  121. package/src/components/EntityCollectionTable/internal/popup_field/PopupFormField.tsx +7 -10
  122. package/src/components/EntityCollectionView/EntityCollectionView.tsx +75 -51
  123. package/src/components/EntityCollectionView/EntityCollectionViewStartActions.tsx +68 -0
  124. package/src/components/EntityCollectionView/useSelectionController.tsx +19 -7
  125. package/src/components/EntityPreview.tsx +21 -15
  126. package/src/components/EntityView.tsx +5 -5
  127. package/src/components/ErrorView.tsx +1 -1
  128. package/src/components/HomePage/DefaultHomePage.tsx +24 -15
  129. package/src/components/HomePage/NavigationCard.tsx +3 -3
  130. package/src/components/HomePage/NavigationCardBinding.tsx +1 -1
  131. package/src/components/HomePage/SmallNavigationCard.tsx +5 -6
  132. package/src/components/PropertyIdCopyTooltip.tsx +48 -0
  133. package/src/components/ReferenceTable/ReferenceSelectionTable.tsx +2 -5
  134. package/src/components/ReferenceWidget.tsx +22 -12
  135. package/src/components/SearchIconsView.tsx +11 -7
  136. package/src/components/SelectableTable/SelectableTable.tsx +7 -7
  137. package/src/components/SelectableTable/filters/BooleanFilterField.tsx +2 -3
  138. package/src/components/SelectableTable/filters/DateTimeFilterField.tsx +22 -7
  139. package/src/components/SelectableTable/filters/ReferenceFilterField.tsx +28 -6
  140. package/src/components/SelectableTable/filters/StringNumberFilterField.tsx +35 -15
  141. package/src/components/VirtualTable/VirtualTable.tsx +70 -37
  142. package/src/components/VirtualTable/VirtualTableCell.tsx +1 -1
  143. package/src/components/VirtualTable/VirtualTableHeader.tsx +4 -4
  144. package/src/components/VirtualTable/VirtualTableHeaderRow.tsx +2 -2
  145. package/src/components/VirtualTable/VirtualTableProps.tsx +18 -14
  146. package/src/components/VirtualTable/VirtualTableRow.tsx +4 -5
  147. package/src/components/VirtualTable/fields/VirtualTableDateField.tsx +1 -1
  148. package/src/components/VirtualTable/types.tsx +2 -3
  149. package/src/components/{EntityCollectionTable/internal → common}/default_entity_actions.tsx +2 -2
  150. package/src/components/common/index.ts +1 -0
  151. package/src/components/{VirtualTable/common.tsx → common/table_height.tsx} +5 -2
  152. package/src/components/common/types.tsx +4 -6
  153. package/src/components/common/useColumnsIds.tsx +23 -2
  154. package/src/components/common/useDataSourceEntityCollectionTableController.tsx +11 -0
  155. package/src/components/common/useTableSearchHelper.ts +53 -12
  156. package/src/components/index.tsx +3 -1
  157. package/src/contexts/DialogsProvider.tsx +2 -2
  158. package/src/{components/FireCMSAppBar.tsx → core/DefaultAppBar.tsx} +52 -37
  159. package/src/core/DefaultDrawer.tsx +177 -0
  160. package/src/core/DrawerNavigationItem.tsx +64 -0
  161. package/src/core/EntityEditView.tsx +702 -137
  162. package/src/core/EntitySidePanel.tsx +1 -2
  163. package/src/core/FireCMS.tsx +39 -44
  164. package/src/core/NavigationRoutes.tsx +7 -8
  165. package/src/core/SideDialogs.tsx +4 -0
  166. package/src/core/field_configs.tsx +4 -5
  167. package/src/core/index.tsx +3 -4
  168. package/src/form/PropertyFieldBinding.tsx +53 -21
  169. package/src/form/components/CustomIdField.tsx +4 -2
  170. package/src/form/components/FieldHelperText.tsx +4 -4
  171. package/src/form/components/LabelWithIcon.tsx +27 -19
  172. package/src/form/components/LabelWithIconAndTooltip.tsx +28 -0
  173. package/src/form/components/StorageItemPreview.tsx +21 -11
  174. package/src/form/components/StorageUploadProgress.tsx +3 -4
  175. package/src/form/components/index.tsx +1 -0
  176. package/src/form/field_bindings/ArrayCustomShapedFieldBinding.tsx +15 -11
  177. package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +26 -21
  178. package/src/form/field_bindings/BlockFieldBinding.tsx +13 -12
  179. package/src/form/field_bindings/DateTimeFieldBinding.tsx +17 -14
  180. package/src/form/field_bindings/KeyValueFieldBinding.tsx +52 -46
  181. package/src/form/field_bindings/MapFieldBinding.tsx +15 -15
  182. package/src/form/field_bindings/MarkdownEditorFieldBinding.tsx +138 -0
  183. package/src/form/field_bindings/MultiSelectBinding.tsx +9 -5
  184. package/src/form/field_bindings/ReadOnlyFieldBinding.tsx +11 -16
  185. package/src/form/field_bindings/ReferenceFieldBinding.tsx +37 -27
  186. package/src/form/field_bindings/RepeatFieldBinding.tsx +20 -16
  187. package/src/form/field_bindings/SelectFieldBinding.tsx +47 -41
  188. package/src/form/field_bindings/StorageUploadFieldBinding.tsx +31 -52
  189. package/src/form/field_bindings/SwitchFieldBinding.tsx +9 -5
  190. package/src/form/field_bindings/TextFieldBinding.tsx +26 -22
  191. package/src/form/index.tsx +6 -6
  192. package/src/form/validation.ts +1 -17
  193. package/src/hooks/data/save.ts +6 -1
  194. package/src/hooks/data/useDataSource.tsx +1 -1
  195. package/src/hooks/index.tsx +1 -0
  196. package/src/hooks/useBuildLocalConfigurationPersistence.tsx +8 -10
  197. package/src/hooks/useBuildModeController.tsx +11 -5
  198. package/src/hooks/useBuildNavigationController.tsx +94 -32
  199. package/src/hooks/useProjectLog.tsx +19 -8
  200. package/src/hooks/useResolvedNavigationFrom.tsx +1 -1
  201. package/src/hooks/useValidateAuthenticator.tsx +21 -41
  202. package/src/index.ts +1 -0
  203. package/src/internal/useBuildDataSource.ts +84 -62
  204. package/src/internal/useBuildSideEntityController.tsx +90 -21
  205. package/src/internal/useUnsavedChangesDialog.tsx +3 -1
  206. package/src/preview/PropertyPreview.tsx +10 -17
  207. package/src/preview/PropertyPreviewProps.tsx +7 -1
  208. package/src/preview/components/BooleanPreview.tsx +2 -2
  209. package/src/preview/components/EnumValuesChip.tsx +2 -2
  210. package/src/preview/components/ImagePreview.tsx +24 -34
  211. package/src/preview/components/ReferencePreview.tsx +23 -23
  212. package/src/preview/components/StorageThumbnail.tsx +5 -1
  213. package/src/preview/components/UrlComponentPreview.tsx +44 -11
  214. package/src/preview/property_previews/ArrayOfMapsPreview.tsx +0 -1
  215. package/src/preview/property_previews/ArrayOfReferencesPreview.tsx +3 -2
  216. package/src/preview/property_previews/ArrayOfStorageComponentsPreview.tsx +1 -2
  217. package/src/preview/property_previews/ArrayOfStringsPreview.tsx +0 -1
  218. package/src/preview/property_previews/ArrayOneOfPreview.tsx +3 -4
  219. package/src/preview/property_previews/ArrayPropertyPreview.tsx +3 -4
  220. package/src/preview/property_previews/MapPropertyPreview.tsx +6 -6
  221. package/src/preview/property_previews/SkeletonPropertyComponent.tsx +2 -2
  222. package/src/preview/property_previews/StringPropertyPreview.tsx +3 -3
  223. package/src/preview/util.ts +2 -2
  224. package/src/types/auth.tsx +3 -3
  225. package/src/types/collections.ts +48 -7
  226. package/src/types/customization_controller.tsx +0 -1
  227. package/src/types/datasource.ts +53 -39
  228. package/src/types/entities.ts +11 -1
  229. package/src/types/entity_actions.tsx +16 -3
  230. package/src/types/fields.tsx +49 -43
  231. package/src/types/index.ts +0 -1
  232. package/src/types/navigation.ts +7 -7
  233. package/src/types/plugins.tsx +16 -6
  234. package/src/types/properties.ts +37 -20
  235. package/src/types/storage.ts +12 -3
  236. package/src/util/entities.ts +5 -4
  237. package/src/util/enums.ts +1 -1
  238. package/src/util/icon_list.ts +15 -10
  239. package/src/util/icon_synonyms.ts +3 -99
  240. package/src/util/index.ts +1 -0
  241. package/src/util/navigation_utils.ts +6 -6
  242. package/src/util/objects.ts +25 -28
  243. package/src/util/permissions.ts +1 -0
  244. package/src/util/plurals.ts +0 -2
  245. package/src/util/references.ts +3 -0
  246. package/src/util/resolutions.ts +44 -39
  247. package/src/util/storage.ts +76 -22
  248. package/src/util/strings.ts +2 -2
  249. package/src/util/useStorageUploadController.tsx +22 -4
  250. package/src/util/useTraceUpdate.tsx +1 -0
  251. package/dist/components/PropertyIdCopyTooltipContent.d.ts +0 -3
  252. package/dist/components/VirtualTable/common.d.ts +0 -2
  253. package/dist/core/Drawer.d.ts +0 -23
  254. package/dist/core/Scaffold.d.ts +0 -55
  255. package/dist/core/SideEntityView.d.ts +0 -7
  256. package/dist/form/EntityForm.d.ts +0 -77
  257. package/dist/form/field_bindings/MarkdownFieldBinding.d.ts +0 -9
  258. package/dist/internal/useBuildCustomizationController.d.ts +0 -2
  259. package/dist/internal/useLocaleConfig.d.ts +0 -1
  260. package/dist/types/appcheck.d.ts +0 -26
  261. package/src/components/PropertyIdCopyTooltipContent.tsx +0 -28
  262. package/src/core/Drawer.tsx +0 -191
  263. package/src/core/Scaffold.tsx +0 -281
  264. package/src/core/SideEntityView.tsx +0 -38
  265. package/src/form/EntityForm.tsx +0 -728
  266. package/src/form/field_bindings/MarkdownFieldBinding.tsx +0 -695
  267. package/src/internal/useBuildCustomizationController.tsx +0 -5
  268. package/src/internal/useLocaleConfig.tsx +0 -18
  269. package/src/types/appcheck.ts +0 -29
@@ -3,7 +3,7 @@ import { FieldProps, Properties, ResolvedProperties } from "../../types";
3
3
 
4
4
  import { ErrorBoundary } from "../../components";
5
5
  import { getIconForProperty, isHidden, pick } from "../../util";
6
- import { FieldHelperText, LabelWithIcon } from "../components";
6
+ import { FieldHelperText, LabelWithIconAndTooltip } from "../components";
7
7
  import { PropertyFieldBinding } from "../PropertyFieldBinding";
8
8
  import { ExpandablePanel, InputLabel, Select, SelectItem } from "@firecms/ui";
9
9
 
@@ -21,9 +21,7 @@ export function MapFieldBinding({
21
21
  error,
22
22
  disabled,
23
23
  property,
24
- setValue,
25
- partOfBlock,
26
- tableMode,
24
+ minimalistView,
27
25
  includeDescription,
28
26
  underlyingValueHasChanged,
29
27
  autoFocus,
@@ -63,11 +61,11 @@ export function MapFieldBinding({
63
61
  includeDescription,
64
62
  underlyingValueHasChanged,
65
63
  context,
66
- tableMode: false,
67
64
  partOfArray: false,
68
- partOfBlock: false,
65
+ minimalistView: false,
69
66
  autoFocus: autoFocus && index === 0
70
67
  };
68
+
71
69
  return (
72
70
  <div key={`map-${propertyKey}-${index}`}>
73
71
  <ErrorBoundary>
@@ -85,23 +83,25 @@ export function MapFieldBinding({
85
83
  </>;
86
84
 
87
85
  const title = (
88
- <LabelWithIcon icon={getIconForProperty(property, "small")}
89
- required={property.validation?.required}
90
- title={property.name}
91
- className={"text-text-secondary dark:text-text-secondary-dark"}/>
86
+ <LabelWithIconAndTooltip
87
+ propertyKey={propertyKey}
88
+ icon={getIconForProperty(property, "small")}
89
+ required={property.validation?.required}
90
+ title={property.name}
91
+ className={"text-text-secondary dark:text-text-secondary-dark"}/>
92
92
  );
93
93
 
94
94
  return (
95
95
  <ErrorBoundary>
96
96
 
97
- {!tableMode && !partOfBlock && <ExpandablePanel initiallyExpanded={expanded}
98
- className={"px-2 md:px-4 pb-2 md:pb-4 pt-1 md:pt-2 bg-slate-50 bg-opacity-50 dark:bg-gray-900"}
99
- title={title}>{mapFormView}</ExpandablePanel>}
97
+ {!minimalistView && !minimalistView && <ExpandablePanel initiallyExpanded={expanded}
98
+ className={"px-2 md:px-4 pb-2 md:pb-4 pt-1 md:pt-2 bg-slate-50 bg-opacity-50 dark:bg-gray-900"}
99
+ title={title}>{mapFormView}</ExpandablePanel>}
100
100
 
101
- {(tableMode || partOfBlock) && mapFormView}
101
+ {(minimalistView || minimalistView) && mapFormView}
102
102
 
103
103
  <FieldHelperText includeDescription={includeDescription}
104
- showError={showError}
104
+ showError={showError ?? false}
105
105
  error={error ? (typeof error === "string" ? error : "A property of this map has an error") : undefined}
106
106
  disabled={disabled}
107
107
  property={property}/>
@@ -0,0 +1,138 @@
1
+ import React, { useCallback, useEffect, useRef, useState } from "react";
2
+ import {
3
+ FieldHelperText,
4
+ FieldProps,
5
+ getIconForProperty,
6
+ LabelWithIconAndTooltip,
7
+ randomString,
8
+ useStorageSource
9
+ } from "../../index";
10
+ import { cls, fieldBackgroundHoverMixin, fieldBackgroundMixin } from "@firecms/ui";
11
+ import { FireCMSEditor, FireCMSEditorProps } from "@firecms/editor";
12
+ import { resolveStorageFilenameString, resolveStoragePathString } from "../../util";
13
+
14
+ interface MarkdownEditorFieldProps {
15
+ highlight?: { from: number, to: number };
16
+ editorProps?: Partial<FireCMSEditorProps>
17
+ }
18
+
19
+ export function MarkdownEditorFieldBinding({
20
+ property,
21
+ propertyKey,
22
+ value,
23
+ setValue,
24
+ includeDescription,
25
+ showError,
26
+ error,
27
+ minimalistView,
28
+ isSubmitting,
29
+ context,
30
+ customProps,
31
+ }: FieldProps<string, MarkdownEditorFieldProps>) {
32
+
33
+ const highlight = customProps?.highlight;
34
+ const editorProps = customProps?.editorProps;
35
+ const storageSource = useStorageSource();
36
+ const storage = property.storage;
37
+
38
+ const entityValues = context.values;
39
+ const entityId = context.entityId;
40
+ const path = context.path;
41
+
42
+ // const fieldVersion = useRef(0);
43
+ const [fieldVersion, setFieldVersion] = useState(0);
44
+ const internalValue = useRef(value);
45
+
46
+ const onContentChange = useCallback((content: string) => {
47
+ internalValue.current = content;
48
+ setValue(content);
49
+ }, [setValue]);
50
+
51
+ useEffect(() => {
52
+ if (internalValue.current !== value) {
53
+ internalValue.current = value;
54
+ setFieldVersion(fieldVersion + 1);
55
+ // fieldVersion.current = fieldVersion.current + 1;
56
+ }
57
+ }, [value]);
58
+
59
+ const fileNameBuilder = useCallback(async (file: File) => {
60
+ if (storage?.fileName) {
61
+ const fileName = await resolveStorageFilenameString({
62
+ input: storage.fileName,
63
+ storage,
64
+ values: entityValues,
65
+ entityId,
66
+ path,
67
+ property,
68
+ file,
69
+ propertyKey
70
+ });
71
+ if (!fileName || fileName.length === 0) {
72
+ throw Error("You need to return a valid filename");
73
+ }
74
+ return fileName;
75
+ }
76
+ return randomString() + "_" + file.name;
77
+ }, [entityId, entityValues, path, property, propertyKey, storage]);
78
+
79
+ const storagePathBuilder = useCallback((file: File) => {
80
+ if (!storage) return "/";
81
+ return resolveStoragePathString({
82
+ input: storage.storagePath,
83
+ storage,
84
+ values: entityValues,
85
+ entityId,
86
+ path,
87
+ property,
88
+ file,
89
+ propertyKey
90
+ }) ?? "/";
91
+ }, [entityId, entityValues, path, property, propertyKey, storage]);
92
+
93
+ const editor = <FireCMSEditor
94
+ content={value}
95
+ onMarkdownContentChange={onContentChange}
96
+ version={context.formex.version + fieldVersion}
97
+ highlight={highlight}
98
+ handleImageUpload={async (file: File) => {
99
+ const storagePath = storagePathBuilder(file);
100
+ const fileName = await fileNameBuilder(file);
101
+ const result = await storageSource.uploadFile({
102
+ file,
103
+ fileName,
104
+ path: storagePath,
105
+ });
106
+ const downloadConfig = await storageSource.getDownloadURL(result.path);
107
+ const url = downloadConfig.url;
108
+ if (!url) {
109
+ throw new Error("Error uploading image");
110
+ }
111
+ return url;
112
+ }}
113
+ {...editorProps}
114
+ />;
115
+
116
+ if (minimalistView)
117
+ return editor;
118
+
119
+ return (
120
+ <>
121
+ <LabelWithIconAndTooltip
122
+ propertyKey={propertyKey}
123
+ icon={getIconForProperty(property, "small")}
124
+ required={property.validation?.required}
125
+ title={property.name}
126
+ className={"text-text-secondary dark:text-text-secondary-dark ml-3.5"}/>
127
+ <div className={cls("rounded-md", fieldBackgroundMixin, fieldBackgroundHoverMixin)}>
128
+ {editor}
129
+ </div>
130
+ <FieldHelperText includeDescription={includeDescription}
131
+ showError={showError}
132
+ error={error}
133
+ property={property}/>
134
+ </>
135
+
136
+ );
137
+
138
+ }
@@ -1,7 +1,7 @@
1
1
  import React, { useCallback } from "react";
2
2
 
3
3
  import { EnumType, FieldProps, ResolvedProperty } from "../../types";
4
- import { FieldHelperText, LabelWithIcon } from "../components";
4
+ import { FieldHelperText, LabelWithIconAndTooltip } from "../components";
5
5
  import { EnumValuesChip } from "../../preview";
6
6
  import { enumToObjectEntries, getIconForProperty, getLabelOrConfigFrom } from "../../util";
7
7
  import { CloseIcon, MultiSelect, MultiSelectItem } from "@firecms/ui";
@@ -23,6 +23,7 @@ export function MultiSelectBinding({
23
23
  disabled,
24
24
  property,
25
25
  includeDescription,
26
+ size = "medium",
26
27
  autoFocus
27
28
  }: FieldProps<EnumType[], any, any>) {
28
29
 
@@ -81,12 +82,15 @@ export function MultiSelectBinding({
81
82
  return (
82
83
  <div className="mt-0.5 ml-0.5 mt-2">
83
84
  <MultiSelect
85
+ size={size === "medium" ? "medium" : "small"}
84
86
  value={validValue ? value.map((v) => v.toString()) : []}
85
87
  disabled={disabled}
86
- label={<LabelWithIcon icon={getIconForProperty(property, "small")}
87
- required={property.validation?.required}
88
- title={property.name}
89
- className={"text-text-secondary dark:text-text-secondary-dark ml-3.5"}/>}
88
+ label={<LabelWithIconAndTooltip
89
+ propertyKey={propertyKey}
90
+ icon={getIconForProperty(property, "small")}
91
+ required={property.validation?.required}
92
+ title={property.name}
93
+ className={"text-text-secondary dark:text-text-secondary-dark ml-3.5"}/>}
90
94
  renderValue={useCallback((v: string) => renderValue(v, false), [renderValue])}
91
95
  onMultiValueChange={(updatedValue: string[]) => {
92
96
  let newValue: EnumType[] | null;
@@ -1,12 +1,12 @@
1
1
  import React from "react";
2
2
 
3
- import { Entity, FieldProps } from "../../types";
3
+ import { FieldProps } from "../../types";
4
4
 
5
5
  import { PropertyPreview } from "../../preview";
6
- import { FieldHelperText, LabelWithIcon } from "../components";
6
+ import { FieldHelperText, LabelWithIconAndTooltip } from "../components";
7
7
  import { ErrorBoundary } from "../../components";
8
8
  import { getIconForProperty } from "../../util";
9
- import { cn, paperMixin } from "@firecms/ui";
9
+ import { cls, paperMixin } from "@firecms/ui";
10
10
 
11
11
  /**
12
12
  *
@@ -21,7 +21,7 @@ export function ReadOnlyFieldBinding({
21
21
  value,
22
22
  error,
23
23
  showError,
24
- tableMode,
24
+ minimalistView,
25
25
  property,
26
26
  includeDescription,
27
27
  context
@@ -30,30 +30,25 @@ export function ReadOnlyFieldBinding({
30
30
  if (!context.entityId)
31
31
  throw new Error("ReadOnlyFieldBinding: Entity id is null");
32
32
 
33
- const entity: Entity<any> = {
34
- id: context.entityId!,
35
- values: context.values,
36
- path: context.path
37
- };
38
-
39
33
  return (
40
34
 
41
35
  <>
42
36
 
43
- {!tableMode && <LabelWithIcon icon={getIconForProperty(property, "small")}
44
- required={property.validation?.required}
45
- title={property.name}
46
- className={"text-text-secondary dark:text-text-secondary-dark ml-3.5"}/>
37
+ {!minimalistView && <LabelWithIconAndTooltip
38
+ propertyKey={propertyKey}
39
+ icon={getIconForProperty(property, "small")}
40
+ required={property.validation?.required}
41
+ title={property.name}
42
+ className={"text-text-secondary dark:text-text-secondary-dark ml-3.5"}/>
47
43
  }
48
44
 
49
45
  <div
50
- className={cn(paperMixin, "min-h-14 p-4 md:p-6 overflow-x-scroll no-scrollbar")}>
46
+ className={cls(paperMixin, "min-h-14 p-4 md:p-6 overflow-x-scroll no-scrollbar")}>
51
47
 
52
48
  <ErrorBoundary>
53
49
  <PropertyPreview propertyKey={propertyKey}
54
50
  value={value}
55
51
  property={property}
56
- // entity={entity}
57
52
  size={"medium"}/>
58
53
  </ErrorBoundary>
59
54
 
@@ -3,12 +3,13 @@ import React, { useCallback, useMemo } from "react";
3
3
  import { Entity, EntityCollection, EntityReference, FieldProps } from "../../types";
4
4
  import { useNavigationController, useReferenceDialog } from "../../hooks";
5
5
  import { ReadOnlyFieldBinding } from "./ReadOnlyFieldBinding";
6
- import { FieldHelperText, LabelWithIcon } from "../components";
6
+ import { FieldHelperText, LabelWithIconAndTooltip } from "../components";
7
7
  import { ErrorView } from "../../components";
8
- import { ReferencePreview } from "../../preview";
8
+ import { EmptyValue, ReferencePreview } from "../../preview";
9
9
  import { getIconForProperty, getReferenceFrom } from "../../util";
10
- import { Button } from "@firecms/ui";
11
10
  import { useClearRestoreValue } from "../useClearRestoreValue";
11
+ import { EntityPreviewContainer } from "../../components/EntityPreview";
12
+ import { cls } from "@firecms/ui";
12
13
 
13
14
  /**
14
15
  * Field that opens a reference selection dialog.
@@ -27,19 +28,21 @@ export function ReferenceFieldBinding<M extends Record<string, any>>(props: Fiel
27
28
 
28
29
  }
29
30
 
30
- function ReferenceFieldBindingInternal<M extends Record<string, any>>({
31
- value,
32
- setValue,
33
- error,
34
- showError,
35
- isSubmitting,
36
- disabled,
37
- touched,
38
- autoFocus,
39
- property,
40
- includeDescription,
41
- context
42
- }: FieldProps<EntityReference>) {
31
+ function ReferenceFieldBindingInternal({
32
+ propertyKey,
33
+ value,
34
+ setValue,
35
+ error,
36
+ showError,
37
+ isSubmitting,
38
+ disabled,
39
+ minimalistView,
40
+ touched,
41
+ autoFocus,
42
+ property,
43
+ includeDescription,
44
+ size = "medium"
45
+ }: FieldProps<EntityReference>) {
43
46
  if (!property.path) {
44
47
  throw new Error("Property path is required for ReferenceFieldBinding");
45
48
  }
@@ -82,10 +85,12 @@ function ReferenceFieldBindingInternal<M extends Record<string, any>>({
82
85
 
83
86
  return (
84
87
  <>
85
- <LabelWithIcon icon={getIconForProperty(property, "small")}
86
- required={property.validation?.required}
87
- title={property.name}
88
- className={"text-text-secondary dark:text-text-secondary-dark ml-3.5"}/>
88
+ {!minimalistView && <LabelWithIconAndTooltip
89
+ propertyKey={propertyKey}
90
+ icon={getIconForProperty(property, "small")}
91
+ required={property.validation?.required}
92
+ title={property.name}
93
+ className={"text-text-secondary dark:text-text-secondary-dark ml-3.5"}/>}
89
94
 
90
95
  {!collection && <ErrorView
91
96
  error={"The specified collection does not exist. Check console"}/>}
@@ -96,18 +101,23 @@ function ReferenceFieldBindingInternal<M extends Record<string, any>>({
96
101
  disabled={!property.path}
97
102
  previewProperties={property.previewProperties}
98
103
  hover={!disabled}
99
- size={"medium"}
104
+ size={size}
100
105
  onClick={disabled || isSubmitting ? undefined : onEntryClick}
101
106
  reference={value}
107
+ includeEntityLink={property.includeEntityLink}
108
+ includeId={property.includeId}
102
109
  />}
103
110
 
104
111
  {!value && <div className="justify-center text-left">
105
- <Button variant="outlined"
106
- color="primary"
107
- disabled={disabled || isSubmitting}
108
- onClick={onEntryClick}>
109
- Edit {property.name}
110
- </Button>
112
+ <EntityPreviewContainer className={cls("px-6 h-16 text-sm font-medium flex items-center gap-6",
113
+ disabled || isSubmitting
114
+ ? "text-slate-500"
115
+ : "cursor-pointer text-slate-700 dark:text-slate-300 hover:bg-slate-50 dark:hover:bg-gray-800 group-hover:bg-slate-50 dark:group-hover:bg-gray-800")}
116
+ onClick={onEntryClick}
117
+ size={"medium"}>
118
+ <EmptyValue/>
119
+ {`Edit ${property.name}`.toUpperCase()}
120
+ </EntityPreviewContainer>
111
121
  </div>}
112
122
  </>}
113
123
 
@@ -1,10 +1,10 @@
1
1
  import React, { useState } from "react";
2
2
  import { CMSType, FieldProps, ResolvedProperty } from "../../types";
3
- import { FieldHelperText, FormikArrayContainer, LabelWithIcon } from "../components";
3
+ import { FieldHelperText, FormikArrayContainer, LabelWithIconAndTooltip } from "../components";
4
4
  import { ErrorBoundary } from "../../components";
5
- import { getIconForProperty } from "../../util";
5
+ import { getDefaultValueFor, getIconForProperty } from "../../util";
6
6
  import { PropertyFieldBinding } from "../PropertyFieldBinding";
7
- import { ExpandablePanel } from "@firecms/ui";
7
+ import { ExpandablePanel, Typography } from "@firecms/ui";
8
8
  import { useClearRestoreValue } from "../useClearRestoreValue";
9
9
 
10
10
  /**
@@ -23,7 +23,7 @@ export function RepeatFieldBinding<T extends Array<any>>({
23
23
  isSubmitting,
24
24
  setValue,
25
25
  setFieldValue,
26
- tableMode,
26
+ minimalistView,
27
27
  property,
28
28
  includeDescription,
29
29
  underlyingValueHasChanged,
@@ -57,13 +57,12 @@ export function RepeatFieldBinding<T extends Array<any>>({
57
57
  includeDescription,
58
58
  underlyingValueHasChanged,
59
59
  context,
60
- tableMode: false,
61
60
  partOfArray: true,
62
- partOfBlock: false,
61
+ minimalistView: false,
63
62
  autoFocus: internalId === lastAddedId
64
63
  };
65
64
  return <ErrorBoundary>
66
- <PropertyFieldBinding {...fieldProps}/>
65
+ <PropertyFieldBinding {...fieldProps} index={index}/>
67
66
  </ErrorBoundary>;
68
67
  };
69
68
 
@@ -75,24 +74,29 @@ export function RepeatFieldBinding<T extends Array<any>>({
75
74
  onInternalIdAdded={setLastAddedId}
76
75
  disabled={isSubmitting || Boolean(property.disabled)}
77
76
  includeAddButton={!property.disabled}
78
- newDefaultEntry={property.of.defaultValue}/>;
77
+ newDefaultEntry={getDefaultValueFor(property.of)}/>;
79
78
 
80
- const title = (<LabelWithIcon icon={getIconForProperty(property, "small")}
81
- required={property.validation?.required}
82
- title={property.name}
83
- className={"text-text-secondary dark:text-text-secondary-dark"}/>);
79
+ const title = (<>
80
+ <LabelWithIconAndTooltip
81
+ propertyKey={propertyKey}
82
+ icon={getIconForProperty(property, "small")}
83
+ required={property.validation?.required}
84
+ title={property.name}
85
+ className={"flex flex-grow text-text-secondary dark:text-text-secondary-dark"}/>
86
+ {Array.isArray(value) && <Typography variant={"caption"} className={"px-4"}>({value.length})</Typography>}
87
+ </>);
84
88
 
85
89
  return (
86
90
 
87
91
  <>
88
92
 
89
- {!tableMode && <ExpandablePanel initiallyExpanded={expanded}
90
- className={"px-2 md:px-4 pb-2 md:pb-4 pt-1 md:pt-2"}
91
- title={title}>
93
+ {!minimalistView && <ExpandablePanel initiallyExpanded={expanded}
94
+ className={"px-2 md:px-4 pb-2 md:pb-4 pt-1 md:pt-2"}
95
+ title={title}>
92
96
  {arrayContainer}
93
97
  </ExpandablePanel>}
94
98
 
95
- {tableMode && arrayContainer}
99
+ {minimalistView && arrayContainer}
96
100
 
97
101
  <FieldHelperText includeDescription={includeDescription}
98
102
  showError={showError}
@@ -4,8 +4,9 @@ import { EnumType, FieldProps } from "../../types";
4
4
  import { FieldHelperText, LabelWithIcon } from "../components";
5
5
  import { EnumValuesChip } from "../../preview";
6
6
  import { getIconForProperty } from "../../util";
7
- import { ClearIcon, cn, IconButton, Select, SelectItem } from "@firecms/ui";
7
+ import { ClearIcon, cls, IconButton, Select, SelectItem } from "@firecms/ui";
8
8
  import { useClearRestoreValue } from "../useClearRestoreValue";
9
+ import { PropertyIdCopyTooltip } from "../../components";
9
10
 
10
11
  type SelectProps<T extends EnumType> = FieldProps<T>;
11
12
 
@@ -27,7 +28,8 @@ export function SelectFieldBinding<T extends EnumType>({
27
28
  autoFocus,
28
29
  touched,
29
30
  property,
30
- includeDescription
31
+ includeDescription,
32
+ size = "medium"
31
33
  }: SelectProps<T>) {
32
34
 
33
35
  const enumValues = property.enumValues;
@@ -47,46 +49,50 @@ export function SelectFieldBinding<T extends EnumType>({
47
49
  return (
48
50
  <>
49
51
 
50
- <Select
51
- value={value ? value.toString() : ""}
52
- disabled={disabled}
53
- position="item-aligned"
54
- inputClassName={cn("w-full")}
55
- label={<LabelWithIcon icon={getIconForProperty(property, "small")}
56
- required={property.validation?.required}
57
- title={property.name}
58
- className={"text-text-secondary dark:text-text-secondary-dark ml-3.5"}
59
- />}
60
- endAdornment={
61
- property.clearable && <IconButton
62
- onClick={handleClearClick}>
63
- <ClearIcon/>
64
- </IconButton>
65
- }
66
- onValueChange={(updatedValue: string) => {
67
- const newValue = updatedValue
68
- ? (property.dataType === "number" ? parseFloat(updatedValue) : updatedValue)
69
- : null;
70
- return setValue(newValue as T);
71
- }}
72
- renderValue={(enumKey: any) => {
73
- return <EnumValuesChip
74
- enumKey={enumKey}
75
- enumValues={enumValues}
76
- size={"medium"}/>;
77
- }}
78
- >
79
- {enumValues && enumValues.map((option) => {
80
- return <SelectItem
81
- key={option.id}
82
- value={String(option.id)}>
83
- <EnumValuesChip
84
- enumKey={String(option.id)}
52
+ <PropertyIdCopyTooltip propertyKey={propertyKey}>
53
+ <Select
54
+ size={size === "medium" ? "medium" : "small"}
55
+ value={value !== undefined && value != null ? value.toString() : ""}
56
+ disabled={disabled}
57
+ position="item-aligned"
58
+ inputClassName={cls("w-full")}
59
+ label={<LabelWithIcon
60
+ icon={getIconForProperty(property, "small")}
61
+ required={property.validation?.required}
62
+ title={property.name}
63
+ className={"text-text-secondary dark:text-text-secondary-dark ml-3.5"}
64
+ />}
65
+ endAdornment={
66
+ property.clearable && <IconButton
67
+ onClick={handleClearClick}>
68
+ <ClearIcon/>
69
+ </IconButton>
70
+ }
71
+ onValueChange={(updatedValue: string) => {
72
+ const newValue = updatedValue
73
+ ? (property.dataType === "number" ? parseFloat(updatedValue) : updatedValue)
74
+ : null;
75
+ return setValue(newValue as T);
76
+ }}
77
+ renderValue={(enumKey: any) => {
78
+ return <EnumValuesChip
79
+ enumKey={enumKey}
85
80
  enumValues={enumValues}
86
- size={"medium"}/>
87
- </SelectItem>
88
- })}
89
- </Select>
81
+ size={size}/>;
82
+ }}
83
+ >
84
+ {enumValues && enumValues.map((option) => {
85
+ return <SelectItem
86
+ key={option.id}
87
+ value={String(option.id)}>
88
+ <EnumValuesChip
89
+ enumKey={String(option.id)}
90
+ enumValues={enumValues}
91
+ size={size}/>
92
+ </SelectItem>
93
+ })}
94
+ </Select>
95
+ </PropertyIdCopyTooltip>
90
96
 
91
97
  <FieldHelperText includeDescription={includeDescription}
92
98
  showError={showError}