@firecms/collection_editor 3.0.0-alpha.81 → 3.0.0-alpha.83

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.
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@firecms/collection_editor",
3
3
  "type": "module",
4
- "version": "3.0.0-alpha.81",
4
+ "version": "3.0.0-alpha.83",
5
5
  "main": "./dist/index.umd.js",
6
6
  "module": "./dist/index.es.js",
7
7
  "types": "dist/index.d.ts",
8
8
  "source": "src/index.ts",
9
9
  "dependencies": {
10
- "@firecms/data_import_export": "^3.0.0-alpha.81",
11
- "@firecms/schema_inference": "^3.0.0-alpha.81",
12
- "@firecms/ui": "^3.0.0-alpha.81",
10
+ "@firecms/data_import_export": "^3.0.0-alpha.83",
11
+ "@firecms/schema_inference": "^3.0.0-alpha.83",
12
+ "@firecms/ui": "^3.0.0-alpha.83",
13
13
  "json5": "^2.2.3",
14
14
  "prism-react-renderer": "^2.3.0"
15
15
  },
@@ -72,5 +72,5 @@
72
72
  "publishConfig": {
73
73
  "access": "public"
74
74
  },
75
- "gitHead": "ac77309580f9668647209724e1df2080d3932bef"
75
+ "gitHead": "96d21eb290969ee8e2cc56ca13a47834bae0ee57"
76
76
  }
@@ -2,7 +2,13 @@ import React, { PropsWithChildren, useCallback, useEffect } from "react";
2
2
  import equal from "react-fast-compare"
3
3
 
4
4
  import { CollectionsConfigController } from "./types/config_controller";
5
- import { Property, useFireCMSContext, useNavigationController, User, useSnackbarController } from "@firecms/core";
5
+ import {
6
+ Property,
7
+ useCustomizationController,
8
+ useNavigationController,
9
+ User,
10
+ useSnackbarController
11
+ } from "@firecms/core";
6
12
  import { CollectionEditorDialog } from "./ui/collection_editor/CollectionEditorDialog";
7
13
  import { useNavigate } from "react-router";
8
14
  import { CollectionEditorController } from "./types/collection_editor_controller";
