@firecms/collection_editor 3.0.0-canary.248 → 3.0.0-canary.249

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 { CMSType, Property } from "@firecms/core";
1
+ import { CMSType, NavigationGroupMapping, Property } from "@firecms/core";
2
2
  import { PersistedCollection } from "./persisted_collection";
3
3
  /**
4
4
  * Use this controller to access the configuration that is stored externally,
@@ -17,6 +17,8 @@ export interface CollectionsConfigController {
17
17
  saveProperty: (params: SavePropertyParams) => Promise<void>;
18
18
  deleteProperty: (params: DeletePropertyParams) => Promise<void>;
19
19
  deleteCollection: (props: DeleteCollectionParams) => Promise<void>;
20
+ navigationEntries: NavigationGroupMapping[];
21
+ saveNavigationEntries: (entries: NavigationGroupMapping[]) => Promise<void>;
20
22
  }
21
23
  export type UpdateCollectionParams<M extends Record<string, any>> = {
22
24
  id: string;
@@ -1,8 +1,9 @@
1
- export declare function ReferencePropertyField({ existing, multiple, disabled, showErrors }: {
1
+ export declare function ReferencePropertyField({ existing, multiple, disabled, showErrors, asString }: {
2
2
  existing: boolean;
3
3
  multiple: boolean;
4
4
  disabled: boolean;
5
5
  showErrors: boolean;
6
+ asString?: boolean;
6
7
  }): import("react/jsx-runtime").JSX.Element;
7
8
  export declare function CollectionsSelect({ disabled, pathPath, value, handleChange, error, ...props }: {
8
9
  disabled: boolean;
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.248",
4
+ "version": "3.0.0-canary.249",
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.248",
11
- "@firecms/data_import": "^3.0.0-canary.248",
12
- "@firecms/data_import_export": "^3.0.0-canary.248",
13
- "@firecms/formex": "^3.0.0-canary.248",
14
- "@firecms/schema_inference": "^3.0.0-canary.248",
15
- "@firecms/ui": "^3.0.0-canary.248",
10
+ "@firecms/data_export": "^3.0.0-canary.249",
11
+ "@firecms/data_import": "^3.0.0-canary.249",
12
+ "@firecms/data_import_export": "^3.0.0-canary.249",
13
+ "@firecms/formex": "^3.0.0-canary.249",
14
+ "@firecms/schema_inference": "^3.0.0-canary.249",
15
+ "@firecms/ui": "^3.0.0-canary.249",
16
16
  "json5": "^2.2.3",
17
17
  "prism-react-renderer": "^2.4.1"
18
18
  },
@@ -69,5 +69,5 @@
69
69
  "publishConfig": {
70
70
  "access": "public"
71
71
  },
72
- "gitHead": "466985640b3a605bf94f53b263cab1821ff24dd0"
72
+ "gitHead": "5a61d7000af7d369373142087ee99792178a2c6f"
73
73
  }
@@ -1,4 +1,4 @@
1
- import { CMSType, Property } from "@firecms/core";
1
+ import { CMSType, NavigationGroupMapping, Property } from "@firecms/core";
2
2
  import { PersistedCollection } from "./persisted_collection";
3
3
 
4
4
  /**
@@ -21,6 +21,9 @@ export interface CollectionsConfigController {
21
21
 
22
22
  deleteCollection: (props: DeleteCollectionParams) => Promise<void>;
23
23
 
24
+ navigationEntries: NavigationGroupMapping[];
25
+ saveNavigationEntries: (entries: NavigationGroupMapping[]) => Promise<void>;
26
+
24
27
  }
25
28
 
26
29
  export type UpdateCollectionParams<M extends Record<string, any>> = {
@@ -163,7 +163,7 @@ export function CollectionDetailsForm({
163
163
  </FieldCaption>
164
164
  </div>
165
165
 
166
- <div className={cls("col-span-12 ", isSubcollection ? "" : "sm:col-span-8")}>
166
+ <div className={cls("col-span-12 ")}>
167
167
  <Field name={"path"}
168
168
  as={DebouncedTextField}
169
169
  label={"Path"}
@@ -179,40 +179,40 @@ export function CollectionDetailsForm({
179
179
 
180
180
  </div>
181
181
 
182
- {!isSubcollection && <div className={"col-span-12 sm:col-span-4 relative"}>
183
-
184
- <TextField error={showErrors && Boolean(errors.group)}
185
- disabled={isSubmitting}
186
- value={values.group ?? ""}
187
- autoComplete="off"
188
- onChange={(event) => setFieldValue("group", event.target.value)}
189
- name={"group"}
190
- inputRef={groupRef}
191
- label="Group"/>
192
- <Autocomplete
193
- open={autoCompleteOpen && (groupOptions ?? []).length > 0}
194
- setOpen={setAutoCompleteOpen}>
195
- {groupOptions?.map((group, index) => {
196
- return <AutocompleteItem
197
- key={index + "_" + group}
198
- className={"pr-6 pl-14"}
199
- onClick={() => {
200
- setAutoCompleteOpen(false);
201
- setFieldValue("group", group ?? null);
202
- }}
203
- >
204
- <div className={"flex-grow"}>
205
- {group}
206
- </div>
207
- </AutocompleteItem>;
208
- })}
209
- </Autocomplete>
210
- <FieldCaption>
211
- {showErrors && Boolean(errors.group) ? errors.group : "Group in the home page"}
212
- </FieldCaption>
213
-
214
-
215
- </div>}
182
+ {/*{!isSubcollection && <div className={"col-span-12 sm:col-span-4 relative"}>*/}
183
+
184
+ {/* <TextField error={showErrors && Boolean(errors.group)}*/}
185
+ {/* disabled={isSubmitting}*/}
186
+ {/* value={values.group ?? ""}*/}
187
+ {/* autoComplete="off"*/}
188
+ {/* onChange={(event) => setFieldValue("group", event.target.value)}*/}
189
+ {/* name={"group"}*/}
190
+ {/* inputRef={groupRef}*/}
191
+ {/* label="Group"/>*/}
192
+ {/* <Autocomplete*/}
193
+ {/* open={autoCompleteOpen && (groupOptions ?? []).length > 0}*/}
194
+ {/* setOpen={setAutoCompleteOpen}>*/}
195
+ {/* {groupOptions?.map((group, index) => {*/}
196
+ {/* return <AutocompleteItem*/}
197
+ {/* key={index + "_" + group}*/}
198
+ {/* className={"pr-6 pl-14"}*/}
199
+ {/* onClick={() => {*/}
200
+ {/* setAutoCompleteOpen(false);*/}
201
+ {/* setFieldValue("group", group ?? null);*/}
202
+ {/* }}*/}
203
+ {/* >*/}
204
+ {/* <div className={"flex-grow"}>*/}
205
+ {/* {group}*/}
206
+ {/* </div>*/}
207
+ {/* </AutocompleteItem>;*/}
208
+ {/* })}*/}
209
+ {/* </Autocomplete>*/}
210
+ {/* <FieldCaption>*/}
211
+ {/* {showErrors && Boolean(errors.group) ? errors.group : "Group in the home page"}*/}
212
+ {/* </FieldCaption>*/}
213
+
214
+
215
+ {/*</div>}*/}
216
216
 
