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

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 (190) hide show
  1. package/dist/app/Drawer.d.ts +1 -1
  2. package/dist/app/Scaffold.d.ts +1 -1
  3. package/dist/components/ArrayContainer.d.ts +2 -1
  4. package/dist/components/CircularProgressCenter.d.ts +1 -1
  5. package/dist/components/EntityCollectionTable/EntityCollectionRowActions.d.ts +0 -1
  6. package/dist/components/EntityCollectionTable/fields/TableReferenceField.d.ts +1 -1
  7. package/dist/components/EntityCollectionTable/internal/popup_field/PopupFormField.d.ts +1 -1
  8. package/dist/components/EntityCollectionView/EntityCollectionView.d.ts +1 -1
  9. package/dist/components/EntityPreview.d.ts +1 -1
  10. package/dist/components/ErrorView.d.ts +1 -1
  11. package/dist/components/HomePage/DefaultHomePage.d.ts +1 -1
  12. package/dist/components/HomePage/NavigationCardBinding.d.ts +1 -1
  13. package/dist/components/PropertyIdCopyTooltip.d.ts +8 -0
  14. package/dist/components/VirtualTable/VirtualTableProps.d.ts +10 -6
  15. package/dist/components/common/useColumnsIds.d.ts +2 -1
  16. package/dist/components/index.d.ts +1 -0
  17. package/dist/core/DefaultAppBar.d.ts +1 -1
  18. package/dist/core/DefaultDrawer.d.ts +1 -1
  19. package/dist/core/DrawerNavigationItem.d.ts +2 -1
  20. package/dist/core/EntityEditView.d.ts +3 -3
  21. package/dist/core/FireCMS.d.ts +1 -1
  22. package/dist/core/NavigationRoutes.d.ts +1 -1
  23. package/dist/form/PropertyFieldBinding.d.ts +1 -1
  24. package/dist/form/components/FormikArrayContainer.d.ts +2 -1
  25. package/dist/form/components/LabelWithIcon.d.ts +1 -1
  26. package/dist/form/components/LabelWithIconAndTooltip.d.ts +15 -0
  27. package/dist/form/components/index.d.ts +1 -0
  28. package/dist/form/field_bindings/ArrayCustomShapedFieldBinding.d.ts +1 -1
  29. package/dist/form/field_bindings/ArrayOfReferencesFieldBinding.d.ts +1 -1
  30. package/dist/form/field_bindings/BlockFieldBinding.d.ts +1 -1
  31. package/dist/form/field_bindings/KeyValueFieldBinding.d.ts +1 -1
  32. package/dist/form/field_bindings/MapFieldBinding.d.ts +1 -1
  33. package/dist/form/field_bindings/MarkdownEditorFieldBinding.d.ts +11 -0
  34. package/dist/form/field_bindings/{MultiSelectBinding.d.ts → MultiSelectFieldBinding.d.ts} +1 -1
  35. package/dist/form/field_bindings/ReadOnlyFieldBinding.d.ts +1 -1
  36. package/dist/form/field_bindings/RepeatFieldBinding.d.ts +1 -1
  37. package/dist/form/field_bindings/SelectFieldBinding.d.ts +1 -1
  38. package/dist/form/field_bindings/StorageUploadFieldBinding.d.ts +1 -1
  39. package/dist/form/field_bindings/TextFieldBinding.d.ts +1 -1
  40. package/dist/form/index.d.ts +3 -3
  41. package/dist/form/useClearRestoreValue.d.ts +2 -2
  42. package/dist/hooks/useProjectLog.d.ts +2 -2
  43. package/dist/index.es.js +14127 -11014
  44. package/dist/index.es.js.map +1 -1
  45. package/dist/index.umd.js +19987 -587
  46. package/dist/index.umd.js.map +1 -1
  47. package/dist/preview/PropertyPreviewProps.d.ts +1 -1
  48. package/dist/preview/components/EnumValuesChip.d.ts +1 -1
  49. package/dist/preview/components/ReferencePreview.d.ts +1 -1
  50. package/dist/types/auth.d.ts +1 -1
  51. package/dist/types/collections.d.ts +12 -3
  52. package/dist/types/datasource.d.ts +35 -22
  53. package/dist/types/entities.d.ts +1 -0
  54. package/dist/types/entity_overrides.d.ts +2 -2
  55. package/dist/types/fields.d.ts +20 -15
  56. package/dist/types/navigation.d.ts +1 -0
  57. package/dist/types/properties.d.ts +18 -18
  58. package/dist/types/side_dialogs_controller.d.ts +10 -0
  59. package/dist/types/storage.d.ts +75 -0
  60. package/dist/util/entities.d.ts +1 -1
  61. package/dist/util/icon_list.d.ts +5 -1
  62. package/dist/util/icons.d.ts +1 -0
  63. package/dist/util/index.d.ts +1 -0
  64. package/dist/util/plurals.d.ts +0 -2
  65. package/dist/util/property_utils.d.ts +1 -1
  66. package/dist/util/resolutions.d.ts +15 -1
  67. package/dist/util/storage.d.ts +1 -1
  68. package/dist/util/useStorageUploadController.d.ts +2 -2
  69. package/package.json +15 -17
  70. package/src/app/Drawer.tsx +1 -1
  71. package/src/app/Scaffold.tsx +22 -27
  72. package/src/components/ArrayContainer.tsx +15 -10
  73. package/src/components/CircularProgressCenter.tsx +1 -1
  74. package/src/components/EntityCollectionTable/EntityCollectionRowActions.tsx +4 -9
  75. package/src/components/EntityCollectionTable/EntityCollectionTable.tsx +2 -2
  76. package/src/components/EntityCollectionTable/PropertyTableCell.tsx +4 -2
  77. package/src/components/EntityCollectionTable/fields/TableReferenceField.tsx +21 -14
  78. package/src/components/EntityCollectionTable/fields/TableStorageUpload.tsx +12 -4
  79. package/src/components/EntityCollectionTable/internal/EntityTableCell.tsx +17 -19
  80. package/src/components/EntityCollectionTable/internal/EntityTableCellActions.tsx +19 -7
  81. package/src/components/EntityCollectionTable/internal/popup_field/PopupFormField.tsx +3 -5
  82. package/src/components/EntityCollectionView/EntityCollectionView.tsx +26 -25
  83. package/src/components/EntityCollectionView/useSelectionController.tsx +19 -7
  84. package/src/components/EntityPreview.tsx +30 -31
  85. package/src/components/ErrorView.tsx +1 -1
  86. package/src/components/HomePage/DefaultHomePage.tsx +24 -18
  87. package/src/components/HomePage/NavigationCardBinding.tsx +1 -1
  88. package/src/components/HomePage/SmallNavigationCard.tsx +1 -2
  89. package/src/components/PropertyIdCopyTooltip.tsx +48 -0
  90. package/src/components/ReferenceTable/ReferenceSelectionTable.tsx +7 -6
  91. package/src/components/SearchIconsView.tsx +5 -2
  92. package/src/components/SelectableTable/SelectableTable.tsx +2 -4
  93. package/src/components/SelectableTable/filters/DateTimeFilterField.tsx +1 -1
  94. package/src/components/SelectableTable/filters/StringNumberFilterField.tsx +54 -7
  95. package/src/components/VirtualTable/VirtualTable.tsx +33 -9
  96. package/src/components/VirtualTable/VirtualTableCell.tsx +1 -9
  97. package/src/components/VirtualTable/VirtualTableProps.tsx +12 -8
  98. package/src/components/VirtualTable/fields/VirtualTableDateField.tsx +3 -3
  99. package/src/components/VirtualTable/fields/VirtualTableInput.tsx +2 -1
  100. package/src/components/VirtualTable/fields/VirtualTableNumberInput.tsx +2 -1
  101. package/src/components/VirtualTable/fields/VirtualTableSelect.tsx +14 -28
  102. package/src/components/common/useColumnsIds.tsx +13 -0
  103. package/src/components/common/useDataSourceEntityCollectionTableController.tsx +12 -12
  104. package/src/components/common/useTableSearchHelper.ts +1 -0
  105. package/src/components/index.tsx +1 -0
  106. package/src/core/DefaultAppBar.tsx +3 -3
  107. package/src/core/DefaultDrawer.tsx +18 -12
  108. package/src/core/DrawerNavigationItem.tsx +31 -27
  109. package/src/core/EntityEditView.tsx +136 -109
  110. package/src/core/FireCMS.tsx +2 -2
  111. package/src/core/NavigationRoutes.tsx +1 -1
  112. package/src/core/SideDialogs.tsx +1 -0
  113. package/src/core/field_configs.tsx +5 -5
  114. package/src/form/PropertyFieldBinding.tsx +24 -14
  115. package/src/form/components/CustomIdField.tsx +4 -2
  116. package/src/form/components/FieldHelperText.tsx +1 -1
  117. package/src/form/components/FormikArrayContainer.tsx +4 -1
  118. package/src/form/components/LabelWithIcon.tsx +27 -19
  119. package/src/form/components/LabelWithIconAndTooltip.tsx +28 -0
  120. package/src/form/components/StorageItemPreview.tsx +1 -0
  121. package/src/form/components/StorageUploadProgress.tsx +0 -1
  122. package/src/form/components/index.tsx +1 -0
  123. package/src/form/field_bindings/ArrayCustomShapedFieldBinding.tsx +22 -14
  124. package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +24 -22
  125. package/src/form/field_bindings/BlockFieldBinding.tsx +13 -11
  126. package/src/form/field_bindings/DateTimeFieldBinding.tsx +17 -14
  127. package/src/form/field_bindings/KeyValueFieldBinding.tsx +8 -7
  128. package/src/form/field_bindings/MapFieldBinding.tsx +16 -24
  129. package/src/form/field_bindings/MarkdownEditorFieldBinding.tsx +150 -0
  130. package/src/form/field_bindings/{MultiSelectBinding.tsx → MultiSelectFieldBinding.tsx} +25 -20
  131. package/src/form/field_bindings/ReadOnlyFieldBinding.tsx +9 -7
  132. package/src/form/field_bindings/ReferenceFieldBinding.tsx +27 -18
  133. package/src/form/field_bindings/RepeatFieldBinding.tsx +27 -17
  134. package/src/form/field_bindings/SelectFieldBinding.tsx +17 -10
  135. package/src/form/field_bindings/StorageUploadFieldBinding.tsx +36 -17
  136. package/src/form/field_bindings/SwitchFieldBinding.tsx +9 -5
  137. package/src/form/field_bindings/TextFieldBinding.tsx +26 -23
  138. package/src/form/index.tsx +4 -9
  139. package/src/form/useClearRestoreValue.tsx +2 -2
  140. package/src/hooks/data/delete.ts +2 -1
  141. package/src/hooks/data/save.ts +5 -2
  142. package/src/hooks/data/useDataSource.tsx +11 -3
  143. package/src/hooks/useBuildNavigationController.tsx +10 -3
  144. package/src/hooks/useProjectLog.tsx +18 -7
  145. package/src/internal/useBuildDataSource.ts +59 -76
  146. package/src/internal/useBuildSideDialogsController.tsx +1 -0
  147. package/src/internal/useBuildSideEntityController.tsx +17 -4
  148. package/src/internal/useUnsavedChangesDialog.tsx +3 -1
  149. package/src/preview/PropertyPreview.tsx +2 -2
  150. package/src/preview/PropertyPreviewProps.tsx +1 -1
  151. package/src/preview/components/BooleanPreview.tsx +1 -1
  152. package/src/preview/components/EnumValuesChip.tsx +1 -1
  153. package/src/preview/components/ImagePreview.tsx +4 -2
  154. package/src/preview/components/ReferencePreview.tsx +2 -13
  155. package/src/preview/components/UrlComponentPreview.tsx +1 -1
  156. package/src/preview/property_previews/ArrayOfMapsPreview.tsx +1 -1
  157. package/src/preview/property_previews/ArrayOfReferencesPreview.tsx +1 -1
  158. package/src/preview/property_previews/ArrayOfStorageComponentsPreview.tsx +1 -1
  159. package/src/preview/property_previews/ArrayOneOfPreview.tsx +2 -2
  160. package/src/preview/property_previews/ArrayPropertyPreview.tsx +1 -1
  161. package/src/preview/property_previews/MapPropertyPreview.tsx +1 -1
  162. package/src/preview/property_previews/SkeletonPropertyComponent.tsx +2 -2
  163. package/src/preview/property_previews/StringPropertyPreview.tsx +2 -2
  164. package/src/preview/util.ts +2 -2
  165. package/src/types/auth.tsx +1 -1
  166. package/src/types/collections.ts +15 -4
  167. package/src/types/datasource.ts +42 -27
  168. package/src/types/entities.ts +2 -0
  169. package/src/types/entity_overrides.tsx +2 -2
  170. package/src/types/fields.tsx +23 -17
  171. package/src/types/navigation.ts +1 -0
  172. package/src/types/properties.ts +18 -17
  173. package/src/types/side_dialogs_controller.tsx +13 -0
  174. package/src/types/storage.ts +82 -0
  175. package/src/util/entities.ts +1 -1
  176. package/src/util/icon_list.ts +14 -9
  177. package/src/util/icons.tsx +8 -2
  178. package/src/util/index.ts +1 -0
  179. package/src/util/plurals.ts +0 -2
  180. package/src/util/property_utils.tsx +1 -1
  181. package/src/util/references.ts +3 -0
  182. package/src/util/resolutions.ts +43 -11
  183. package/src/util/storage.ts +6 -2
  184. package/src/util/useStorageUploadController.tsx +15 -7
  185. package/dist/components/PropertyIdCopyTooltipContent.d.ts +0 -3
  186. package/dist/form/PropertiesForm.d.ts +0 -8
  187. package/dist/form/field_bindings/MarkdownFieldBinding.d.ts +0 -9
  188. package/src/components/PropertyIdCopyTooltipContent.tsx +0 -27
  189. package/src/form/PropertiesForm.tsx +0 -81
  190. package/src/form/field_bindings/MarkdownFieldBinding.tsx +0 -695
