@firecms/collection_editor 3.0.0-canary.235 → 3.0.0-canary.239

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.
@@ -34,5 +34,4 @@ export interface CollectionEditorController {
34
34
  existingEntities: Entity<any>[];
35
35
  }) => void;
36
36
  configPermissions: CollectionEditorPermissionsBuilder;
37
- getPathSuggestions?: (path: string) => Promise<string[]>;
38
37
  }
@@ -6,7 +6,7 @@ export declare function CollectionEditorWelcomeView({ path, pathSuggestions, par
6
6
  parentCollection?: EntityCollection;
7
7
  onContinue: (importData?: object[], propertiesOrder?: string[]) => void;
8
8
  existingCollectionPaths?: string[];
9
- }): import("react/jsx-runtime").JSX.Element;
9
+ }): import("react/jsx-runtime").JSX.Element | null;
10
10
  export declare function TemplateButton({ title, subtitle, icon, onClick }: {
11
11
  title: string;
12
12
  icon: React.ReactNode;
@@ -25,11 +25,11 @@ export interface CollectionConfigControllerProps<EC extends PersistedCollection
25
25
  }>;
26
26
  icon: React.ReactNode;
27
27
  };
28
- getPathSuggestions?: (path?: string) => Promise<string[]>;
29
28
  collectionInference?: CollectionInference;
30
29
  getData?: (path: string, parentPaths: string[]) => Promise<object[]>;
31
30
  getUser?: (uid: string) => USER | null;
32
31
  onAnalyticsEvent?: (event: string, params?: object) => void;
32
+ includeIntroView?: boolean;
33
33
  }
34
34
  /**
35
35
  * Use this hook to initialise the Collection Editor plugin.
@@ -42,5 +42,5 @@ export interface CollectionConfigControllerProps<EC extends PersistedCollection
42
42
  * @param getUser
43
43
  * @param collectionInference
44
44
  */
45
- export declare function useCollectionEditorPlugin<EC extends PersistedCollection = PersistedCollection, USER extends User = User>({ collectionConfigController, configPermissions, reservedGroups, extraView, getPathSuggestions, getUser, collectionInference, getData, onAnalyticsEvent, }: CollectionConfigControllerProps<EC, USER>): FireCMSPlugin<any, any, PersistedCollection>;
46
- export declare function IntroWidget({}: {}): import("react/jsx-runtime").JSX.Element | null;
45
+ export declare function useCollectionEditorPlugin<EC extends PersistedCollection = PersistedCollection, USER extends User = User>({ collectionConfigController, configPermissions, reservedGroups, extraView, getUser, collectionInference, getData, onAnalyticsEvent, includeIntroView }: CollectionConfigControllerProps<EC, USER>): FireCMSPlugin<any, any, PersistedCollection>;
46
+ export declare function IntroWidget(): import("react/jsx-runtime").JSX.Element | null;
package/package.json CHANGED
@@ -1,18 +1,18 @@
1
1
  {
2
2
  "name": "@firecms/collection_editor",
3
3
  "type": "module",
4
- "version": "3.0.0-canary.235",
4
+ "version": "3.0.0-canary.239",
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_export": "^3.0.0-canary.235",
11
- "@firecms/data_import": "^3.0.0-canary.235",
12
- "@firecms/data_import_export": "^3.0.0-canary.235",
13
- "@firecms/formex": "^3.0.0-canary.235",
14
- "@firecms/schema_inference": "^3.0.0-canary.235",
15
- "@firecms/ui": "^3.0.0-canary.235",
10
+ "@firecms/data_export": "^3.0.0-canary.239",
11
+ "@firecms/data_import": "^3.0.0-canary.239",
12
+ "@firecms/data_import_export": "^3.0.0-canary.239",
13
+ "@firecms/formex": "^3.0.0-canary.239",
14
+ "@firecms/schema_inference": "^3.0.0-canary.239",
15
+ "@firecms/ui": "^3.0.0-canary.239",
16
16
  "@hello-pangea/dnd": "^17.0.0",
17
17
  "json5": "^2.2.3",
18
18
  "prism-react-renderer": "^2.4.1"
@@ -70,5 +70,5 @@
70
70
  "publishConfig": {
71
71
  "access": "public"
72
72
  },
73
- "gitHead": "d3f4ac352f53c76f2b8631e6d0cccec533dd5826"
73
+ "gitHead": "28e265bdb20ddd0d2eb813e9cbc2c082e17c2c65"
74
74
  }