217
217
  <LayoutModeSwitch
218
218
  className={"col-span-12"}
@@ -17,7 +17,7 @@ import {
17
17
  randomString,
18
18
  removeInitialAndTrailingSlashes,
19
19
  removeUndefined,
20
- TopNavigationResult,
20
+ NavigationResult,
21
21
  useAuthController,
22
22
  useCustomizationController,
23
23
  useNavigationController,
@@ -184,7 +184,7 @@ export function CollectionEditor(props: CollectionEditorDialogProps & {
184
184
 
185
185
  const {
186
186
  groups
187
- }: TopNavigationResult = topLevelNavigation;
187
+ }: NavigationResult = topLevelNavigation;
188
188
 
189
189
  const initialCollection = collection
190
190
  ? {
@@ -461,6 +461,13 @@ function PropertyEditFormFields({
461
461
  existing={existing}
462
462
  multiple={false}
463
463
  disabled={disabled}/>;
464
+ } else if (selectedFieldConfigId === "reference_as_string") {
465
+ childComponent =
466
+ <ReferencePropertyField showErrors={showErrors}
467
+ existing={existing}
468
+ asString={true}
469
+ multiple={false}
470
+ disabled={disabled}/>;
464
471
  } else if (selectedFieldConfigId === "date_time") {
465
472
  childComponent = <DateTimePropertyField disabled={disabled}/>;
466
473
  } else if (selectedFieldConfigId === "multi_references") {
@@ -605,6 +612,7 @@ const WIDGET_TYPE_MAP: Record<PropertyConfigId, string> = {
605
612
  file_upload: "File",
606
613
  multi_file_upload: "File",
607
614
  reference: "Reference",
615
+ reference_as_string: "Text",
608
616
  multi_references: "Reference",
609
617
  date_time: "Date",
610
618
  group: "Group",
@@ -762,7 +770,7 @@ export function WidgetSelectViewItem({
762
770
 
763
771
  return <Card
764
772
  onClick={onClick}
765
- className={"flex flex-row items-center px-4 py-2"}>
773
+ className={"flex flex-row items-center px-4 py-2 m-1"}>
766
774
  <div
767
775
  className={cls(
768
776
  "flex flex-row items-center text-base min-h-[48px]",
@@ -54,6 +54,7 @@ export function PropertyFieldPreview({
54
54
  </div>
55
55
  <Paper
56
56
  className={cls(
57
+ "m-1",
57
58
  "border",
58
59
  "pl-2 w-full flex flex-row gap-4 items-center",
59
60
  cardMixin,
@@ -7,12 +7,14 @@ export function ReferencePropertyField({
7
7
  existing,
8
8
  multiple,
9
9
  disabled,
10
- showErrors
10
+ showErrors,
11
+ asString
11
12
  }: {
12
13
  existing: boolean,
13
14
  multiple: boolean,
14
15
  disabled: boolean,
15
- showErrors: boolean
16
+ showErrors: boolean,
17
+ asString?: boolean
16
18
  }) {
17
19
 
18
20
  const {
@@ -28,7 +30,7 @@ export function ReferencePropertyField({
28
30
  <CircularProgress/>
29
31
  </div>;
30
32
 
31
- const pathPath = multiple ? "of.path" : "path";
33
+ const pathPath = asString ? "reference.path" : (multiple ? "of.path" : "path") ;
32
34
  const pathValue: string | undefined = getIn(values, pathPath);
33
35
  const pathError: string | undefined = showErrors && getIn(errors, pathPath);
34
36
 
@@ -14,6 +14,7 @@ export const supportedFieldsIds: PropertyConfigId[] = [
14
14
  "file_upload",
15
15
  "multi_file_upload",
16
16
  "reference",
17
+ "reference_as_string",
17
18
  "multi_references",
18
19
  "switch",
19
20
  "date_time",
@@ -208,6 +208,15 @@ export function updatePropertyFromWidget(propertyData: any,
208
208
  editable: propertyData.editable !== undefined ? propertyData.editable : true
209
209
  } satisfies Property
210
210
  );
211
+ } else if (selectedWidgetId === "reference_as_string") {
212
+ updatedProperty = mergeDeep(
213
+ propertyData,
214
+ {
215
+ dataType: "string",
216
+ propertyConfig: "reference_as_string",
217
+ editable: propertyData.editable !== undefined ? propertyData.editable : true
218
+ } satisfies Property
219
+ );
211
220
  } else if (selectedWidgetId === "multi_references") {
212
221
  updatedProperty = mergeDeep(
213
222
  propertyData,
@@ -96,9 +96,11 @@ export function useCollectionEditorPlugin<EC extends PersistedCollection = Persi
96
96
  homePage: {
97
97
  additionalActions: <NewCollectionButton/>,
98
98
  additionalChildrenStart: includeIntroView ? <IntroWidget/> : undefined,
99
- // additionalChildrenEnd: <RootCollectionSuggestions introMode={introMode}/>,
100
99
  CollectionActions: HomePageEditorCollectionAction,
101
100
  AdditionalCards: NewCollectionCard,
101
+ allowDragAndDrop: true,
102
+ navigationEntries: collectionConfigController.navigationEntries,
103
+ onNavigationEntriesUpdate: collectionConfigController.saveNavigationEntries,
102
104
  },
103
105
  collectionView: {
104
106
  CollectionActionsStart: EditorCollectionActionStart,