@@ -51,6 +51,13 @@ export const PropertyFieldBinding = React.memo(PropertyFieldBindingInternal, (a:
51
51
  if (a.propertyKey !== b.propertyKey) {
52
52
  return false;
53
53
  }
54
+ if (a.index !== b.index) {
55
+ return false;
56
+ }
57
+
58
+ if (a.size !== b.size) {
59
+ return false;
60
+ }
54
61
  const aIsBuilder = isPropertyBuilder(a.property) || a.property.fromBuilder;
55
62
  const bIsBuilder = isPropertyBuilder(b.property) || b.property.fromBuilder;
56
63
 
@@ -75,10 +82,11 @@ function PropertyFieldBindingInternal<T extends CMSType = CMSType, M extends Rec
75
82
  includeDescription,
76
83
  underlyingValueHasChanged,
77
84
  disabled,
78
- tableMode,
79
85
  partOfArray,
80
- partOfBlock,
86
+ minimalistView,
81
87
  autoFocus,
88
+ index,
89
+ size
82
90
  }: PropertyFieldBindingProps<T, M>): ReactElement<PropertyFieldBindingProps<T, M>> {
83
91
 
84
92
  const customizationController = useCustomizationController();
@@ -97,7 +105,8 @@ function PropertyFieldBindingInternal<T extends CMSType = CMSType, M extends Rec
97
105
  values: fieldProps.form.values,
98
106
  path: context.path,
99
107
  entityId: context.entityId,
100
- fields: customizationController.propertyConfigs
108
+ fields: customizationController.propertyConfigs,
109
+ index
101
110
  });
