@firecms/collection_editor 3.0.0-alpha.50 → 3.0.0-alpha.51

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,3 +1,3 @@
1
- import { FieldConfigId } from "@firecms/core";
1
+ import { FieldConfigId, PropertyConfig } from "@firecms/core";
2
2
  export declare const supportedFieldsIds: FieldConfigId[];
3
- export declare const supportedFields: [string, import("@firecms/core").PropertyConfig<any>][];
3
+ export declare const supportedFields: Record<string, PropertyConfig>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firecms/collection_editor",
3
- "version": "3.0.0-alpha.50",
3
+ "version": "3.0.0-alpha.51",
4
4
  "main": "./dist/index.umd.js",
5
5
  "module": "./dist/index.es.js",
6
6
  "types": "dist/index.d.ts",
@@ -14,8 +14,8 @@
14
14
  "./package.json": "./package.json"
15
15
  },
16
16
  "dependencies": {
17
- "@firecms/data_import_export": "^3.0.0-alpha.50",
18
- "@firecms/schema_inference": "^3.0.0-alpha.50",
17
+ "@firecms/data_import_export": "^3.0.0-alpha.51",
18
+ "@firecms/schema_inference": "^3.0.0-alpha.51",
19
19
  "json5": "^2.2.3",
20
20
  "prism-react-renderer": "^2.3.0"
21
21
  },
@@ -78,5 +78,5 @@
78
78
  "publishConfig": {
79
79
  "access": "public"
80
80
  },
81
- "gitHead": "2e2d454587689100ef33374e2340fc0df62481cb"
81
+ "gitHead": "d47d8dad9356b48398b65559b7a59926f3d50373"
82
82
  }
@@ -42,6 +42,7 @@ import { KeyValuePropertyField } from "./properties/KeyValuePropertyField";
42
42
  import { updatePropertyFromWidget } from "./utils/update_property_for_widget";
43
43
  import { PropertySelectItem } from "./PropertySelectItem";
44
44
  import { UrlPropertyField } from "./properties/UrlPropertyField";
45
+ import { supportedFields } from "./utils/supported_fields";
45
46
 
46
47
  export type PropertyWithId = Property & {
47
48
  id?: string
@@ -302,7 +303,7 @@ function PropertyEditView({
302
303
  const [deleteDialogOpen, setDeleteDialogOpen] = useState(false);
303
304
  const [selectedFieldConfigId, setSelectedFieldConfigId] = useState<string | undefined>(values?.dataType ? getFieldId(values) : undefined);
304
305
 
305
- const allSupportedFields = Object.entries(DEFAULT_FIELD_CONFIGS).concat(Object.entries(propertyConfigs));
306
+ const allSupportedFields = Object.entries(supportedFields).concat(Object.entries(propertyConfigs));
306
307
 
307
308
  const displayedWidgets = inArray
308
309
  ? allSupportedFields.filter(([_, propertyConfig]) => !isPropertyBuilder(propertyConfig.property) && propertyConfig.property?.dataType !== "array")
@@ -261,7 +261,7 @@ function PropertySelect({
261
261
  });
262
262
  console.log("newSelectedWidgetId", newSelectedWidgetId);
263
263
  }}>
264
- {supportedFields.map(([key, widget]) => {
264
+ {Object.entries(supportedFields).map(([key, widget]) => {
265
265
  return <PropertySelectItem
266
266
  key={key}
267
267
  value={key}
@@ -1,4 +1,4 @@
1
- import { DEFAULT_FIELD_CONFIGS, FieldConfigId } from "@firecms/core";
1
+ import { DEFAULT_FIELD_CONFIGS, FieldConfigId, PropertyConfig } from "@firecms/core";
2
2
 
3
3
  export const supportedFieldsIds: FieldConfigId[] = [
4
4
  "text_field",
@@ -13,16 +13,17 @@ export const supportedFieldsIds: FieldConfigId[] = [
13
13
  "multi_number_select",
14
14
  "file_upload",
15
15
  "multi_file_upload",
16
- "group",
17
- "key_value",
18
16
  "reference",
19
17
  "multi_references",
20
18
  "switch",
21
19
  "date_time",
20
+ "group",
21
+ "key_value",
22
22
  "repeat",
23
23
  "block"
24
24
  ];
25
25
 
26
- export const supportedFields = Object.entries(DEFAULT_FIELD_CONFIGS).filter(([id]) =>
27
- supportedFieldsIds.includes(id as FieldConfigId)
28
- );
26
+ export const supportedFields: Record<string, PropertyConfig> = Object.entries(DEFAULT_FIELD_CONFIGS)
27
+ .filter(([id]) => supportedFieldsIds.includes(id as FieldConfigId))
28
+ .map(([id, config]) => ({ [id]: config }))
29
+ .reduce((a, b) => ({ ...a, ...b }), {});