@firecms/collection_editor 3.0.0-beta.2 → 3.0.0-beta.4

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 (29) hide show
  1. package/dist/index.es.js +582 -570
  2. package/dist/index.es.js.map +1 -1
  3. package/dist/index.umd.js +2 -2
  4. package/dist/index.umd.js.map +1 -1
  5. package/dist/types/persisted_collection.d.ts +1 -1
  6. package/dist/ui/collection_editor/CollectionEditorDialog.d.ts +1 -1
  7. package/dist/ui/collection_editor/utils/supported_fields.d.ts +2 -2
  8. package/package.json +25 -17
  9. package/src/ConfigControllerProvider.tsx +1 -1
  10. package/src/types/persisted_collection.ts +1 -1
  11. package/src/ui/MissingReferenceWidget.tsx +2 -1
  12. package/src/ui/NewCollectionButton.tsx +12 -10
  13. package/src/ui/collection_editor/CollectionDetailsForm.tsx +17 -18
  14. package/src/ui/collection_editor/CollectionEditorDialog.tsx +13 -9
  15. package/src/ui/collection_editor/CollectionEditorWelcomeView.tsx +1 -1
  16. package/src/ui/collection_editor/CollectionPropertiesEditorForm.tsx +26 -9
  17. package/src/ui/collection_editor/EnumForm.tsx +3 -4
  18. package/src/ui/collection_editor/PropertyEditView.tsx +4 -4
  19. package/src/ui/collection_editor/SubcollectionsEditTab.tsx +1 -2
  20. package/src/ui/collection_editor/import/CollectionEditorImportMapping.tsx +1 -1
  21. package/src/ui/collection_editor/properties/CommonPropertyFields.tsx +7 -8
  22. package/src/ui/collection_editor/properties/DateTimePropertyField.tsx +7 -8
  23. package/src/ui/collection_editor/properties/MapPropertyField.tsx +3 -4
  24. package/src/ui/collection_editor/properties/ReferencePropertyField.tsx +4 -6
  25. package/src/ui/collection_editor/properties/validation/StringPropertyValidation.tsx +3 -4
  26. package/src/ui/collection_editor/utils/supported_fields.tsx +3 -3
  27. package/src/useCollectionEditorPlugin.tsx +2 -4
  28. package/dist/ui/collection_editor/properties/FieldHelperView.d.ts +0 -4
  29. package/src/ui/collection_editor/properties/FieldHelperView.tsx +0 -13
@@ -1,11 +1,10 @@
1
1
  import React, { useCallback, useState } from "react";
2
- import { MapProperty, Property, PropertyConfig, } from "@firecms/core";
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";
5
5
  import { getIn, useFormex } from "@firecms/formex";
6
6
  import { PropertyTree } from "../PropertyTree";
7
7
  import { getFullId, idToPropertiesPath, namespaceToPropertiesOrderPath, namespaceToPropertiesPath } from "../util";
8
- import { FieldHelperView } from "./FieldHelperView";
9
8
 