102
111
 
103
112
  if (resolvedProperty === null || isHidden(resolvedProperty)) {
@@ -120,11 +129,13 @@ function PropertyFieldBindingInternal<T extends CMSType = CMSType, M extends Rec
120
129
  throw new Error(`INTERNAL: Could not find field config for property ${propertyKey}`);
121
130
  }
122
131
  const configProperty = resolveProperty({
132
+ propertyKey,
123
133
  propertyOrBuilder: propertyConfig.property,
124
134
  values: fieldProps.form.values,
125
135
  path: context.path,
126
136
  entityId: context.entityId,
127
- fields: customizationController.propertyConfigs
137
+ fields: customizationController.propertyConfigs,
138
+ index
128
139
  });
129
140
  Component = configProperty.Field as ComponentType<FieldProps<T>>;
130
141
  }
@@ -143,10 +154,10 @@ function PropertyFieldBindingInternal<T extends CMSType = CMSType, M extends Rec
143
154
  underlyingValueHasChanged,
144
155
  context,
145
156
  disabled,
146
- tableMode,
147
157
  partOfArray,
148
- partOfBlock,
149
- autoFocus
158
+ minimalistView,
159
+ autoFocus,
160
+ size
150
161
  };
151
162
 
152
163
  return <FieldInternal
