@firecms/core 3.0.0-beta.2 → 3.0.0-beta.3

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 (60) hide show
  1. package/dist/components/EntityCollectionTable/EntityCollectionRowActions.d.ts +2 -6
  2. package/dist/components/ReferenceWidget.d.ts +3 -3
  3. package/dist/components/index.d.ts +0 -1
  4. package/dist/core/SideEntityView.d.ts +7 -0
  5. package/dist/core/index.d.ts +0 -2
  6. package/dist/form/components/index.d.ts +1 -0
  7. package/dist/form/index.d.ts +1 -0
  8. package/dist/hooks/index.d.ts +2 -1
  9. package/dist/{core → hooks}/useBuildModeController.d.ts +1 -1
  10. package/dist/hooks/useBuildNavigationController.d.ts +1 -1
  11. package/dist/index.es.js +2682 -2663
  12. package/dist/index.es.js.map +1 -1
  13. package/dist/index.umd.js +5 -5
  14. package/dist/index.umd.js.map +1 -1
  15. package/dist/internal/useBuildDataSource.d.ts +4 -0
  16. package/dist/types/entities.d.ts +1 -0
  17. package/dist/util/index.d.ts +1 -0
  18. package/package.json +12 -4
  19. package/src/components/EntityCollectionTable/EntityCollectionRowActions.tsx +33 -37
  20. package/src/components/EntityCollectionTable/EntityCollectionTable.tsx +36 -38
  21. package/src/components/EntityCollectionTable/PropertyTableCell.tsx +2 -1
  22. package/src/components/EntityCollectionTable/fields/TableReferenceField.tsx +1 -1
  23. package/src/components/EntityCollectionView/EntityCollectionView.tsx +9 -9
  24. package/src/components/ReferenceWidget.tsx +4 -4
  25. package/src/components/SelectableTable/filters/ReferenceFilterField.tsx +2 -2
  26. package/src/components/index.tsx +0 -1
  27. package/src/core/EntitySidePanel.tsx +1 -1
  28. package/src/{internal → core}/EntityView.tsx +2 -2
  29. package/src/core/SideEntityView.tsx +38 -0
  30. package/src/core/index.tsx +0 -2
  31. package/src/form/components/index.tsx +1 -0
  32. package/src/form/field_bindings/ArrayCustomShapedFieldBinding.tsx +2 -3
  33. package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +4 -3
  34. package/src/form/field_bindings/BlockFieldBinding.tsx +2 -3
  35. package/src/form/field_bindings/DateTimeFieldBinding.tsx +3 -3
  36. package/src/form/field_bindings/KeyValueFieldBinding.tsx +4 -4
  37. package/src/form/field_bindings/MapFieldBinding.tsx +2 -2
  38. package/src/form/field_bindings/MarkdownFieldBinding.tsx +1 -2
  39. package/src/form/field_bindings/MultiSelectBinding.tsx +2 -3
  40. package/src/form/field_bindings/ReadOnlyFieldBinding.tsx +2 -2
  41. package/src/form/field_bindings/ReferenceFieldBinding.tsx +5 -4
  42. package/src/form/field_bindings/RepeatFieldBinding.tsx +3 -3
  43. package/src/form/field_bindings/SelectFieldBinding.tsx +2 -3
  44. package/src/form/field_bindings/StorageUploadFieldBinding.tsx +3 -3
  45. package/src/form/field_bindings/SwitchFieldBinding.tsx +2 -3
  46. package/src/form/field_bindings/TextFieldBinding.tsx +3 -4
  47. package/src/form/index.tsx +1 -0
  48. package/src/hooks/index.tsx +3 -1
  49. package/src/{core → hooks}/useBuildModeController.tsx +1 -1
  50. package/src/hooks/useBuildNavigationController.tsx +30 -15
  51. package/src/internal/useBuildDataSource.ts +7 -2
  52. package/src/preview/PropertyPreview.tsx +1 -1
  53. package/src/preview/components/ReferencePreview.tsx +1 -1
  54. package/src/types/entities.ts +4 -0
  55. package/src/util/index.ts +1 -0
  56. /package/dist/{internal → core}/EntityView.d.ts +0 -0
  57. /package/dist/{components → form/components}/LabelWithIcon.d.ts +0 -0
  58. /package/dist/{core → hooks}/useBuildLocalConfigurationPersistence.d.ts +0 -0
  59. /package/src/{components → form/components}/LabelWithIcon.tsx +0 -0
  60. /package/src/{core → hooks}/useBuildLocalConfigurationPersistence.tsx +0 -0
