@firecms/collection_editor 3.0.0-beta.6 → 3.0.0-beta.7

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.
@@ -1,4 +1,4 @@
1
- import React, { useCallback, useState } from "react";
1
+ import React, { useState } from "react";
2
2
  import { AddIcon, Button, Paper, Typography } from "@firecms/ui";
3
3
  import { getIn, useFormex } from "@firecms/formex";
4
4
  import { PropertyFormDialog } from "../PropertyEditView";
@@ -49,7 +49,7 @@ export function BlockPropertyField({
49
49
  const selectedPropertyFullId = selectedPropertyKey ? getFullId(selectedPropertyKey, selectedPropertyNamespace) : undefined;
50
50
  const selectedProperty = selectedPropertyFullId ? getIn(values.oneOf?.properties, selectedPropertyFullId.replaceAll(".", ".properties.")) : undefined;
51
51
 
52
- const deleteProperty = useCallback((propertyKey?: string, namespace?: string) => {
52
+ const deleteProperty = (propertyKey?: string, namespace?: string) => {
53
53
  const fullId = propertyKey ? getFullId(propertyKey, namespace) : undefined;
54
54
  if (!fullId)
55
55
  throw Error("collection editor miss config");
@@ -62,7 +62,7 @@ export function BlockPropertyField({
62
62
  setPropertyDialogOpen(false);
63
63
  setSelectedPropertyKey(undefined);
64
64
  setSelectedPropertyNamespace(undefined);
65
- }, [setFieldValue, values]);
65
+ };
66
66
 
67
67
  const addChildButton = <Button
68
68
  autoFocus
@@ -74,9 +74,9 @@ export function BlockPropertyField({
74
74
  Add property to {values.name ?? "this block"}
75
75
  </Button>;
76
76
 
77
- const onPropertyMove = useCallback((propertiesOrder: string[], namespace?: string) => {
77
+ const onPropertyMove = (propertiesOrder: string[], namespace?: string) => {
78
78
  setFieldValue(`oneOf.${namespaceToPropertiesOrderPath(namespace)}`, propertiesOrder, false);
79
- }, []);
79
+ };
80
80
 
81
81
  return (
82
82
  <>
@@ -1,4 +1,4 @@
1
- import React, { useCallback, useState } from "react";
1
+ import React, { useState } from "react";
2
2
  import { FieldCaption, MapProperty, Property, PropertyConfig, } from "@firecms/core";
3
3
  import { AddIcon, BooleanSwitchWithLabel, Button, Paper, Typography } from "@firecms/ui";
4
4
  import { PropertyFormDialog } from "../PropertyEditView";
@@ -42,7 +42,7 @@ export function MapPropertyField({ disabled, getData, allowDataInference, proper
42
42
  setPropertyDialogOpen(false);
43
43
  };
44
44
 
45
- const deleteProperty = useCallback((propertyKey?: string, namespace?: string) => {
45
+ const deleteProperty = (propertyKey?: string, namespace?: string) => {
46
46
  const fullId = propertyKey ? getFullId(propertyKey, namespace) : undefined;
47
47
  if (!fullId)
48
48
  throw Error("collection editor miss config");
@@ -58,16 +58,16 @@ export function MapPropertyField({ disabled, getData, allowDataInference, proper
58
58
  setPropertyDialogOpen(false);
59
59
  setSelectedPropertyKey(undefined);
60
60
  setSelectedPropertyNamespace(undefined);
61
- }, [setFieldValue, values]);
61
+ };
62
62
 
63
63
  const selectedPropertyFullId = selectedPropertyKey ? getFullId(selectedPropertyKey, selectedPropertyNamespace) : undefined;
64
64
  const selectedProperty = selectedPropertyFullId ? getIn(values.properties, selectedPropertyFullId.replaceAll(".", ".properties.")) : undefined;
65
65
 
66
66
  const empty = !propertiesOrder || propertiesOrder.length < 1;
67
67
 
68
- const onPropertyMove = useCallback((propertiesOrder: string[], namespace?: string) => {
68
+ const onPropertyMove = (propertiesOrder: string[], namespace?: string) => {
69
69
  setFieldValue(namespaceToPropertiesOrderPath(namespace), propertiesOrder, false);
70
- }, []);
70
+ };
71
71
 
72
72
  return (
73
73
  <>
@@ -39,7 +39,6 @@ export function RepeatPropertyField({
39
39
 
40
40
  const onPropertyChanged = ({ id, property, namespace }:
41
41
  { id?: string, property: Property, namespace?: string }) => {
42
- console.log("onPropertyChanged", id, property, namespace);
43
42
  setFieldValue("of", property);
44
43
  };
45
44
 
@@ -125,7 +125,7 @@ export function IntroWidget({}: {}) {
125
125
  }).createCollections
126
126
  : true;
127
127
 
128
- if (!navigation.initialised || navigation.collections === undefined || (navigation.collections ?? []).length > 0) {
128
+ if (!navigation.initialised || (navigation.collections ?? []).length > 0) {
129
129
  return null;
130
130
  }
131
131