@@ -173,12 +184,12 @@ function FieldInternal<T extends CMSType, CustomProps, M extends Record<string,
173
184
  property,
174
185
  includeDescription,
175
186
  underlyingValueHasChanged,
176
- tableMode,
177
187
  partOfArray,
178
- partOfBlock,
188
+ minimalistView,
179
189
  autoFocus,
180
190
  context,
181
- disabled
191
+ disabled,
192
+ size
182
193
  },
183
194
  fieldProps
184
195
  }:
@@ -225,7 +236,6 @@ function FieldInternal<T extends CMSType, CustomProps, M extends Record<string,
225
236
  const cmsFieldProps: FieldProps<T, CustomProps, M> = {
226
237
  propertyKey,
227
238
  value: value as T,
228
- // initialValue,
229
239
  setValue,
230
240
  setFieldValue,
231
241
  error,
@@ -236,12 +246,12 @@ function FieldInternal<T extends CMSType, CustomProps, M extends Record<string,
236
246
  property: property as ResolvedProperty<T>,
237
247
  disabled: disabled ?? false,
238
248
  underlyingValueHasChanged: underlyingValueHasChanged ?? false,
239
- tableMode: tableMode ?? false,
240
249
  partOfArray: partOfArray ?? false,
241
- partOfBlock: partOfBlock ?? false,
250
+ minimalistView: minimalistView ?? false,
242
251
  autoFocus: autoFocus ?? false,
243
252
  customProps: customFieldProps,
244
- context
253
+ context,
254
+ size
245
255
  };
246
256
 