10
9
  export function MapPropertyField({ disabled, getData, allowDataInference, propertyConfigs, collectionEditable }: {
11
10
  disabled: boolean;
@@ -113,9 +112,9 @@ export function MapPropertyField({ disabled, getData, allowDataInference, proper
113
112
  onValueChange={(v) => setFieldValue("spreadChildren", v)}
114
113
  value={values.spreadChildren ?? false}
115
114
  />
116
- <FieldHelperView>
115
+ <FieldCaption>
117
116
  Set this flag to true if you want to display the children of this group as individual columns.
118
- </FieldHelperView>
117
+ </FieldCaption>
119
118
  </div>
120
119
 
121
120
  <PropertyFormDialog
@@ -1,8 +1,7 @@
1
1
  import React from "react";
2
2
  import { Field, getIn, useFormex } from "@firecms/formex";
3
- import { IconForView, NumberProperty, StringProperty, useNavigationController } from "@firecms/core";
3
+ import { FieldCaption, IconForView, NumberProperty, StringProperty, useNavigationController } from "@firecms/core";
4
4
  import { CircularProgress, Select, SelectGroup, SelectItem, Typography, } from "@firecms/ui";
5
- import { FieldHelperView } from "./FieldHelperView";
6
5
 
7
6
  export function ReferencePropertyField({
8
7
  existing,
@@ -40,7 +39,7 @@ export function ReferencePropertyField({
40
39
  <Field name={pathPath}
41
40
  pathPath={pathPath}
42
41
  type="select"
43
- disabled={existing || disabled}
42
+ disabled={(existing && Boolean(pathValue)) || disabled}
44
43
  value={pathValue}
45
44
  error={pathError}
46
45
  handleChange={handleChange}
@@ -52,7 +51,6 @@ export function ReferencePropertyField({
52
51
  );
53
52
  }
54
53
 
55
-
56
54
  export function CollectionsSelect({
57
55
  disabled,
58
56
  pathPath,
@@ -153,10 +151,10 @@ export function CollectionsSelect({
153
151
 
154
152
  </Select>
155
153
 
156
- <FieldHelperView>
154
+ <FieldCaption>
157
155
  You can only edit the reference collection upon field
158
156
  creation.
159
- </FieldHelperView>
157
+ </FieldCaption>
160
158
  </>
161
159
  );
162
160
  }
@@ -1,10 +1,9 @@
1
1
  import React from "react";
2
2
 
3
3
  import { Field, FormexFieldProps, getIn, useFormex } from "@firecms/formex";
4
- import { serializeRegExp } from "@firecms/core";
4
+ import { FieldCaption, serializeRegExp } from "@firecms/core";
5
5
  import { DebouncedTextField, } from "@firecms/ui";
6
6
  import { GeneralPropertyValidation } from "./GeneralPropertyValidation";
7
- import { FieldHelperView } from "../FieldHelperView";
8
7
  import { SwitchControl } from "../../SwitchControl";
9
8
 
10
9
  export function StringPropertyValidation({
@@ -140,9 +139,9 @@ export function StringPropertyValidation({
140
139
  disabled={disabled}
141
140
  value={matchesStringValue}
142
141
  error={Boolean(matchesError)}/>
143
- <FieldHelperView error={Boolean(matchesError)}>
142
+ <FieldCaption error={Boolean(matchesError)}>
144
143
  {matchesError ? "Not a valid regexp" : "e.g. /^\\d+$/ for digits only"}
145
- </FieldHelperView>
144
+ </FieldCaption>
146
145
  </div>}
147
146
 
148
147
  </div>
@@ -1,6 +1,6 @@
1
- import { DEFAULT_FIELD_CONFIGS, FieldConfigId, PropertyConfig } from "@firecms/core";
1
+ import { DEFAULT_FIELD_CONFIGS, PropertyConfigId, PropertyConfig } from "@firecms/core";
2
2
 
3
- export const supportedFieldsIds: FieldConfigId[] = [
3
+ export const supportedFieldsIds: PropertyConfigId[] = [
4
4
  "text_field",
5
5
  "multiline",
6
6
  "markdown",
@@ -24,6 +24,6 @@ export const supportedFieldsIds: FieldConfigId[] = [
24
24
  ];
25
25
 
26
26
  export const supportedFields: Record<string, PropertyConfig> = Object.entries(DEFAULT_FIELD_CONFIGS)
27
- .filter(([id]) => supportedFieldsIds.includes(id as FieldConfigId))
27
+ .filter(([id]) => supportedFieldsIds.includes(id as PropertyConfigId))
28
28
  .map(([id, config]) => ({ [id]: config }))
29
29
  .reduce((a, b) => ({ ...a, ...b }), {});
@@ -81,11 +81,8 @@ export function useCollectionEditorPlugin<EC extends PersistedCollection = Persi
81
81
  }: CollectionConfigControllerProps<EC, UserType>): FireCMSPlugin<any, any, PersistedCollection> {
82
82
 
83
83
  return {
84
- name: "Collection Editor",
84
+ key: "collection_editor",
85
85
  loading: collectionConfigController.loading,
86
- collections: {
87
- CollectionActions: EditorCollectionAction
88
- },
89
86
  provider: {
90
87
  Component: ConfigControllerProvider,
91
88
  props: {
@@ -108,6 +105,7 @@ export function useCollectionEditorPlugin<EC extends PersistedCollection = Persi
108
105
  AdditionalCards: introMode ? undefined : NewCollectionCard,
109
106
  },
110
107
  collectionView: {
108
+ CollectionActions: EditorCollectionAction,
111
109
  HeaderAction: CollectionViewHeaderAction,
112
110
  AddColumnComponent: PropertyAddColumnComponent
113
111
  }
@@ -1,4 +0,0 @@
1
- export declare function FieldHelperView({ error, children }: {
2
- error?: boolean;
3
- children?: React.ReactNode;
4
- }): import("react/jsx-runtime").JSX.Element | null;
@@ -1,13 +0,0 @@
1
- import { Typography } from "@firecms/ui";
2
-
3
- export function FieldHelperView({
4
- error,
5
- children
6
- }: { error?: boolean, children?: React.ReactNode }) {
7
- if (!children) return null;
8
- return (
9
- <Typography variant={"caption"} color={error ? "error" : "secondary"} className={"ml-3.5 mt-0.5"}>
10
- {children}
11
- </Typography>
12
- );
13
- }