@@ -17,6 +17,10 @@ export declare function useBuildDataSource({ delegate, propertyConfigs, navigati
17
17
  * bindings.
18
18
  * Also, Firestore references are replaced with {@link EntityReference}
19
19
  * @param data
20
+ * @param buildReference
21
+ * @param buildGeoPoint
22
+ * @param buildDate
23
+ * @param buildDelete
20
24
  * @group Firestore
21
25
  */
22
26
  export declare function cmsToDelegateModel(data: any, buildReference: (reference: EntityReference) => any, buildGeoPoint: (geoPoint: GeoPoint) => any, buildDate: (date: Date) => any, buildDelete: () => any): any;
@@ -43,6 +43,7 @@ export declare class EntityReference<M extends Record<string, any> = any> {
43
43
  readonly path: string;
44
44
  constructor(id: string, path: string);
45
45
  get pathWithId(): string;
46
+ isEntityReference(): boolean;
46
47
  }
47
48
  export declare class GeoPoint {
48
49
  /**
@@ -20,3 +20,4 @@ export * from "./flatten_object";
20
20
  export * from "./make_properties_editable";
21
21
  export * from "./join_collections";
22
22
  export * from "./builders";
23
+ export * from "./useTraceUpdate";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@firecms/core",
3
3
  "type": "module",
4
- "version": "3.0.0-beta.2",
4
+ "version": "3.0.0-beta.3",
5
5
  "description": "Awesome Firebase/Firestore-based headless open-source CMS",
6
6
  "funding": {
7
7
  "url": "https://github.com/sponsors/firecmsco"
@@ -37,9 +37,17 @@
37
37
  "clean": "rm -rf dist && find ./src -name '*.js' -type f | xargs rm -f",
38
38
  "generateIcons": "ts-node --esm src/icons/generateIcons.ts"
39
39
  },
40
+ "exports": {
41
+ ".": {
42
+ "import": "./dist/index.es.js",
43
+ "require": "./dist/index.umd.js",
44
+ "types": "./dist/src/index.d.ts"
45
+ },
46
+ "./package.json": "./package.json"
47
+ },
40
48
  "dependencies": {
41
- "@firecms/formex": "^3.0.0-beta.2",
42
- "@firecms/ui": "^3.0.0-beta.2",
49
+ "@firecms/formex": "^3.0.0-beta.3",
50
+ "@firecms/ui": "^3.0.0-beta.3",
43
51
  "@fontsource/ibm-plex-mono": "^5.0.8",
44
52
  "@fontsource/roboto": "^5.0.8",
45
53
  "@hello-pangea/dnd": "^16.5.0",
@@ -107,7 +115,7 @@
107
115
  "dist",
108
116
  "src"
109
117
  ],
110
- "gitHead": "9c3561bc09311f2339bb6fa224c88a62d3b19617",
118
+ "gitHead": "33cceff5d5bc2a7002cc5a3904b787e70bfb9c6e",
111
119
  "publishConfig": {
112
120
  "access": "public"
113
121
  }
@@ -1,5 +1,4 @@
1
1
  import React, { MouseEvent, useCallback } from "react";
2
- import equal from "react-fast-compare"
3
2
 
4
3
  import { CollectionSize, Entity, EntityAction, EntityCollection, SelectionController } from "../../types";
5
4
  import { Checkbox, cn, IconButton, Menu, MenuItem, MoreVertIcon, Skeleton, Tooltip, Typography } from "@firecms/ui";
@@ -14,46 +13,43 @@ import { useFireCMSContext, useLargeLayout } from "../../hooks";
14
13
  * @param selectionEnabled
15
14
  * @param size
16
15
  * @param toggleEntitySelection
17
- * @param onCopyClicked
18
- * @param onEditClicked
19
- * @param onDeleteClicked
20
16
  * @param hideId
21
17
  * @constructor
22
18
  *
23
19
  * @group Collection components
24
20
  */
25
- export const EntityCollectionRowActions = React.memo(function EntityCollectionRowActions({
26
- entity,
27
- collection,
28
- fullPath,
29
- width,
30
- frozen,
31
- isSelected,
32
- selectionEnabled,
33
- size,
34
- highlightEntity,
35
- onCollectionChange,
36
- unhighlightEntity,
37
- actions = [],
38
- hideId,
39
- selectionController,
40
- }:
41
- {
42
- entity: Entity<any>,
43
- collection?: EntityCollection<any>,
44
- fullPath?: string,
45
- width: number,
46
- frozen?: boolean,
47
- size: CollectionSize,
48
- isSelected?: boolean,
49
- selectionEnabled?: boolean,
50
- actions?: EntityAction[],
51
- hideId?: boolean,
52
- onCollectionChange?: () => void,
53
- selectionController?: SelectionController;
54
- highlightEntity?: (entity: Entity<any>) => void;
55
- unhighlightEntity?: (entity: Entity<any>) => void;
56
- }) {
21
+ export const EntityCollectionRowActions = function EntityCollectionRowActions({
22
+ entity,
23
+ collection,
24
+ fullPath,
25
+ width,
26
+ frozen,
27
+ isSelected,
28
+ selectionEnabled,
29
+ size,
30
+ highlightEntity,
31
+ onCollectionChange,
32
+ unhighlightEntity,
33
+ actions = [],
34
+ hideId,
35
+ selectionController,
36
+ }:
37
+ {
38
+ entity: Entity<any>,
39
+ collection?: EntityCollection<any>,
40
+ fullPath?: string,
41
+ width: number,
42
+ frozen?: boolean,
43
+ size: CollectionSize,
44
+ isSelected?: boolean,
45
+ selectionEnabled?: boolean,
46
+ actions?: EntityAction[],
47
+ hideId?: boolean,
48
+ onCollectionChange?: () => void,
49
+ selectionController?: SelectionController;
50
+ highlightEntity?: (entity: Entity<any>) => void;
51
+ unhighlightEntity?: (entity: Entity<any>) => void;
52
+ }) {
57
53
 
58
54
  const largeLayout = useLargeLayout();
59
55
 
@@ -171,4 +167,4 @@ export const EntityCollectionRowActions = React.memo(function EntityCollectionRo
171
167
  </div>
172
168
  );
173
169
 
174
- }, equal);
170
+ };
@@ -1,4 +1,4 @@
1
- import React, { useCallback, useContext, useMemo, useRef } from "react";
1
+ import React, { useCallback, useMemo, useRef } from "react";
2
2
  import equal from "react-fast-compare";
3
3
  import { AdditionalFieldDelegate, CollectionSize, Entity, FireCMSContext, User } from "../../types";
4
4
  import { PropertyTableCell } from "./PropertyTableCell";
@@ -8,7 +8,6 @@ import { CellRendererParams, VirtualTableColumn } from "../VirtualTable";
8
8
  import { getValueInPath } from "../../util";
9
9
  import { getRowHeight } from "../VirtualTable/common";
10
10
  import { EntityCollectionRowActions } from "./EntityCollectionRowActions";
11
- import { EntityCollectionTableController } from "../common/types";
12
11
  import { CollectionTableToolbar } from "./internal/CollectionTableToolbar";
13
12
  import { EntityCollectionTableProps } from "./EntityCollectionTableProps";
14
13
  import { EntityTableCell } from "./internal/EntityTableCell";
@@ -111,12 +110,12 @@ export const EntityCollectionTable = React.memo<EntityCollectionTableProps<any>>
111
110
 
112
111
  const customFieldValidator: CustomFieldValidator | undefined = uniqueFieldValidator;
113
112
 
114
- const propertyCellRenderer = useCallback(({
115
- column,
116
- columnIndex,
117
- rowData,
118
- rowIndex
119
- }: CellRendererParams<any>) => {
113
+ const propertyCellRenderer = ({
114
+ column,
115
+ columnIndex,
116
+ rowData,
117
+ rowIndex
118
+ }: CellRendererParams<any>) => {
120
119
 
121
120
  const entity: Entity<M> = rowData;
122
121
 
@@ -158,7 +157,7 @@ export const EntityCollectionTable = React.memo<EntityCollectionTableProps<any>>
158
157
  }
159
158
  </ErrorBoundary>);
160
159
 
161
- }, [inlineEditing, size, selectedEntityIds]);
160
+ };
162
161
 
163
162
  const additionalCellRenderer = useCallback(({
164
163
  column,
@@ -205,30 +204,29 @@ export const EntityCollectionTable = React.memo<EntityCollectionTableProps<any>>
205
204
 
206
205
  }, [size, selectedEntityIds]);
207
206
 
208
- const collectionColumns: VirtualTableColumn[] = useMemo(() => {
209
- const columnsResult: VirtualTableColumn[] = propertiesToColumns({
210
- properties,
211
- sortable,
212
- forceFilter,
213
- disabledFilter: disabledFilterChange,
214
- AdditionalHeaderWidget
215
- });
216
-
217
- const additionalTableColumns: VirtualTableColumn[] = additionalFields
218
- ? additionalFields.map((additionalField) =>
219
- ({
220
- key: additionalField.key,
221
- align: "left",
222
- sortable: false,
223
- title: additionalField.name,
224
- width: additionalField.width ?? 200
225
- }))
226
- : [];
227
- return [...columnsResult, ...additionalTableColumns];
228
- },
229
- [additionalFields, disabledFilterChange, forceFilter, properties, sortable]);
230
-
231
- const idColumn: VirtualTableColumn = useMemo(() => ({
207
+ const collectionColumns: VirtualTableColumn[] = (() => {
208
+ const columnsResult: VirtualTableColumn[] = propertiesToColumns({
209
+ properties,
210
+ sortable,
211
+ forceFilter,
212
+ disabledFilter: disabledFilterChange,
213
+ AdditionalHeaderWidget
214
+ });
215
+
216
+ const additionalTableColumns: VirtualTableColumn[] = additionalFields
217
+ ? additionalFields.map((additionalField) =>
218
+ ({
219
+ key: additionalField.key,
220
+ align: "left",
221
+ sortable: false,
222
+ title: additionalField.name,
223
+ width: additionalField.width ?? 200
224
+ }))
225
+ : [];
226
+ return [...columnsResult, ...additionalTableColumns];
227
+ })();
228
+
229
+ const idColumn: VirtualTableColumn = {
232
230
  key: "id_ewcfedcswdf3",
233
231
  width: getIdColumnWidth?.() ?? (largeLayout ? 160 : 130),
234
232
  title: "ID",
@@ -237,17 +235,17 @@ export const EntityCollectionTable = React.memo<EntityCollectionTableProps<any>>
237
235
  headerAlign: "center",
238
236
  align: "center",
239
237
  AdditionalHeaderWidget: () => additionalIDHeaderWidget
240
- }), [getIdColumnWidth, largeLayout])
238
+ }
241
239
 
242
- const columns: VirtualTableColumn[] = useMemo(() => [
240
+ const columns: VirtualTableColumn[] = [
243
241
  idColumn,
244
242
  ...displayedColumnIds
245
243
  .map((p) => {
246
244
  return collectionColumns.find(c => c.key === p.key);
247
245
  }).filter(Boolean) as VirtualTableColumn[]
248
- ], [collectionColumns, displayedColumnIds, idColumn]);
246
+ ];
249
247
 
250
- const cellRenderer = useCallback((props: CellRendererParams<any>) => {
248
+ const cellRenderer = (props: CellRendererParams<any>) => {
251
249
  const column = props.column;
252
250
  const columns = props.columns;
253
251
  const columnKey = column.key;
@@ -287,7 +285,7 @@ export const EntityCollectionTable = React.memo<EntityCollectionTableProps<any>>
287
285
  <ErrorView error={e}/>
288
286
  </EntityTableCell>;
289
287
  }
290
- }, [additionalFieldsMap, tableRowActionsBuilder, size, additionalCellRenderer, propertyCellRenderer])
288
+ }
291
289
 
292
290
  return (
293
291
 
@@ -24,13 +24,14 @@ import { getPreviewSizeFrom } from "../../preview/util";
24
24
  import { isReadOnly } from "../../util";
25
25
 
26
26
  import { CustomFieldValidator, mapPropertyToYup } from "../../form/validation";
27
- import { useClearRestoreValue, useFireCMSContext } from "../../hooks";
27
+ import { useFireCMSContext } from "../../hooks";
28
28
 
29
29
  import { EntityTableCell } from "./internal/EntityTableCell";
30
30
  import { EntityTableCellActions } from "./internal/EntityTableCellActions";
31
31
 
32
32
  import { getRowHeight } from "../VirtualTable/common";
33
33
  import { useSelectableTableController } from "../SelectableTable/SelectableTableContext";
34
+ import { useClearRestoreValue } from "../../form/useClearRestoreValue";
34
35
 
35
36
  export interface PropertyTableCellProps<T extends CMSType, M extends Record<string, any>> {
36
37
  propertyKey: string;
@@ -96,7 +96,7 @@ export const TableReferenceFieldSuccess = React.memo(
96
96
  const valueNotSet = !internalValue || (Array.isArray(internalValue) && internalValue.length === 0);
97
97
 
98
98
  const buildSingleReferenceField = () => {
99
- if (internalValue instanceof EntityReference)
99
+ if (internalValue && !Array.isArray(internalValue) && internalValue.isEntityReference && internalValue.isEntityReference())
100
100
  return <ReferencePreview
101
101
  onClick={disabled ? undefined : handleOpen}
102
102
  size={getPreviewSizeFrom(size)}
@@ -433,7 +433,7 @@ export const EntityCollectionView = React.memo(
433
433
 
434
434
  const largeLayout = useLargeLayout();
435
435
 
436
- const getActionsForEntity = useCallback(({ entity, customEntityActions }: {
436
+ const getActionsForEntity = ({ entity, customEntityActions }: {
437
437
  entity?: Entity<M>,
438
438
  customEntityActions?: EntityAction[]
439
439
  }): EntityAction[] => {
@@ -446,7 +446,7 @@ export const EntityCollectionView = React.memo(
446
446
  if (customEntityActions)
447
447
  actions.push(...customEntityActions);
448
448
  return actions;
449
- }, [authController, collection, createEnabled, fullPath]);
449
+ };
450
450
 
451
451
  const getIdColumnWidth = useCallback(() => {
452
452
  const entityActions = getActionsForEntity({});
@@ -456,12 +456,12 @@ export const EntityCollectionView = React.memo(
456
456
  return (largeLayout ? (80 + actionsWidth) : (70 + actionsWidth)) + (collapsedActions.length > 0 ? (largeLayout ? 40 : 30) : 0);
457
457
  }, [largeLayout]);
458
458
 
459
- const tableRowActionsBuilder = useCallback(({
460
- entity,
461
- size,
462
- width,
463
- frozen
464
- }: {
459
+ const tableRowActionsBuilder = ({
460
+ entity,
461
+ size,
462
+ width,
463
+ frozen
464
+ }: {
465
465
  entity: Entity<any>,
466
466
  size: CollectionSize,
467
467
  width: number,
@@ -491,7 +491,7 @@ export const EntityCollectionView = React.memo(
491
491
  />
492
492
  );
493
493
 
494
- }, [isEntitySelected, collection, authController, fullPath, selectionEnabled, toggleEntitySelection, createEnabled]);
494
+ };
495
495
 
496
496
  const title = <Popover
497
497
  open={popOverOpen}
@@ -9,13 +9,13 @@ import { Button, cn } from "@firecms/ui";
9
9
  export type ReferenceWidgetProps<M extends Record<string, any>> = {
10
10
  name?: string,
11
11
  multiselect?: boolean,
12
- value: EntityReference<M> | EntityReference<M>[] | null,
12
+ value: EntityReference | EntityReference[] | null,
13
13
  onReferenceSelected?: (params: {
14
- reference: EntityReference<M> | null,
14
+ reference: EntityReference | null,
15
15
  entity: Entity<M> | null
16
16
  }) => void,
17
17
  onMultipleReferenceSelected?: (params: {
18
- references: EntityReference<M>[] | null,
18
+ references: EntityReference[] | null,
19
19
  entities: Entity<M>[] | null
20
20
  }) => void,
21
21
  path: string,
@@ -113,7 +113,7 @@ export function ReferenceWidget<M extends Record<string, any>>({
113
113
  size={size}/>
114
114
  })}
115
115
  </div>
116
- } else if (value instanceof EntityReference) {
116
+ } else if (value?.isEntityReference && value?.isEntityReference()) {
117
117
  child = <ReferencePreview
118
118
  reference={value}
119
119
  onClick={onEntryClick}
@@ -60,7 +60,7 @@ export function ReferenceFilterField({
60
60
 
61
61
  const selectedEntityIds = internalValue
62
62
  ? (Array.isArray(internalValue) ? internalValue.map((ref) => {
63
- if (!(ref instanceof EntityReference)) {
63
+ if (!(ref?.isEntityReference && ref?.isEntityReference())) {
64
64
  return null;
65
65
  }
66
66
  return ref.id;
@@ -74,7 +74,7 @@ export function ReferenceFilterField({
74
74
  let newValue = val;
75
75
  if (prevOpIsArray !== newOpIsArray) {
76
76
  // @ts-ignore
77
- newValue = newOpIsArray ? (newValue instanceof EntityReference ? [newValue] : []) : undefined
77
+ newValue = newOpIsArray ? (newValue?.isEntityReference && newValue?.isEntityReference() ? [newValue] : []) : undefined
78
78
  }
79
79
 
80
80
  setOperation(op);
@@ -31,5 +31,4 @@ export * from "./FireCMSAppBar";
31
31
 
32
32
  export * from "./ArrayContainer";
33
33
  export * from "./ReferenceWidget";
34
- export * from "./LabelWithIcon";
35
34
  export * from "./SearchIconsView";
@@ -4,7 +4,7 @@ import { EntitySidePanelProps } from "../types";
4
4
  import { useNavigationController } from "../hooks";
5
5
 
6
6
  import { ErrorBoundary } from "../components";
7
- import { EntityView } from "../internal/EntityView";
7
+ import { EntityView } from "./EntityView";
8
8
  import { useSideDialogContext } from "./SideDialogs";
9
9
 
10
10
  /**
@@ -32,8 +32,8 @@ import {
32
32
  import { EntityForm } from "../form";
33
33
  import { CircularProgress, CloseIcon, cn, defaultBorderMixin, IconButton, Tab, Tabs, Typography } from "@firecms/ui";
34
34
  import { EntityFormSaveParams } from "../form/EntityForm";
35
- import { FORM_CONTAINER_WIDTH } from "./common";
36
- import { useSideDialogContext } from "../core";
35
+ import { FORM_CONTAINER_WIDTH } from "../internal/common";
36
+ import { useSideDialogContext } from "./index";
37
37
 
38
38
  const MAIN_TAB_VALUE = "main_##Q$SC^#S6";
39
39
 
@@ -0,0 +1,38 @@
1
+ import { EntityViewProps } from "./EntityView";
2
+ import { User } from "../types";
3
+ import { useSideDialogContext } from "./SideDialogs";
4
+ import { useSideEntityController } from "../hooks";
5
+ import { FORM_CONTAINER_WIDTH } from "../internal/common";
6
+
7
+ export type SideEntityViewProps<M extends Record<string, any>> = EntityViewProps<M> & {
8
+ formWidth?: number | string;
9
+ onClose?: () => void;
10
+ }
11
+
12
+ export function SideEntityView<M extends Record<string, any>, UserType extends User>({
13
+ path,
14
+ entityId,
15
+ selectedSubPath,
16
+ copy,
17
+ collection,
18
+ parentCollectionIds,
19
+ onValuesAreModified,
20
+ formWidth,
21
+ onUpdate,
22
+ onClose
23
+ }: SideEntityViewProps<M>) {
24
+
25
+ const sideDialogContext = useSideDialogContext();
26
+ const sideEntityController = useSideEntityController();
27
+ const resolvedFormWidth: string = typeof formWidth === "number" ? `${formWidth}px` : formWidth ?? FORM_CONTAINER_WIDTH;
28
+
29
+ const onCloseHandler = () => {
30
+ if (onClose) {
31
+ onClose();
32
+ } else {
33
+ sideDialogContext.close();
34
+ }
35
+ }
36
+
37
+ return <></>;
38
+ }
@@ -10,5 +10,3 @@ export * from "./field_configs";
10
10
 
11
11
  export * from "./SideDialogs";
12
12
  export * from "./NavigationRoutes";
13
- export * from "./useBuildModeController";
14
- export * from "./useBuildLocalConfigurationPersistence";
@@ -1,2 +1,3 @@
1
1
  export * from "./FormikArrayContainer";
2
2
  export * from "./FieldHelperText";
3
+ export * from "./LabelWithIcon";
@@ -1,11 +1,10 @@
1
1
  import React from "react";
2
2
  import { FieldProps } from "../../types";
3
- import { FieldHelperText } from "../components";
3
+ import { FieldHelperText, LabelWithIcon } from "../components";
4
4
  import { PropertyFieldBinding } from "../PropertyFieldBinding";
5
- import { useClearRestoreValue } from "../../hooks";
6
5
  import { ExpandablePanel } from "@firecms/ui";
7
6
  import { getIconForProperty } from "../../util";
8
- import { LabelWithIcon } from "../../components";
7
+ import { useClearRestoreValue } from "../useClearRestoreValue";
9
8
 
10
9
  /**
11
10
  * Array field used for custom
@@ -1,12 +1,13 @@
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 } from "../components";
5
- import { ErrorView, LabelWithIcon } from "../../components";
4
+ import { FieldHelperText, FormikArrayContainer, LabelWithIcon } from "../components";
5
+ import { ErrorView } from "../../components";
6
6
  import { getIconForProperty, getReferenceFrom } from "../../util";
7
7
 
8
- import { useClearRestoreValue, useNavigationController, useReferenceDialog } from "../../hooks";
8
+ import { useNavigationController, useReferenceDialog } from "../../hooks";
9
9
  import { Button, ExpandablePanel } from "@firecms/ui";
10
+ import { useClearRestoreValue } from "../useClearRestoreValue";
10
11
 
11
12
  type ArrayOfReferencesFieldProps = FieldProps<EntityReference[]>;
12
13
 
@@ -2,15 +2,14 @@ import React, { useCallback, useEffect, useState } from "react";
2
2
 
3
3
  import { Field, useFormex } from "@firecms/formex";
4
4
 
5
- import { FieldHelperText, FormikArrayContainer } from "../components";
6
- import { LabelWithIcon } from "../../components";
7
- import { useClearRestoreValue } from "../../hooks";
5
+ import { FieldHelperText, FormikArrayContainer, LabelWithIcon } from "../components";
8
6
  import { PropertyFieldBinding } from "../PropertyFieldBinding";
9
7
  import { EnumValuesChip } from "../../preview";
10
8
  import { FieldProps, FormContext, PropertyFieldBindingProps, PropertyOrBuilder } from "../../types";
11
9
  import { getDefaultValueFor, getIconForProperty, } from "../../util";
12
10
  import { DEFAULT_ONE_OF_TYPE, DEFAULT_ONE_OF_VALUE } from "../../util/common";
13
11
  import { cn, ExpandablePanel, paperMixin, Select, SelectItem, Typography } from "@firecms/ui";
12
+ import { useClearRestoreValue } from "../useClearRestoreValue";
14
13
 
15
14
  /**
16
15
  * If the `oneOf` property is specified, this fields render each array entry as
@@ -2,11 +2,11 @@ import React from "react";
2
2
 
3
3
  import { FieldProps } from "../../types";
4
4
 
5
- import { FieldHelperText } from "../components";
6
- import { LabelWithIcon } from "../../components";
7
- import { useClearRestoreValue, useCustomizationController } from "../../hooks";
5
+ import { FieldHelperText, LabelWithIcon } from "../components";
6
+ import { useCustomizationController } from "../../hooks";
8
7
  import { getIconForProperty } from "../../util";
9
8
  import { DateTimeField } from "@firecms/ui";
9
+ import { useClearRestoreValue } from "../useClearRestoreValue";
10
10
 
11
11
  type DateTimeFieldProps = FieldProps<Date>;
12
12
 
@@ -1,8 +1,8 @@
1
1
  import React, { useEffect, useState } from "react";
2
- import { DataType, EntityReference, FieldProps, GeoPoint } from "../../types";
2
+ import { DataType, FieldProps, GeoPoint } from "../../types";
3
3
 
4
- import { ArrayContainer, LabelWithIcon } from "../../components";
5
- import { FieldHelperText } from "../components";
4
+ import { ArrayContainer } from "../../components";
5
+ import { FieldHelperText, LabelWithIcon } from "../components";
6
6
  import {
7
7
  AddIcon,
8
8
  ArrowDropDownIcon,
@@ -546,7 +546,7 @@ function getDataType(value: any): DataType | undefined {
546
546
  return "array";
547
547
  } else if (value instanceof Date) {
548
548
  return "date";
549
- } else if (value instanceof EntityReference) {
549
+ } else if (value?.isEntityReference && value?.isEntityReference()) {
550
550
  return "reference";
551
551
  } else if (value instanceof GeoPoint) {
552
552
  return "geopoint";
@@ -1,9 +1,9 @@
1
1
  import React from "react";
2
2
  import { FieldProps, Properties, ResolvedProperties } from "../../types";
3
3
 
4
- import { ErrorBoundary, LabelWithIcon } from "../../components";
4
+ import { ErrorBoundary } from "../../components";
5
5
  import { getIconForProperty, isHidden, pick } from "../../util";
6
- import { FieldHelperText } from "../components";
6
+ import { FieldHelperText, LabelWithIcon } from "../components";
7
7
  import { PropertyFieldBinding } from "../PropertyFieldBinding";
8
8
  import { ExpandablePanel, InputLabel, Select, SelectItem } from "@firecms/ui";
9
9
 
@@ -4,8 +4,7 @@ import React, { useDeferredValue, useEffect, useRef } from "react";
4
4
  import MarkdownIt from "markdown-it";
5
5
  import MdEditor, { Plugins } from "react-markdown-editor-lite";
6
6
 
7
- import { FieldHelperText } from "../components";
8
- import { LabelWithIcon } from "../../components";
7
+ import { FieldHelperText, LabelWithIcon } from "../components";
9
8
  import { FieldProps } from "../../types";
10
9
  import { getIconForProperty } from "../../util";
11
10
  import {
@@ -1,12 +1,11 @@
1
1
  import React, { useCallback } from "react";
2
2
 
3
3
  import { EnumType, FieldProps, ResolvedProperty } from "../../types";
4
- import { FieldHelperText } from "../components";
5
- import { LabelWithIcon } from "../../components";
6
- import { useClearRestoreValue } from "../../hooks";
4
+ import { FieldHelperText, LabelWithIcon } from "../components";
7
5
  import { EnumValuesChip } from "../../preview";
8
6
  import { enumToObjectEntries, getIconForProperty, getLabelOrConfigFrom } from "../../util";
9
7
  import { CloseIcon, MultiSelect, MultiSelectItem } from "@firecms/ui";
8
+ import { useClearRestoreValue } from "../useClearRestoreValue";
10
9
 
11
10
  /**
12
11
  * This fields renders a dropdown with multiple selection.
@@ -3,8 +3,8 @@ import React from "react";
3
3
  import { Entity, FieldProps } from "../../types";
4
4
 
5
5
  import { PropertyPreview } from "../../preview";
6
- import { FieldHelperText } from "../components";
7
- import { ErrorBoundary, LabelWithIcon } from "../../components";
6
+ import { FieldHelperText, LabelWithIcon } from "../components";
7
+ import { ErrorBoundary } from "../../components";
8
8
  import { getIconForProperty } from "../../util";
9
9
  import { cn, paperMixin } from "@firecms/ui";
10
10