@firecms/collection_editor 3.0.0-alpha.31 → 3.0.0-alpha.33

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 (114) hide show
  1. package/dist/index.d.ts +2 -2
  2. package/dist/index.es.js +910 -802
  3. package/dist/index.es.js.map +1 -1
  4. package/dist/index.umd.js +1 -1
  5. package/dist/index.umd.js.map +1 -1
  6. package/dist/ui/collection_editor/GetCodeDialog.d.ts +5 -0
  7. package/dist/ui/collection_editor/utils/strings.d.ts +1 -0
  8. package/package.json +6 -4
  9. package/src/ConfigControllerProvider.tsx +2 -2
  10. package/src/index.ts +2 -2
  11. package/src/{components → ui}/collection_editor/CollectionPropertiesEditorForm.tsx +25 -8
  12. package/src/ui/collection_editor/GetCodeDialog.tsx +118 -0
  13. package/src/{components → ui}/collection_editor/PropertyFieldPreview.tsx +0 -4
  14. package/src/{components → ui}/collection_editor/PropertyTree.tsx +1 -1
  15. package/src/ui/collection_editor/utils/strings.ts +8 -0
  16. package/src/useCollectionEditorPlugin.tsx +6 -6
  17. package/src/utils/join_collections.ts +10 -2
  18. /package/dist/{components → ui}/CollectionViewHeaderAction.d.ts +0 -0
  19. /package/dist/{components → ui}/EditorCollectionAction.d.ts +0 -0
  20. /package/dist/{components → ui}/HomePageEditorCollectionAction.d.ts +0 -0
  21. /package/dist/{components → ui}/MissingReferenceWidget.d.ts +0 -0
  22. /package/dist/{components → ui}/NewCollectionCard.d.ts +0 -0
  23. /package/dist/{components → ui}/PropertyAddColumnComponent.d.ts +0 -0
  24. /package/dist/{components → ui}/RootCollectionSuggestions.d.ts +0 -0
  25. /package/dist/{components → ui}/collection_editor/CollectionDetailsForm.d.ts +0 -0
  26. /package/dist/{components → ui}/collection_editor/CollectionEditorDialog.d.ts +0 -0
  27. /package/dist/{components → ui}/collection_editor/CollectionEditorWelcomeView.d.ts +0 -0
  28. /package/dist/{components → ui}/collection_editor/CollectionPropertiesEditorForm.d.ts +0 -0
  29. /package/dist/{components → ui}/collection_editor/CollectionYupValidation.d.ts +0 -0
  30. /package/dist/{components → ui}/collection_editor/EntityCustomViewsSelectDialog.d.ts +0 -0
  31. /package/dist/{components → ui}/collection_editor/EnumForm.d.ts +0 -0
  32. /package/dist/{components → ui}/collection_editor/PropertyEditView.d.ts +0 -0
  33. /package/dist/{components → ui}/collection_editor/PropertyFieldPreview.d.ts +0 -0
  34. /package/dist/{components → ui}/collection_editor/PropertySelectItem.d.ts +0 -0
  35. /package/dist/{components → ui}/collection_editor/PropertyTree.d.ts +0 -0
  36. /package/dist/{components → ui}/collection_editor/SelectIcons.d.ts +0 -0
  37. /package/dist/{components → ui}/collection_editor/SubcollectionsEditTab.d.ts +0 -0
  38. /package/dist/{components → ui}/collection_editor/UnsavedChangesDialog.d.ts +0 -0
  39. /package/dist/{components → ui}/collection_editor/import/CollectionEditorImportDataPreview.d.ts +0 -0
  40. /package/dist/{components → ui}/collection_editor/import/CollectionEditorImportMapping.d.ts +0 -0
  41. /package/dist/{components → ui}/collection_editor/import/clean_import_data.d.ts +0 -0
  42. /package/dist/{components → ui}/collection_editor/properties/BlockPropertyField.d.ts +0 -0
  43. /package/dist/{components → ui}/collection_editor/properties/BooleanPropertyField.d.ts +0 -0
  44. /package/dist/{components → ui}/collection_editor/properties/CommonPropertyFields.d.ts +0 -0
  45. /package/dist/{components → ui}/collection_editor/properties/DateTimePropertyField.d.ts +0 -0
  46. /package/dist/{components → ui}/collection_editor/properties/EnumPropertyField.d.ts +0 -0
  47. /package/dist/{components → ui}/collection_editor/properties/FieldHelperView.d.ts +0 -0
  48. /package/dist/{components → ui}/collection_editor/properties/KeyValuePropertyField.d.ts +0 -0
  49. /package/dist/{components → ui}/collection_editor/properties/MapPropertyField.d.ts +0 -0
  50. /package/dist/{components → ui}/collection_editor/properties/NumberPropertyField.d.ts +0 -0
  51. /package/dist/{components → ui}/collection_editor/properties/ReferencePropertyField.d.ts +0 -0
  52. /package/dist/{components → ui}/collection_editor/properties/RepeatPropertyField.d.ts +0 -0
  53. /package/dist/{components → ui}/collection_editor/properties/StoragePropertyField.d.ts +0 -0
  54. /package/dist/{components → ui}/collection_editor/properties/StringPropertyField.d.ts +0 -0
  55. /package/dist/{components → ui}/collection_editor/properties/advanced/AdvancedPropertyValidation.d.ts +0 -0
  56. /package/dist/{components → ui}/collection_editor/properties/validation/ArrayPropertyValidation.d.ts +0 -0
  57. /package/dist/{components → ui}/collection_editor/properties/validation/GeneralPropertyValidation.d.ts +0 -0
  58. /package/dist/{components → ui}/collection_editor/properties/validation/NumberPropertyValidation.d.ts +0 -0
  59. /package/dist/{components → ui}/collection_editor/properties/validation/StringPropertyValidation.d.ts +0 -0
  60. /package/dist/{components → ui}/collection_editor/properties/validation/ValidationPanel.d.ts +0 -0
  61. /package/dist/{components → ui}/collection_editor/templates/blog_template.d.ts +0 -0
  62. /package/dist/{components → ui}/collection_editor/templates/products_template.d.ts +0 -0
  63. /package/dist/{components → ui}/collection_editor/templates/users_template.d.ts +0 -0
  64. /package/dist/{components → ui}/collection_editor/util.d.ts +0 -0
  65. /package/dist/{components → ui}/collection_editor/utils/supported_fields.d.ts +0 -0
  66. /package/dist/{components → ui}/collection_editor/utils/update_property_for_widget.d.ts +0 -0
  67. /package/dist/{components → ui}/collection_editor/utils/useTraceUpdate.d.ts +0 -0
  68. /package/src/{components → ui}/CollectionViewHeaderAction.tsx +0 -0
  69. /package/src/{components → ui}/EditorCollectionAction.tsx +0 -0
  70. /package/src/{components → ui}/HomePageEditorCollectionAction.tsx +0 -0
  71. /package/src/{components → ui}/MissingReferenceWidget.tsx +0 -0
  72. /package/src/{components → ui}/NewCollectionCard.tsx +0 -0
  73. /package/src/{components → ui}/PropertyAddColumnComponent.tsx +0 -0
  74. /package/src/{components → ui}/RootCollectionSuggestions.tsx +0 -0
  75. /package/src/{components → ui}/collection_editor/CollectionDetailsForm.tsx +0 -0
  76. /package/src/{components → ui}/collection_editor/CollectionEditorDialog.tsx +0 -0
  77. /package/src/{components → ui}/collection_editor/CollectionEditorWelcomeView.tsx +0 -0
  78. /package/src/{components → ui}/collection_editor/CollectionYupValidation.tsx +0 -0
  79. /package/src/{components → ui}/collection_editor/EntityCustomViewsSelectDialog.tsx +0 -0
  80. /package/src/{components → ui}/collection_editor/EnumForm.tsx +0 -0
  81. /package/src/{components → ui}/collection_editor/PropertyEditView.tsx +0 -0
  82. /package/src/{components → ui}/collection_editor/PropertySelectItem.tsx +0 -0
  83. /package/src/{components → ui}/collection_editor/SelectIcons.tsx +0 -0
  84. /package/src/{components → ui}/collection_editor/SubcollectionsEditTab.tsx +0 -0
  85. /package/src/{components → ui}/collection_editor/UnsavedChangesDialog.tsx +0 -0
  86. /package/src/{components → ui}/collection_editor/import/CollectionEditorImportDataPreview.tsx +0 -0
  87. /package/src/{components → ui}/collection_editor/import/CollectionEditorImportMapping.tsx +0 -0
  88. /package/src/{components → ui}/collection_editor/import/clean_import_data.ts +0 -0
  89. /package/src/{components → ui}/collection_editor/properties/BlockPropertyField.tsx +0 -0
  90. /package/src/{components → ui}/collection_editor/properties/BooleanPropertyField.tsx +0 -0
  91. /package/src/{components → ui}/collection_editor/properties/CommonPropertyFields.tsx +0 -0
  92. /package/src/{components → ui}/collection_editor/properties/DateTimePropertyField.tsx +0 -0
  93. /package/src/{components → ui}/collection_editor/properties/EnumPropertyField.tsx +0 -0
  94. /package/src/{components → ui}/collection_editor/properties/FieldHelperView.tsx +0 -0
  95. /package/src/{components → ui}/collection_editor/properties/KeyValuePropertyField.tsx +0 -0
  96. /package/src/{components → ui}/collection_editor/properties/MapPropertyField.tsx +0 -0
  97. /package/src/{components → ui}/collection_editor/properties/NumberPropertyField.tsx +0 -0
  98. /package/src/{components → ui}/collection_editor/properties/ReferencePropertyField.tsx +0 -0
  99. /package/src/{components → ui}/collection_editor/properties/RepeatPropertyField.tsx +0 -0
  100. /package/src/{components → ui}/collection_editor/properties/StoragePropertyField.tsx +0 -0
  101. /package/src/{components → ui}/collection_editor/properties/StringPropertyField.tsx +0 -0
  102. /package/src/{components → ui}/collection_editor/properties/advanced/AdvancedPropertyValidation.tsx +0 -0
  103. /package/src/{components → ui}/collection_editor/properties/validation/ArrayPropertyValidation.tsx +0 -0
  104. /package/src/{components → ui}/collection_editor/properties/validation/GeneralPropertyValidation.tsx +0 -0
  105. /package/src/{components → ui}/collection_editor/properties/validation/NumberPropertyValidation.tsx +0 -0
  106. /package/src/{components → ui}/collection_editor/properties/validation/StringPropertyValidation.tsx +0 -0
  107. /package/src/{components → ui}/collection_editor/properties/validation/ValidationPanel.tsx +0 -0
  108. /package/src/{components → ui}/collection_editor/templates/blog_template.ts +0 -0
  109. /package/src/{components → ui}/collection_editor/templates/products_template.ts +0 -0
  110. /package/src/{components → ui}/collection_editor/templates/users_template.ts +0 -0
  111. /package/src/{components → ui}/collection_editor/util.ts +0 -0
  112. /package/src/{components → ui}/collection_editor/utils/supported_fields.tsx +0 -0
  113. /package/src/{components → ui}/collection_editor/utils/update_property_for_widget.ts +0 -0
  114. /package/src/{components → ui}/collection_editor/utils/useTraceUpdate.tsx +0 -0