@@ -69,7 +75,7 @@ export const ConfigControllerProvider = React.memo(
69
75
  const navigation = useNavigationController();
70
76
  const navigate = useNavigate();
71
77
  const snackbarController = useSnackbarController();
72
- const { propertyConfigs } = useFireCMSContext();
78
+ const { propertyConfigs } = useCustomizationController();
73
79
 
74
80
  const {
75
81
  collections
@@ -1,5 +1,5 @@
1
1
  import React, { useEffect, useState } from "react";
2
- import { EntityCollection, getIconForView, SearchIconsView, singular, toSnakeCase, } from "@firecms/core";
2
+ import { EntityCollection, IconForView, SearchIconsView, singular, toSnakeCase, } from "@firecms/core";
3
3
  import {
4
4
  Autocomplete,
5
5
  AutocompleteItem,
@@ -81,7 +81,7 @@ export function CollectionDetailsForm({
81
81
  }
82
82
  }, [errors.id]);
83
83
 
84
- const collectionIcon = getIconForView(values);
84
+ const collectionIcon = <IconForView collectionOrView={values}/>;
85
85
 
86
86
  const groupOptions = groups?.filter((group) => !reservedGroups?.includes(group));
87
87
 
@@ -353,9 +353,9 @@ export function CollectionDetailsForm({
353
353
  <div className={"p-4 overflow-auto min-h-[200px]"}>
354
354
  <SearchIconsView selectedIcon={values.icon}
355
355
  onIconSelected={(icon: string) => {
356
- setIconDialogOpen(false);
357
- setFieldValue("icon", icon);
358
- }}/>
356
+ setIconDialogOpen(false);
357
+ setFieldValue("icon", icon);
358
+ }}/>
359
359
  </div>
360
360
 
361
361
  </Dialog>
@@ -18,7 +18,7 @@ import {
18
18
  removeUndefined,
19
19
  TopNavigationResult,
20
20
  useAuthController,
21
- useFireCMSContext,
21
+ useCustomizationController,
22
22
  useNavigationController,
23
23
  User,
24
24
  useSnackbarController
@@ -161,7 +161,7 @@ export function CollectionEditorDialogInternal<M extends {
161
161
  }
162
162
  ) {
163
163
 
164
- const { propertyConfigs } = useFireCMSContext();
164
+ const { propertyConfigs } = useCustomizationController();
165
165
  const navigation = useNavigationController();
166
166
  const {
167
167
  topLevelNavigation,
@@ -1,11 +1,11 @@
1
- import { useFireCMSContext } from "@firecms/core";
1
+ import { useCustomizationController } from "@firecms/core";
2
2
  import { Button, Dialog, DialogActions, DialogContent, Typography } from "@firecms/ui";
3
3
  import React from "react";
4
4
 
5
5
  export function EntityCustomViewsSelectDialog({ open, onClose }: { open: boolean, onClose: (selectedViewKey?: string) => void }) {
6
6
  const {
7
7
  entityViews,
8
- } = useFireCMSContext();
8
+ } = useCustomizationController();
9
9
 
10
10
  return <Dialog
11
11
  maxWidth={"md"}
@@ -5,7 +5,7 @@ import {
5
5
  isPropertyBuilder,
6
6
  Property,
7
7
  PropertyOrBuilder,
8
- useFireCMSContext,
8
+ useCustomizationController,
9
9
  } from "@firecms/core";
10
10
  import {
11
11
  cardClickableMixin,
@@ -18,7 +18,6 @@ import {
18
18
  Typography,
19
19
  } from "@firecms/ui";
20
20
 
21
-
22
21
  import { editableProperty } from "../../utils/entities";
23
22
 
24
23
  export function PropertyFieldPreview({
@@ -37,7 +36,7 @@ export function PropertyFieldPreview({
37
36
  onClick?: () => void
38
37
  }) {
39
38
 
40
- const { propertyConfigs } = useFireCMSContext();
39
+ const { propertyConfigs } = useCustomizationController();
41
40
 
42
41
  const propertyConfig = getFieldConfig(property, propertyConfigs);
43
42
  const disabled = !editableProperty(property);
@@ -119,7 +118,7 @@ export function NonEditablePropertyPreview({
119
118
  property?: PropertyOrBuilder
120
119
  }) {
121
120
 
122
- const { propertyConfigs } = useFireCMSContext();
121
+ const { propertyConfigs } = useCustomizationController();
123
122
 
124
123
  const propertyConfig = !isPropertyBuilder(property) && property ? getFieldConfig(property, propertyConfigs) : undefined;
125
124
 
@@ -4,7 +4,7 @@ import {
4
4
  EntityCollection,
5
5
  EntityCustomView,
6
6
  resolveEntityView,
7
- useFireCMSContext,
7
+ useCustomizationController,
8
8
  User
9
9
  } from "@firecms/core";
10
10
  import {
@@ -45,7 +45,7 @@ export function SubcollectionsEditTab({
45
45
  parentCollectionIds?: string[];
46
46
  }) {
47
47
 
48
- const { entityViews: contextEntityViews } = useFireCMSContext();
48
+ const { entityViews: contextEntityViews } = useCustomizationController();
49
49
 
50
50
  const [subcollectionToDelete, setSubcollectionToDelete] = React.useState<string | undefined>();
51
51
  const [addEntityViewDialogOpen, setAddEntityViewDialogOpen] = React.useState<boolean>(false);
@@ -1,18 +1,7 @@
1
1
  import React from "react";
2
2
  import { Field, getIn, useFormikContext } from "formik";
3
- import {
4
- getIconForView,
5
- NumberProperty,
6
- StringProperty,
7
- useNavigationController
8
- } from "@firecms/core";
9
- import {
10
- CircularProgress,
11
- Select,
12
- SelectGroup,
13
- SelectItem,
14
- Typography,
15
- } from "@firecms/ui";
3
+ import { IconForView, NumberProperty, StringProperty, useNavigationController } from "@firecms/core";
4
+ import { CircularProgress, Select, SelectGroup, SelectItem, Typography, } from "@firecms/ui";
16
5
  import { FieldHelperView } from "./FieldHelperView";
17
6
 
18
7
  export function ReferencePropertyField({
@@ -26,9 +15,6 @@ export function ReferencePropertyField({
26
15
  values,
27
16
  handleChange,
28
17
  errors,
29
- touched,
30
- setFieldError,
31
- setFieldValue
32
18
  } = useFormikContext<StringProperty | NumberProperty>();
33
19
 
34
20
  const navigation = useNavigationController();
@@ -113,10 +99,9 @@ export function CollectionsSelect({
113
99
  renderValue={(selected) => {
114
100
  const selectedCollection = collections.find(collection => collection.id === selected || collection.path === selected);
115
101
  if (!selectedCollection) return null;
116
- const collectionIcon = getIconForView(selectedCollection);
117
102
  return (
118
103
  <div className="flex flex-row">
119
- {collectionIcon}
104
+ <IconForView collectionOrView={selectedCollection}/>
120
105
  <Typography
121
106
  variant={"subtitle2"}
122
107
  className="font-medium ml-4">
@@ -132,12 +117,11 @@ export function CollectionsSelect({
132
117
  {
133
118
  collections.filter(collection => collection.group === group)
134
119
  .map((collection) => {
135
- const collectionIcon = getIconForView(collection);
136
120
  return <SelectItem
137
121
  key={`${collection.id ?? collection.path}-${group}`}
138
122
  value={collection.id ?? collection.path}>
139
123
  <div className="flex flex-row">
140
- {collectionIcon}
124
+ <IconForView collectionOrView={collection}/>
141
125
  <Typography
142
126
  variant={"subtitle2"}
143
127
  className="font-medium ml-4">
@@ -154,11 +138,10 @@ export function CollectionsSelect({
154
138
  {ungroupedCollections && <SelectGroup label={"Views"}>
155
139
  {ungroupedCollections
156
140
  .map((collection) => {
157
- const collectionIcon = getIconForView(collection);
158
141
  return <SelectItem key={collection.id ?? collection.path}
159
142
  value={collection.id ?? collection.path}>
160
143
  <div className="flex flex-row">
161
- {collectionIcon}
144
+ <IconForView collectionOrView={collection}/>
162
145
  <Typography
163
146
  variant={"subtitle2"}
164
147
  className="font-medium ml-4">