247
257
  return (
@@ -68,7 +68,8 @@ export function CustomIdField<M extends Record<string, any>>({
68
68
  ? (
69
69
  <>
70
70
 
71
- <Tooltip title={"Copy"}>
71
+ <Tooltip title={"Copy"}
72
+ asChild={true}>
72
73
  <IconButton onClick={(e) => copy(entity.id)}
73
74
  aria-label="copy-id">
74
75
  <ContentCopyIcon size={"small"}/>
@@ -76,7 +77,8 @@ export function CustomIdField<M extends Record<string, any>>({
76
77
  </Tooltip>
77
78
 
78
79
  {customizationController?.entityLinkBuilder &&
79
- <Tooltip title={"Open in the console"}>
80
+ <Tooltip title={"Open in the console"}
81
+ asChild={true}>
80
82
  <IconButton component={"a"}
81
83
  href={customizationController.entityLinkBuilder({ entity })}
82
84
  rel="noopener noreferrer"
@@ -44,7 +44,7 @@ export function FieldHelperText({
44
44
  {property.longDescription &&
45
45
  <Tooltip title={property.longDescription}
46
46
  side="bottom"
47
- >
47
+ asChild={true}>
48
48
  <IconButton
49
49
  size={"small"}
50
50
  className="self-start">
@@ -12,6 +12,7 @@ interface ArrayContainerProps<T> {
12
12
  includeAddButton?: boolean;
13
13
  newDefaultEntry?: T | null;
14
14
  setFieldValue: (field: string, value: any, shouldValidate?: boolean | undefined) => void;
15
+ className?: string;
15
16
  }
16
17
 
17
18
  /**
@@ -27,7 +28,8 @@ export function FormikArrayContainer<T>({
27
28
  onInternalIdAdded,
28
29
  includeAddButton,
29
30
  newDefaultEntry = null,
30
- setFieldValue
31
+ setFieldValue,
32
+ className
31
33
  }: ArrayContainerProps<T>) {
32
34
 
33
35
  return <ArrayContainer droppableId={name}
@@ -39,6 +41,7 @@ export function FormikArrayContainer<T>({
39
41
  onInternalIdAdded={onInternalIdAdded}
40
42
  includeAddButton={includeAddButton}
41
43
  newDefaultEntry={newDefaultEntry}
44
+ className={className}
42
45
  onValueChange={(value) => setFieldValue(name, value)}
43
46
  />;
44
47
  }
@@ -1,4 +1,4 @@
1
- import React from "react";
1
+ import React, { forwardRef } from "react";
2
2
 
3
3
  interface LabelWithIconProps {
4
4
  icon: React.ReactNode;
@@ -12,22 +12,30 @@ interface LabelWithIconProps {
12
12
  * Render the label of with an icon and the title of a property
13
13
  * @group Form custom fields
14
14
  */
15
- export function LabelWithIcon({
16
- icon,
17
- title,
18
- small,
19
- className,
20
- required
21
- }: LabelWithIconProps) {
22
- return (
23
- <span
24
- className={`inline-flex items-center my-0.5 ${small ? "gap-1" : "gap-2"} ${className ?? ""}`}>
25
-
26
- {icon}
27
-
28
- <span
29
- className={`text-start font-medium text-${small ? "base" : "sm"} origin-top-left transform ${small ? "translate-x-2 scale-75" : ""}`}>{(title ?? "") + (required ? " *" : "")}</span>
30
-
15
+ export const LabelWithIcon = forwardRef<HTMLDivElement, LabelWithIconProps>(
16
+ ({
17
+ icon,
18
+ title,
19
+ small,
20
+ className,
21
+ required
22
+ }, ref) => {
23
+ return (
24
+ <div
25
+ ref={ref}
26
+ className={`inline-flex items-center my-0.5 ${small ? "gap-1" : "gap-2"} ${className ?? ""}`}
27
+ >
28
+ {icon}
29
+ <span
30
+ className={`text-start font-medium text-${small ? "base" : "sm"} origin-top-left transform ${
31
+ small ? "translate-x-2 scale-75" : ""
32
+ }`}
33
+ >
34
+ {(title ?? "") + (required ? " *" : "")}
31
35
  </span>
32
- );
33
- }
36
+ </div>
37
+ );
38
+ }
39
+ );
40
+
41
+ LabelWithIcon.displayName = "LabelWithIcon";
@@ -0,0 +1,28 @@
1
+ import React from "react";
2
+ import { LabelWithIcon } from "./LabelWithIcon";
3
+ import { PropertyIdCopyTooltip } from "../../components/PropertyIdCopyTooltip";
4
+
5
+ interface LabelWithIconAndTooltip {
6
+ icon: React.ReactNode;
7
+ title?: string;
8
+ small?: boolean;
9
+ className?: string;
10
+ required?: boolean;
11
+ propertyKey: string
12
+ }
13
+
14
+ /**
15
+ * Render the label of with an icon and the title of a property
16
+ * @group Form custom fields
17
+ */
18
+ export function LabelWithIconAndTooltip({
19
+ propertyKey,
20
+ className,
21
+ ...props
22
+ }: LabelWithIconAndTooltip) {
23
+ return (
24
+ <PropertyIdCopyTooltip propertyKey={propertyKey} className={className}>
25
+ <LabelWithIcon {...props}/>
26
+ </PropertyIdCopyTooltip>
27
+ );
28
+ }
@@ -39,6 +39,7 @@ export function StorageItemPreview({
39
39
  className="absolute rounded-full -top-2 -right-2 z-10 bg-white dark:bg-gray-900">
40
40
 
41
41
  <Tooltip
42
+ asChild={true}
42
43
  title="Remove">
43
44
  <IconButton
44
45
  size={"small"}
@@ -4,7 +4,6 @@ import { useSnackbarController, useStorageSource } from "../../hooks";
4
4
  import { StorageFieldItem } from "../../util/useStorageUploadController";
5
5
  import { ErrorView } from "../../components";
6
6
  import { cls, paperMixin, Skeleton } from "@firecms/ui";
7
- import { EntityCollection, StorageSource } from "../../types";
8
7
 
9
8
  export interface StorageUploadItemProps {
10
9
  storagePath: string;
@@ -1,3 +1,4 @@
1
1
  export * from "./FormikArrayContainer";
2
2
  export * from "./FieldHelperText";
3
3
  export * from "./LabelWithIcon";
4
+ export * from "./LabelWithIconAndTooltip";
@@ -1,9 +1,9 @@
1
1
  import React from "react";
2
2
  import { FieldProps } from "../../types";
3
- import { FieldHelperText, LabelWithIcon } from "../components";
3
+ import { FieldHelperText, LabelWithIconAndTooltip } from "../components";
4
4
  import { PropertyFieldBinding } from "../PropertyFieldBinding";
5
5
  import { ExpandablePanel, Typography } from "@firecms/ui";
6
- import { getIconForProperty } from "../../util";
6
+ import { getArrayResolvedProperties, getIconForProperty } from "../../util";
7
7
  import { useClearRestoreValue } from "../useClearRestoreValue";
8
8
 
9
9
  /**
@@ -20,7 +20,7 @@ export function ArrayCustomShapedFieldBinding<T extends Array<any>>({
20
20
  showError,
21
21
  isSubmitting,
22
22
  setValue,
23
- tableMode,
23
+ minimalistView,
24
24
  property,
25
25
  includeDescription,
26
26
  underlyingValueHasChanged,
@@ -28,8 +28,15 @@ export function ArrayCustomShapedFieldBinding<T extends Array<any>>({
28
28
  disabled
29
29
  }: FieldProps<T, any, any>) {
30
30
 
31
- if (!Array.isArray(property.resolvedProperties))
32
- throw Error("ArrayCustomShapedFieldBinding misconfiguration. Property `of` not set");
31
+ let resolvedProperties = "resolvedProperties" in property ? property.resolvedProperties : undefined;
32
+ if (!resolvedProperties) {
33
+ resolvedProperties = getArrayResolvedProperties({
34
+ propertyValue: value,
35
+ propertyKey,
36
+ property,
37
+ ignoreMissingFields: false
38
+ })
39
+ }
33
40
 
34
41
  const expanded = property.expanded === undefined ? true : property.expanded;
35
42
 
@@ -40,14 +47,16 @@ export function ArrayCustomShapedFieldBinding<T extends Array<any>>({
40
47
  });
41
48
 
42
49
  const title = (<>
43
- <LabelWithIcon icon={getIconForProperty(property, "small")}
44
- required={property.validation?.required}
45
- title={property.name}
46
- className={"flex-grow text-text-secondary dark:text-text-secondary-dark"}/>
50
+ <LabelWithIconAndTooltip
51
+ propertyKey={propertyKey}
52
+ icon={getIconForProperty(property, "small")}
53
+ required={property.validation?.required}
54
+ title={property.name}
55
+ className={"flex-grow text-text-secondary dark:text-text-secondary-dark"}/>
47
56
  {Array.isArray(value) && <Typography variant={"caption"} className={"px-4"}>({value.length})</Typography>}
48
57
  </>);
49
58
 
50
- const body = property.resolvedProperties.map((childProperty, index) => {
59
+ const body = resolvedProperties.map((childProperty, index) => {
51
60
  const fieldProps = {
52
61
  propertyKey: `${propertyKey}[${index}]`,
53
62
  disabled,
@@ -55,9 +64,8 @@ export function ArrayCustomShapedFieldBinding<T extends Array<any>>({
55
64
  includeDescription,
56
65
  underlyingValueHasChanged,
57
66
  context,
58
- tableMode: false,
59
67
  partOfArray: true,
60
- partOfBlock: false,
68
+ minimalistView: false,
61
69
  autoFocus: false
62
70
  };
63
71
  return <div key={`custom_shaped_array_${index}`} className="pb-4">
@@ -69,14 +77,14 @@ export function ArrayCustomShapedFieldBinding<T extends Array<any>>({
69
77
 
70
78
  <>
71
79
 
72
- {!tableMode &&
80
+ {!minimalistView &&
73
81
  <ExpandablePanel initiallyExpanded={expanded}
74
82
  title={title}
75
83
  className={"px-2 md:px-4 pb-2 md:pb-4 pt-1 md:pt-2"}>
76
84
  {body}
77
85
  </ExpandablePanel>}
78
86
 
79
- {tableMode && body}
87
+ {minimalistView && body}
80
88
 
81
89
  <FieldHelperText includeDescription={includeDescription}
82
90
  showError={showError}
@@ -1,7 +1,7 @@
1
1
  import React, { useCallback, useMemo } from "react";
2
2
  import { Entity, EntityCollection, EntityReference, FieldProps, ResolvedProperty } from "../../types";
3
3
  import { ReferencePreview } from "../../preview";
4
- import { FieldHelperText, FormikArrayContainer, LabelWithIcon } from "../components";
4
+ import { FieldHelperText, FormikArrayContainer, LabelWithIconAndTooltip } from "../components";
5
5
  import { ErrorView } from "../../components";
6
6
  import { getIconForProperty, getReferenceFrom } from "../../util";
7
7
 
@@ -25,7 +25,7 @@ export function ArrayOfReferencesFieldBinding({
25
25
  showError,
26
26
  disabled,
27
27
  isSubmitting,
28
- tableMode,
28
+ minimalistView,
29
29
  property,
30
30
  includeDescription,
31
31
  setValue,
@@ -70,35 +70,37 @@ export function ArrayOfReferencesFieldBinding({
70
70
  }
71
71
  );
72
72
 
73
- const onEntryClick = useCallback((e: React.SyntheticEvent) => {
73
+ const onEntryClick = (e: React.SyntheticEvent) => {
74
74
  e.preventDefault();
75
75
  referenceDialogController.open();
76
- }, [referenceDialogController]);
76
+ };
77
77
 
78
78
  const buildEntry = useCallback((index: number, internalId: number) => {
79
79
  const entryValue = value && value.length > index ? value[index] : undefined;
80
80
  if (!entryValue)
81
81
  return <div>Internal ERROR</div>;
82
82
  return (
83
- <ReferencePreview
84
- key={internalId}
85
- disabled={!ofProperty.path}
86
- previewProperties={ofProperty.previewProperties}
87
- size={"medium"}
88
- onClick={onEntryClick}
89
- hover={!disabled}
90
- reference={entryValue}
91
- includeId={ofProperty.includeId}
92
- includeEntityLink={ofProperty.includeEntityLink}
93
- />
83
+ <ReferencePreview
84
+ key={internalId}
85
+ disabled={!ofProperty.path}
86
+ previewProperties={ofProperty.previewProperties}
87
+ size={"medium"}
88
+ onClick={onEntryClick}
89
+ hover={!disabled}
90
+ reference={entryValue}
91
+ includeId={ofProperty.includeId}
92
+ includeEntityLink={ofProperty.includeEntityLink}
93
+ />
94
94
  );
95
95
  }, [ofProperty.path, ofProperty.previewProperties, value]);
96
96
 
97
97
  const title = (<>
98
- <LabelWithIcon icon={getIconForProperty(property, "small")}
99
- required={property.validation?.required}
100
- title={property.name}
101
- className={"flex-grow text-text-secondary dark:text-text-secondary-dark"}/>
98
+ <LabelWithIconAndTooltip
99
+ propertyKey={propertyKey}
100
+ icon={getIconForProperty(property, "small")}
101
+ required={property.validation?.required}
102
+ title={property.name}
103
+ className={"flex flex-grow text-text-secondary dark:text-text-secondary-dark"}/>
102
104
  {Array.isArray(value) && <Typography variant={"caption"} className={"px-4"}>({value.length})</Typography>}
103
105
  </>);
104
106
 
@@ -118,7 +120,7 @@ export function ArrayOfReferencesFieldBinding({
118
120
 
119
121
  <Button
120
122
  className="my-4 justify-center text-left"
121
- variant="outlined"
123
+ variant="text"
122
124
  color="primary"
123
125
  disabled={isSubmitting}
124
126
  onClick={onEntryClick}>
@@ -130,7 +132,7 @@ export function ArrayOfReferencesFieldBinding({
130
132
  return (
131
133
  <>
132
134
 
133
- {!tableMode &&
135
+ {!minimalistView &&
134
136
  <ExpandablePanel
135
137
  titleClassName={fieldBackgroundMixin}
136
138
  className={cls("px-2 md:px-4 pb-2 md:pb-4 pt-1 md:pt-2", fieldBackgroundMixin)}
@@ -139,7 +141,7 @@ export function ArrayOfReferencesFieldBinding({
139
141
  {body}
140
142
  </ExpandablePanel>}
141
143
 
142
- {tableMode && body}
144
+ {minimalistView && body}
143
145
 
144
146
  <FieldHelperText includeDescription={includeDescription}
145
147
  showError={showError}
@@ -2,7 +2,7 @@ import React, { useCallback, useEffect, useState } from "react";
2
2
 
3
3
  import { Field, useFormex } from "@firecms/formex";
4
4
 
5
- import { FieldHelperText, FormikArrayContainer, LabelWithIcon } from "../components";
5
+ import { FieldHelperText, FormikArrayContainer, LabelWithIconAndTooltip } from "../components";
6
6
  import { PropertyFieldBinding } from "../PropertyFieldBinding";
7
7
  import { EnumValuesChip } from "../../preview";
8
8
  import { FieldProps, FormContext, PropertyFieldBindingProps, PropertyOrBuilder } from "../../types";
@@ -27,7 +27,7 @@ export function BlockFieldBinding<T extends Array<any>>({
27
27
  isSubmitting,
28
28
  setValue,
29
29
  setFieldValue,
30
- tableMode,
30
+ minimalistView,
31
31
  property,
32
32
  includeDescription,
33
33
  underlyingValueHasChanged,
@@ -61,14 +61,17 @@ export function BlockFieldBinding<T extends Array<any>>({
61
61
  }, [context, lastAddedId, property.oneOf, propertyKey, value]);
62
62
 
63
63
  const title = (
64
- <LabelWithIcon icon={getIconForProperty(property, "small")}
65
- required={property.validation?.required}
66
- title={property.name}
67
- className={"text-text-secondary dark:text-text-secondary-dark"}/>
64
+ <LabelWithIconAndTooltip
65
+ propertyKey={propertyKey}
66
+ icon={getIconForProperty(property, "small")}
67
+ required={property.validation?.required}
68
+ title={property.name}
69
+ className={"text-text-secondary dark:text-text-secondary-dark"}/>
68
70
  );
69
71
 
70
72
  const firstOneOfKey = Object.keys(property.oneOf.properties)[0];
71
73
  const body = <FormikArrayContainer value={value}
74
+ className={"flex flex-col gap-3"}
72
75
  name={propertyKey}
73
76
  addLabel={property.name ? "Add entry to " + property.name : "Add entry"}
74
77
  buildEntry={buildEntry}
@@ -84,7 +87,7 @@ export function BlockFieldBinding<T extends Array<any>>({
84
87
 
85
88
  <>
86
89
 
87
- {!tableMode &&
90
+ {!minimalistView &&
88
91
  <ExpandablePanel
89
92
  className={"px-2 md:px-4 pb-2 md:pb-4 pt-1 md:pt-2"}
90
93
  initiallyExpanded={expanded}
@@ -92,7 +95,7 @@ export function BlockFieldBinding<T extends Array<any>>({
92
95
  {body}
93
96
  </ExpandablePanel>}
94
97
 
95
- {tableMode && body}
98
+ {minimalistView && body}
96
99
 
97
100
  <FieldHelperText includeDescription={includeDescription}
98
101
  showError={showError}
@@ -179,8 +182,7 @@ function BlockEntry({
179
182
  context,
180
183
  autoFocus,
181
184
  partOfArray: false,
182
- partOfBlock: true,
183
- tableMode: false
185
+ minimalistView: true
184
186
  }
185
187
  : undefined;
186
188
 
@@ -193,7 +195,7 @@ function BlockEntry({
193
195
  };
194
196
 
195
197
  return (
196
- <div className={cls(paperMixin, "bg-transparent p-4 my-4 py-8")}>
198
+ <div className={cls(paperMixin, "bg-transparent p-2")}>
197
199
 
198
200
  <Field
199
201
  name={typeFieldName}
@@ -7,6 +7,7 @@ import { useCustomizationController } from "../../hooks";
7
7
  import { getIconForProperty } from "../../util";
8
8
  import { DateTimeField } from "@firecms/ui";
9
9
  import { useClearRestoreValue } from "../useClearRestoreValue";
10
+ import { PropertyIdCopyTooltip } from "../../components";
10
11
 
11
12
  type DateTimeFieldProps = FieldProps<Date>;
12
13
 
@@ -41,20 +42,22 @@ export function DateTimeFieldBinding({
41
42
 
42
43
  return (
43
44
  <>
44
- <DateTimeField
45
- value={internalValue}
46
- onChange={(dateValue) => setValue(dateValue ?? null)}
47
- size={"medium"}
48
- mode={property.mode}
49
- clearable={property.clearable}
50
- locale={locale}
51
- error={showError}
52
- label={<LabelWithIcon
53
- icon={getIconForProperty(property, "small")}
54
- required={property.validation?.required}
55
- className={showError ? "text-red-500 dark:text-red-500" : "text-text-secondary dark:text-text-secondary-dark"}
56
- title={property.name}/>}
57
- />
45
+ <PropertyIdCopyTooltip propertyKey={propertyKey}>
46
+ <DateTimeField
47
+ value={internalValue}
48
+ onChange={(dateValue) => setValue(dateValue)}
49
+ size={"medium"}
50
+ mode={property.mode}
51
+ clearable={property.clearable}
52
+ locale={locale}
53
+ error={showError}
54
+ label={<LabelWithIcon
55
+ icon={getIconForProperty(property, "small")}
56
+ required={property.validation?.required}
57
+ className={showError ? "text-red-500 dark:text-red-500" : "text-text-secondary dark:text-text-secondary-dark"}
58
+ title={property.name}/>}
59
+ />
60
+ </PropertyIdCopyTooltip>
58
61
 
59
62
  <FieldHelperText includeDescription={includeDescription}
60
63
  showError={showError}
@@ -2,7 +2,7 @@ import React, { useEffect, useState } from "react";
2
2
  import { DataType, FieldProps, GeoPoint } from "../../types";
3
3
 
4
4
  import { ArrayContainer } from "../../components";
5
- import { FieldHelperText, LabelWithIcon } from "../components";
5
+ import { FieldHelperText, LabelWithIconAndTooltip } from "../components";
6
6
  import {
7
7
  AddIcon,
8
8
  ArrowDropDownIcon,
@@ -41,7 +41,7 @@ export function KeyValueFieldBinding({
41
41
  disabled,
42
42
  property,
43
43
  setValue,
44
- tableMode,
44
+ minimalistView,
45
45
  includeDescription,
46
46
  underlyingValueHasChanged,
47
47
  autoFocus,
@@ -62,7 +62,8 @@ export function KeyValueFieldBinding({
62
62
  initialValue={initialValues}
63
63
  fieldName={property.name ?? propertyKey}/>;
64
64
 
65
- const title = <LabelWithIcon
65
+ const title = <LabelWithIconAndTooltip
66
+ propertyKey={propertyKey}
66
67
  icon={getIconForProperty(property, "small")}
67
68
  required={property.validation?.required}
68
69
  title={property.name}
@@ -71,11 +72,11 @@ export function KeyValueFieldBinding({
71
72
  return (
72
73
  <>
73
74
 
74
- {!tableMode && <ExpandablePanel initiallyExpanded={expanded}
75
- title={title}
76
- className={"px-2 md:px-4 pb-2 md:pb-4 pt-1 md:pt-2"}>{mapFormView}</ExpandablePanel>}
75
+ {!minimalistView && <ExpandablePanel initiallyExpanded={expanded}
76
+ title={title}
77
+ className={"px-2 md:px-4 pb-2 md:pb-4 pt-1 md:pt-2"}>{mapFormView}</ExpandablePanel>}
77
78
 
78
- {tableMode && mapFormView}
79
+ {minimalistView && mapFormView}
79
80
 
80
81
  <FieldHelperText includeDescription={includeDescription}
81
82
  showError={showError}