@@ -0,0 +1,5 @@
1
+ export declare function GetCodeDialog({ collection, onOpenChange, open }: {
2
+ onOpenChange: (open: boolean) => void;
3
+ collection: any;
4
+ open: any;
5
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare function camelCase(str: string): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firecms/collection_editor",
3
- "version": "3.0.0-alpha.31",
3
+ "version": "3.0.0-alpha.33",
4
4
  "main": "./dist/index.umd.js",
5
5
  "module": "./dist/index.es.js",
6
6
  "types": "dist/index.d.ts",
@@ -14,8 +14,10 @@
14
14
  "./package.json": "./package.json"
15
15
  },
16
16
  "dependencies": {
17
- "@firecms/data_import": "^3.0.0-alpha.31",
18
- "@firecms/schema_inference": "^3.0.0-alpha.31"
17
+ "@firecms/data_import": "^3.0.0-alpha.33",
18
+ "@firecms/schema_inference": "^3.0.0-alpha.33",
19
+ "json5": "^2.2.3",
20
+ "prism-react-renderer": "^2.3.0"
19
21
  },
20
22
  "peerDependencies": {
21
23
  "react": "^18.2.0",
@@ -76,5 +78,5 @@
76
78
  "publishConfig": {
77
79
  "access": "public"
78
80
  },
79
- "gitHead": "50f21001373521c63e1eea47f551037eb9e4d0c9"
81
+ "gitHead": "6d5339ab786c9e239ff98da651fde4e4f4879f21"
80
82
  }
@@ -10,12 +10,12 @@ import {
10
10
  User,
11
11
  useSnackbarController
12
12
  } from "@firecms/core";
13
- import { CollectionEditorDialog } from "./components/collection_editor/CollectionEditorDialog";
13
+ import { CollectionEditorDialog } from "./ui/collection_editor/CollectionEditorDialog";
14
14
  import { useNavigate } from "react-router";
15
15
  import { CollectionEditorController } from "./types/collection_editor_controller";
16
16
  import { CollectionEditorPermissionsBuilder } from "./types/config_permissions";
17
17
  import { CollectionInference } from "./types/collection_inference";
18
- import { PropertyFormDialog } from "./components/collection_editor/PropertyEditView";
18
+ import { PropertyFormDialog } from "./ui/collection_editor/PropertyEditView";
19
19
  import { PersistedCollection } from "./types/persisted_collection";
20
20
 
21
21
  export const ConfigControllerContext = React.createContext<CollectionsConfigController>({} as any);
package/src/index.ts CHANGED
@@ -30,5 +30,5 @@ export type {
30
30
  CollectionInference
31
31
  } from "./types/collection_inference";
32
32
 
33
- export { MissingReferenceWidget } from "./components/MissingReferenceWidget";
34
- export * from "./components/collection_editor/util";
33
+ export { MissingReferenceWidget } from "./ui/MissingReferenceWidget";
34
+ export * from "./ui/collection_editor/util";
@@ -7,28 +7,31 @@ import {
7
7
  Button,
8
8
  CircularProgress,
9
9
  cn,
10
+ CodeIcon,
10
11
  DebouncedTextField,
11
12
  defaultBorderMixin,
12
13
  EntityCollection,
13
14
  ErrorBoundary,
14
- PropertyConfig,
15
+ IconButton,
15
16
  isPropertyBuilder,
16
17
  makePropertiesEditable,
17
18
  Paper,
18
19
  Properties,
19
20
  Property,
21
+ PropertyConfig,
20
22
  PropertyOrBuilder,
21
23
  Tooltip,
22
24
  Typography,
23
25
  useLargeLayout,
24
26
  User,
25
- useSnackbarController,
27
+ useSnackbarController
26
28
  } from "@firecms/core";
27
29
 
28
30
  import { getFullId, idToPropertiesPath, namespaceToPropertiesOrderPath } from "./util";
29
31
  import { OnPropertyChangedParams, PropertyForm, PropertyFormDialog } from "./PropertyEditView";
30
32
  import { PropertyTree } from "./PropertyTree";
31
33
  import { PersistedCollection } from "../../types/persisted_collection";
34
+ import { GetCodeDialog } from "./GetCodeDialog";
32
35
 
33
36
  type CollectionEditorFormProps = {
34
37
  showErrors: boolean;
@@ -81,6 +84,7 @@ export function CollectionPropertiesEditorForm({
81
84
 
82
85
  const selectedPropertyFullId = selectedPropertyKey ? getFullId(selectedPropertyKey, selectedPropertyNamespace) : undefined;
83
86
  const selectedProperty = selectedPropertyFullId ? getIn(values.properties, selectedPropertyFullId.replaceAll(".", ".properties.")) : undefined;
87
+ const [codeDialogOpen, setCodeDialogOpen] = useState<boolean>(false);
84
88
 
85
89
  const [inferringProperties, setInferringProperties] = useState<boolean>(false);
86
90
 
@@ -112,7 +116,7 @@ export function CollectionPropertiesEditorForm({
112
116
  if (!newCollection) {
113
117
  snackbarController.open({
114
118
  type: "error",
115
- message: "Could not infer properties from data",
119
+ message: "Could not infer properties from data"
116
120
  });
117
121
  return;
118
122
  }
@@ -122,7 +126,7 @@ export function CollectionPropertiesEditorForm({
122
126
  if (newPropertyKeys.length === 0) {
123
127
  snackbarController.open({
124
128
  type: "info",
125
- message: "No new properties found",
129
+ message: "No new properties found"
126
130
  });
127
131
  return;
128
132
  }
@@ -132,7 +136,7 @@ export function CollectionPropertiesEditorForm({
132
136
  acc[propertyKey] = newCollection.properties[propertyKey];
133
137
  return acc;
134
138
  }, {} as { [key: string]: PropertyOrBuilder }),
135
- ...values.properties,
139
+ ...values.properties
136
140
  };
137
141
  const updatedPropertiesOrder = [
138
142
  ...newPropertyKeys,
@@ -323,13 +327,21 @@ export function CollectionPropertiesEditorForm({
323
327
  </div>}
324
328
 
325
329
  <div className="ml-1 mt-2 flex flex-row gap-2">
330
+ <Tooltip title={"Get the code for this collection"}>
331
+ <IconButton
332
+ variant={"filled"}
333
+ disabled={inferringProperties}
334
+ onClick={() => setCodeDialogOpen(true)}>
335
+ <CodeIcon/>
336
+ </IconButton>
337
+ </Tooltip>
326
338
  {inferPropertiesFromData && <Tooltip title={"Add new properties based on data"}>
327
- <Button
328
- variant={"text"}
339
+ <IconButton
340
+ variant={"filled"}
329
341
  disabled={inferringProperties}
330
342
  onClick={inferPropertiesFromData}>
331
343
  {inferringProperties ? <CircularProgress size={"small"}/> : <AutoAwesomeIcon/>}
332
- </Button>
344
+ </IconButton>
333
345
  </Tooltip>}
334
346
  <Tooltip title={"Add new property"}>
335
347
  <Button
@@ -458,6 +470,11 @@ export function CollectionPropertiesEditorForm({
458
470
  collectionEditable={collectionEditable}
459
471
  existingPropertyKeys={values.propertiesOrder as string[]}/>
460
472
 
473
+ <GetCodeDialog
474
+ collection={values}
475
+ open={codeDialogOpen}
476
+ onOpenChange={setCodeDialogOpen}/>
477
+
461
478
  </>
462
479
  );
463
480
  }
@@ -0,0 +1,118 @@
1
+ import {
2
+ Button,
3
+ ContentCopyIcon,
4
+ Dialog,
5
+ DialogActions,
6
+ DialogContent,
7
+ EntityCollection,
8
+ Typography,
9
+ useSnackbarController
10
+ } from "@firecms/core";
11
+ import React from "react";
12
+ import JSON5 from "json5";
13
+ import { Highlight, themes } from "prism-react-renderer"
14
+ import { camelCase } from "./utils/strings";
15
+
16
+ export function GetCodeDialog({ collection, onOpenChange, open }: { onOpenChange: (open: boolean) => void, collection: any, open: any }) {
17
+
18
+ const snackbarController = useSnackbarController();
19
+
20
+ const code = "const " + camelCase(collection.name) + "Collection = " + JSON5.stringify(collectionToCode(collection), null, "\t");
21
+ return <Dialog open={open}
22
+ onOpenChange={onOpenChange}
23
+ maxWidth={"4xl"}>
24
+ <DialogContent>
25
+ <Typography variant={"h6"} className={"my-4"}>
26
+ Code for {collection.name}
27
+ </Typography>
28
+ <Typography variant={"body2"} className={"my-4 mb-8"}>
29
+ If you want to customise the collection in code, you can add this collection code to your CMS
30
+ app configuration.
31
+ More info in the <a
32
+ rel="noopener noreferrer"
33
+ href={"https://firecms.co/docs/customization_quickstart"}>docs</a>.
34
+ </Typography>
35
+ <Highlight
36
+ theme={themes.vsDark}
37
+ code={code}
38
+ language="typescript"
39
+ >
40
+ {({ className, style, tokens, getLineProps, getTokenProps }) => (
41
+ <pre style={style} className={"p-4 rounded text-sm"}>
42
+ {tokens.map((line, i) => (
43
+ <div key={i} {...getLineProps({ line })}>
44
+ {line.map((token, key) => (
45
+ <span key={key} {...getTokenProps({ token })} />
46
+ ))}
47
+ </div>
48
+ ))}
49
+ </pre>
50
+ )}
51
+ </Highlight>
52
+
53
+ </DialogContent>
54
+ <DialogActions>
55
+ <Button
56
+ variant={"text"}
57
+ size={"small"}
58
+ onClick={(e) => {
59
+ e.stopPropagation();
60
+ e.preventDefault();
61
+ snackbarController.open({
62
+ type: "success",
63
+ message: `Copied}`
64
+ })
65
+ return navigator.clipboard.writeText(code);
66
+ }}>
67
+ <ContentCopyIcon size={"small"}/>
68
+ Copy to clipboard
69
+ </Button>
70
+ <Button onClick={() => onOpenChange(false)}>Close</Button>
71
+ </DialogActions>
72
+ </Dialog>;
73
+ }
74
+
75
+ function collectionToCode(collection: EntityCollection): object {
76
+
77
+ const propertyCleanup = (property: any) => {
78
+
79
+ const updatedProperty = {
80
+ ...property
81
+ };
82
+
83
+ delete updatedProperty.fromBuilder;
84
+ delete updatedProperty.resolved;
85
+ delete updatedProperty.propertiesOrder;
86
+ delete updatedProperty.editable;
87
+
88
+ if (updatedProperty.type === "map") {
89
+ return {
90
+ ...updatedProperty,
91
+ properties: updatedProperty.properties.map(propertyCleanup)
92
+ }
93
+ }
94
+ return updatedProperty;
95
+ }
96
+
97
+ return {
98
+ name: collection.name,
99
+ singularName: collection.singularName,
100
+ description: collection.description,
101
+ path: collection.path,
102
+ editable: true,
103
+ collectionGroup: collection.collectionGroup,
104
+ alias: collection.alias,
105
+ icon: collection.icon,
106
+ group: collection.group,
107
+ customId: collection.customId,
108
+ initialFilter: collection.initialFilter,
109
+ initialSort: collection.initialSort,
110
+ properties: Object.entries(collection.properties)
111
+ .map(([key, value]) => ({
112
+ [key]: propertyCleanup(value)
113
+ }))
114
+ .reduce((a, b) => ({ ...a, ...b }), {}),
115
+ subcollections: (collection.subcollections ?? []).map(collectionToCode)
116
+ }
117
+
118
+ }
@@ -92,10 +92,6 @@ export function PropertyFieldPreview({
92
92
  </Typography>
93
93
  </ErrorBoundary>
94
94
 
95
- {disabled && <div
96
- className="text-xs h-3 ml-0.5">
97
- <RemoveCircleIcon color={"disabled"}/>
98
- </div>}
99
95
  </div>
100
96
  </div>
101
97
 
@@ -80,7 +80,7 @@ export function PropertyTree<M extends {
80
80
  // .filter((propertyKey) => Boolean(properties[propertyKey]))
81
81
  .map((propertyKey: string, index: number) => {
82
82
  const property = properties[propertyKey] as PropertyOrBuilder;
83
- const additionalField = additionalFields?.find(field => field.id === propertyKey);
83
+ const additionalField = additionalFields?.find(field => field.key === propertyKey);
84
84
 
85
85
  if (!property && !additionalField) {
86
86
  console.warn(`Property ${propertyKey} not found in properties or additionalFields`);
@@ -0,0 +1,8 @@
1
+ export function camelCase(str: string): string {
2
+ return (str.slice(0, 1).toLowerCase() + str.slice(1))
3
+ .replace(/([-_ ]){1,}/g, ' ')
4
+ .split(/[-_ ]/)
5
+ .reduce((cur, acc) => {
6
+ return cur + acc[0].toUpperCase() + acc.substring(1);
7
+ });
8
+ }
@@ -2,16 +2,16 @@ import React, { useCallback } from "react";
2
2
  import { EntityCollection, FireCMSPlugin, makePropertiesEditable, User } from "@firecms/core";
3
3
  import { ConfigControllerProvider } from "./ConfigControllerProvider";
4
4
  import { CollectionEditorPermissionsBuilder } from "./types/config_permissions";
5
- import { EditorCollectionAction } from "./components/EditorCollectionAction";
6
- import { HomePageEditorCollectionAction } from "./components/HomePageEditorCollectionAction";
7
- import { NewCollectionCard } from "./components/NewCollectionCard";
5
+ import { EditorCollectionAction } from "./ui/EditorCollectionAction";
6
+ import { HomePageEditorCollectionAction } from "./ui/HomePageEditorCollectionAction";
7
+ import { NewCollectionCard } from "./ui/NewCollectionCard";
8
8
  import { PersistedCollection } from "./types/persisted_collection";
9
9
  import { CollectionInference } from "./types/collection_inference";
10
10
  import { CollectionsConfigController } from "./types/config_controller";
11
- import { RootCollectionSuggestions } from "./components/RootCollectionSuggestions";
11
+ import { RootCollectionSuggestions } from "./ui/RootCollectionSuggestions";
12
12
  import { joinCollectionLists } from "./utils/join_collections";
13
- import { CollectionViewHeaderAction } from "./components/CollectionViewHeaderAction";
14
- import { PropertyAddColumnComponent } from "./components/PropertyAddColumnComponent";
13
+ import { CollectionViewHeaderAction } from "./ui/CollectionViewHeaderAction";
14
+ import { PropertyAddColumnComponent } from "./ui/PropertyAddColumnComponent";
15
15
 
16
16
  export interface CollectionConfigControllerProps<EC extends PersistedCollection = PersistedCollection, UserType extends User = User> {
17
17
 
@@ -96,10 +96,18 @@ function mergePropertyOrBuilder(target: Property, source: PropertyOrBuilder): Pr
96
96
 
97
97
  function getCollectionKeys(collection: EntityCollection) {
98
98
  if (collection.propertiesOrder && collection.propertiesOrder.length > 0) {
99
- return collection.propertiesOrder;
99
+ const propertiesOrder = collection.propertiesOrder;
100
+ if (collection.additionalFields) {
101
+ collection.additionalFields.forEach((field) => {
102
+ if (!propertiesOrder.includes(field.key)) {
103
+ propertiesOrder.push(field.key);
104
+ }
105
+ });
106
+ }
107
+ return propertiesOrder;
100
108
  }
101
109
  return [
102
110
  ...Object.keys(collection.properties),
103
- ...(collection.additionalFields ?? [])?.map(f => f.id)
111
+ ...(collection.additionalFields ?? [])?.map(f => f.key)
104
112
  ];
105
113
  }
File without changes
File without changes