@@ -49,8 +49,6 @@ export interface ConfigControllerProviderProps {
49
49
  icon: React.ReactNode
50
50
  };
51
51
 
52
- getPathSuggestions?: (path?: string) => Promise<string[]>;
53
-
54
52
  getUser?: (uid: string) => User | null
55
53
 
56
54
  getData?: (path: string, parentPaths: string[]) => Promise<object[]>;
@@ -67,7 +65,6 @@ export const ConfigControllerProvider = React.memo(
67
65
  reservedGroups,
68
66
  collectionInference,
69
67
  extraView,
70
- getPathSuggestions,
71
68
  getUser,
72
69
  getData,
73
70
  onAnalyticsEvent,
@@ -230,7 +227,6 @@ export const ConfigControllerProvider = React.memo(
230
227
  createCollection,
231
228
  editProperty,
232
229
  configPermissions: configPermissions ?? defaultConfigPermissions,
233
- getPathSuggestions,
234
230
  }}>
235
231
 
236
232
  {children}
@@ -244,7 +240,6 @@ export const ConfigControllerProvider = React.memo(
244
240
  getData={getData}
245
241
  reservedGroups={reservedGroups}
246
242
  extraView={extraView}
247
- pathSuggestions={getPathSuggestions}
248
243
  getUser={getUser}
249
244
  handleClose={(collection) => {
250
245
  if (currentDialog?.redirect) {
@@ -41,6 +41,4 @@ export interface CollectionEditorController {
41
41
 
42
42
  configPermissions: CollectionEditorPermissionsBuilder;
43
43
 
44
- getPathSuggestions?: (path: string) => Promise<string[]>;
45
-
46
44
  }
@@ -218,6 +218,25 @@ export function CollectionDetailsForm({
218
218
  value={values.openEntityMode ?? "side_panel"}
219
219
  onChange={(value) => setFieldValue("openEntityMode", value)}/>
220
220
 
221
+ <div className={"col-span-12"}>
222
+ <BooleanSwitchWithLabel
223
+ position={"start"}
224
+ size={"large"}
225
+ allowIndeterminate={true}
226
+ label={values.history === null ? "Document history revisions enabled if enabled globally" : (
227
+ values.history ? "Document history revisions ENABLED" : "Document history revisions NOT enabled"
228
+ )}
229
+ onValueChange={(v) => setFieldValue("history", v)}
230
+ value={values.history ?? null}
231
+ />
232
+ <FieldCaption>
233
+ When enabled, each document in this collection will have a history of changes.
234
+ This is useful for auditing purposes. The data is stored in a subcollection of the document
235
+ in your database, called <b>__history</b>.
236
+ </FieldCaption>
237
+ </div>
238
+
239
+
221
240
  <div className={"col-span-12 mt-8"}>
222
241
  <ExpandablePanel
223
242
  expanded={advancedPanelExpanded}
@@ -37,18 +37,6 @@ export function CollectionEditorWelcomeView({
37
37
  }
38
38
  }, [existingCollectionPaths, path, pathSuggestions]);
39
39
 
40
- // const {
41
- // values,
42
- // setFieldValue,
43
- // setValues,
44
- // handleChange,
45
- // touched,
46
- // errors,
47
- // setFieldTouched,
48
- // isSubmitting,
49
- // submitCount
50
- // } = useFormex<EntityCollection>();
51
-
52
40
  const {
53
41
  values,
54
42
  setFieldValue,
@@ -56,6 +44,11 @@ export function CollectionEditorWelcomeView({
56
44
  submitCount
57
45
  } = useFormex<EntityCollection>();
58
46
 
47
+ const noSuggestions = !loadingPathSuggestions && (filteredPathSuggestions ?? [])?.length === 0;
48
+ if (!noSuggestions) {
49
+ return null;
50
+ }
51
+
59
52
  return (
60
53
  <div className={"overflow-auto my-auto"}>
61
54
  <Container maxWidth={"4xl"} className={"flex flex-col gap-4 p-8 m-auto"}>
@@ -97,12 +90,6 @@ export function CollectionEditorWelcomeView({
97
90
  </Chip>
98
91
  ))}
99
92
 
100
- {!loadingPathSuggestions && (filteredPathSuggestions ?? [])?.length === 0 &&
101
- <Typography variant={"caption"}>
102
- No suggestions
103
- </Typography>
104
- }
105
-
106
93
  </div>
107
94
 
108
95
  </div>
@@ -202,9 +189,6 @@ export function TemplateButton({
202
189
  <Typography variant={"subtitle1"}>
203
190
  {title}
204
191
  </Typography>
205
- {/*<Typography>*/}
206
- {/* {subtitle}*/}
207
- {/*</Typography>*/}
208
192
 
209
193
  </div>
210
194
  </Card>
@@ -41,8 +41,6 @@ export interface CollectionConfigControllerProps<EC extends PersistedCollection
41
41
  icon: React.ReactNode
42
42
  };
43
43
 
44
- getPathSuggestions?: (path?: string) => Promise<string[]>;
45
-
46
44
  collectionInference?: CollectionInference;
47
45
 
48
46
  getData?: (path: string, parentPaths: string[]) => Promise<object[]>;
@@ -51,6 +49,8 @@ export interface CollectionConfigControllerProps<EC extends PersistedCollection
51
49
 
52
50
  onAnalyticsEvent?: (event: string, params?: object) => void;
53
51
 
52
+ includeIntroView?: boolean;
53
+
54
54
  }
55
55
 
56
56
  /**
@@ -70,11 +70,11 @@ export function useCollectionEditorPlugin<EC extends PersistedCollection = Persi
70
70
  configPermissions,
71
71
  reservedGroups,
72
72
  extraView,
73
- getPathSuggestions,
74
73
  getUser,
75
74
  collectionInference,
76
75
  getData,
77
76
  onAnalyticsEvent,
77
+ includeIntroView = true
78
78
  }: CollectionConfigControllerProps<EC, USER>): FireCMSPlugin<any, any, PersistedCollection> {
79
79
 
80
80
  return {
@@ -88,7 +88,6 @@ export function useCollectionEditorPlugin<EC extends PersistedCollection = Persi
88
88
  collectionInference,
89
89
  reservedGroups,
90
90
  extraView,
91
- getPathSuggestions,
92
91
  getUser,
93
92
  getData,
94
93
  onAnalyticsEvent,
@@ -96,7 +95,7 @@ export function useCollectionEditorPlugin<EC extends PersistedCollection = Persi
96
95
  },
97
96
  homePage: {
98
97
  additionalActions: <NewCollectionButton/>,
99
- additionalChildrenStart: <IntroWidget/>,
98
+ additionalChildrenStart: includeIntroView ? <IntroWidget/> : undefined,
100
99
  // additionalChildrenEnd: <RootCollectionSuggestions introMode={introMode}/>,
101
100
  CollectionActions: HomePageEditorCollectionAction,
102
101
  AdditionalCards: NewCollectionCard,
@@ -110,7 +109,7 @@ export function useCollectionEditorPlugin<EC extends PersistedCollection = Persi
110
109
  };
111
110
  }
112
111
 
113
- export function IntroWidget({}: {}) {
112
+ export function IntroWidget() {
114
113
 
115
114
  const navigation = useNavigationController();
116
115
  if (!navigation.topLevelNavigation)
@@ -1,4 +1,5 @@
1
1
  import {
2
+ EntityCallbacks,
2
3
  EntityCollection,
3
4
  joinCollectionLists,
4
5
  makePropertiesEditable,