@firecms/collection_editor 3.0.0-alpha.32 → 3.0.0-alpha.34
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.
- package/dist/index.d.ts +2 -2
- package/dist/index.es.js +320 -275
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/ui/collection_editor/GetCodeDialog.d.ts +5 -0
- package/package.json +4 -4
- package/src/ConfigControllerProvider.tsx +2 -2
- package/src/index.ts +2 -2
- package/src/{components → ui}/collection_editor/CollectionPropertiesEditorForm.tsx +2 -49
- package/src/ui/collection_editor/GetCodeDialog.tsx +118 -0
- package/src/{components → ui}/collection_editor/PropertyFieldPreview.tsx +0 -4
- package/src/{components → ui}/collection_editor/PropertyTree.tsx +1 -1
- package/src/useCollectionEditorPlugin.tsx +6 -6
- package/src/utils/join_collections.ts +10 -2
- /package/dist/{components → ui}/CollectionViewHeaderAction.d.ts +0 -0
- /package/dist/{components → ui}/EditorCollectionAction.d.ts +0 -0
- /package/dist/{components → ui}/HomePageEditorCollectionAction.d.ts +0 -0
- /package/dist/{components → ui}/MissingReferenceWidget.d.ts +0 -0
- /package/dist/{components → ui}/NewCollectionCard.d.ts +0 -0
- /package/dist/{components → ui}/PropertyAddColumnComponent.d.ts +0 -0
- /package/dist/{components → ui}/RootCollectionSuggestions.d.ts +0 -0
- /package/dist/{components → ui}/collection_editor/CollectionDetailsForm.d.ts +0 -0
- /package/dist/{components → ui}/collection_editor/CollectionEditorDialog.d.ts +0 -0
- /package/dist/{components → ui}/collection_editor/CollectionEditorWelcomeView.d.ts +0 -0
- /package/dist/{components → ui}/collection_editor/CollectionPropertiesEditorForm.d.ts +0 -0
- /package/dist/{components → ui}/collection_editor/CollectionYupValidation.d.ts +0 -0
- /package/dist/{components → ui}/collection_editor/EntityCustomViewsSelectDialog.d.ts +0 -0
- /package/dist/{components → ui}/collection_editor/EnumForm.d.ts +0 -0
- /package/dist/{components → ui}/collection_editor/PropertyEditView.d.ts +0 -0
- /package/dist/{components → ui}/collection_editor/PropertyFieldPreview.d.ts +0 -0
- /package/dist/{components → ui}/collection_editor/PropertySelectItem.d.ts +0 -0
- /package/dist/{components → ui}/collection_editor/PropertyTree.d.ts +0 -0
- /package/dist/{components → ui}/collection_editor/SelectIcons.d.ts +0 -0
- /package/dist/{components → ui}/collection_editor/SubcollectionsEditTab.d.ts +0 -0
- /package/dist/{components → ui}/collection_editor/UnsavedChangesDialog.d.ts +0 -0
- /package/dist/{components → ui}/collection_editor/import/CollectionEditorImportDataPreview.d.ts +0 -0
- /package/dist/{components → ui}/collection_editor/import/CollectionEditorImportMapping.d.ts +0 -0
- /package/dist/{components → ui}/collection_editor/import/clean_import_data.d.ts +0 -0
- /package/dist/{components → ui}/collection_editor/properties/BlockPropertyField.d.ts +0 -0
- /package/dist/{components → ui}/collection_editor/properties/BooleanPropertyField.d.ts +0 -0
- /package/dist/{components → ui}/collection_editor/properties/CommonPropertyFields.d.ts +0 -0
- /package/dist/{components → ui}/collection_editor/properties/DateTimePropertyField.d.ts +0 -0
- /package/dist/{components → ui}/collection_editor/properties/EnumPropertyField.d.ts +0 -0
- /package/dist/{components → ui}/collection_editor/properties/FieldHelperView.d.ts +0 -0
- /package/dist/{components → ui}/collection_editor/properties/KeyValuePropertyField.d.ts +0 -0
- /package/dist/{components → ui}/collection_editor/properties/MapPropertyField.d.ts +0 -0
- /package/dist/{components → ui}/collection_editor/properties/NumberPropertyField.d.ts +0 -0
- /package/dist/{components → ui}/collection_editor/properties/ReferencePropertyField.d.ts +0 -0
- /package/dist/{components → ui}/collection_editor/properties/RepeatPropertyField.d.ts +0 -0
- /package/dist/{components → ui}/collection_editor/properties/StoragePropertyField.d.ts +0 -0
- /package/dist/{components → ui}/collection_editor/properties/StringPropertyField.d.ts +0 -0
- /package/dist/{components → ui}/collection_editor/properties/advanced/AdvancedPropertyValidation.d.ts +0 -0
- /package/dist/{components → ui}/collection_editor/properties/validation/ArrayPropertyValidation.d.ts +0 -0
- /package/dist/{components → ui}/collection_editor/properties/validation/GeneralPropertyValidation.d.ts +0 -0
- /package/dist/{components → ui}/collection_editor/properties/validation/NumberPropertyValidation.d.ts +0 -0
- /package/dist/{components → ui}/collection_editor/properties/validation/StringPropertyValidation.d.ts +0 -0
- /package/dist/{components → ui}/collection_editor/properties/validation/ValidationPanel.d.ts +0 -0
- /package/dist/{components → ui}/collection_editor/templates/blog_template.d.ts +0 -0
- /package/dist/{components → ui}/collection_editor/templates/products_template.d.ts +0 -0
- /package/dist/{components → ui}/collection_editor/templates/users_template.d.ts +0 -0
- /package/dist/{components → ui}/collection_editor/util.d.ts +0 -0
- /package/dist/{components → ui}/collection_editor/utils/strings.d.ts +0 -0
- /package/dist/{components → ui}/collection_editor/utils/supported_fields.d.ts +0 -0
- /package/dist/{components → ui}/collection_editor/utils/update_property_for_widget.d.ts +0 -0
- /package/dist/{components → ui}/collection_editor/utils/useTraceUpdate.d.ts +0 -0
- /package/src/{components → ui}/CollectionViewHeaderAction.tsx +0 -0
- /package/src/{components → ui}/EditorCollectionAction.tsx +0 -0
- /package/src/{components → ui}/HomePageEditorCollectionAction.tsx +0 -0
- /package/src/{components → ui}/MissingReferenceWidget.tsx +0 -0
- /package/src/{components → ui}/NewCollectionCard.tsx +0 -0
- /package/src/{components → ui}/PropertyAddColumnComponent.tsx +0 -0
- /package/src/{components → ui}/RootCollectionSuggestions.tsx +0 -0
- /package/src/{components → ui}/collection_editor/CollectionDetailsForm.tsx +0 -0
- /package/src/{components → ui}/collection_editor/CollectionEditorDialog.tsx +0 -0
- /package/src/{components → ui}/collection_editor/CollectionEditorWelcomeView.tsx +0 -0
- /package/src/{components → ui}/collection_editor/CollectionYupValidation.tsx +0 -0
- /package/src/{components → ui}/collection_editor/EntityCustomViewsSelectDialog.tsx +0 -0
- /package/src/{components → ui}/collection_editor/EnumForm.tsx +0 -0
- /package/src/{components → ui}/collection_editor/PropertyEditView.tsx +0 -0
- /package/src/{components → ui}/collection_editor/PropertySelectItem.tsx +0 -0
- /package/src/{components → ui}/collection_editor/SelectIcons.tsx +0 -0
- /package/src/{components → ui}/collection_editor/SubcollectionsEditTab.tsx +0 -0
- /package/src/{components → ui}/collection_editor/UnsavedChangesDialog.tsx +0 -0
- /package/src/{components → ui}/collection_editor/import/CollectionEditorImportDataPreview.tsx +0 -0
- /package/src/{components → ui}/collection_editor/import/CollectionEditorImportMapping.tsx +0 -0
- /package/src/{components → ui}/collection_editor/import/clean_import_data.ts +0 -0
- /package/src/{components → ui}/collection_editor/properties/BlockPropertyField.tsx +0 -0
- /package/src/{components → ui}/collection_editor/properties/BooleanPropertyField.tsx +0 -0
- /package/src/{components → ui}/collection_editor/properties/CommonPropertyFields.tsx +0 -0
- /package/src/{components → ui}/collection_editor/properties/DateTimePropertyField.tsx +0 -0
- /package/src/{components → ui}/collection_editor/properties/EnumPropertyField.tsx +0 -0
- /package/src/{components → ui}/collection_editor/properties/FieldHelperView.tsx +0 -0
- /package/src/{components → ui}/collection_editor/properties/KeyValuePropertyField.tsx +0 -0
- /package/src/{components → ui}/collection_editor/properties/MapPropertyField.tsx +0 -0
- /package/src/{components → ui}/collection_editor/properties/NumberPropertyField.tsx +0 -0
- /package/src/{components → ui}/collection_editor/properties/ReferencePropertyField.tsx +0 -0
- /package/src/{components → ui}/collection_editor/properties/RepeatPropertyField.tsx +0 -0
- /package/src/{components → ui}/collection_editor/properties/StoragePropertyField.tsx +0 -0
- /package/src/{components → ui}/collection_editor/properties/StringPropertyField.tsx +0 -0
- /package/src/{components → ui}/collection_editor/properties/advanced/AdvancedPropertyValidation.tsx +0 -0
- /package/src/{components → ui}/collection_editor/properties/validation/ArrayPropertyValidation.tsx +0 -0
- /package/src/{components → ui}/collection_editor/properties/validation/GeneralPropertyValidation.tsx +0 -0
- /package/src/{components → ui}/collection_editor/properties/validation/NumberPropertyValidation.tsx +0 -0
- /package/src/{components → ui}/collection_editor/properties/validation/StringPropertyValidation.tsx +0 -0
- /package/src/{components → ui}/collection_editor/properties/validation/ValidationPanel.tsx +0 -0
- /package/src/{components → ui}/collection_editor/templates/blog_template.ts +0 -0
- /package/src/{components → ui}/collection_editor/templates/products_template.ts +0 -0
- /package/src/{components → ui}/collection_editor/templates/users_template.ts +0 -0
- /package/src/{components → ui}/collection_editor/util.ts +0 -0
- /package/src/{components → ui}/collection_editor/utils/strings.ts +0 -0
- /package/src/{components → ui}/collection_editor/utils/supported_fields.tsx +0 -0
- /package/src/{components → ui}/collection_editor/utils/update_property_for_widget.ts +0 -0
- /package/src/{components → ui}/collection_editor/utils/useTraceUpdate.tsx +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@firecms/collection_editor",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.34",
|
|
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": "^3.0.0-alpha.
|
|
18
|
-
"@firecms/schema_inference": "^3.0.0-alpha.
|
|
17
|
+
"@firecms/data_import": "^3.0.0-alpha.34",
|
|
18
|
+
"@firecms/schema_inference": "^3.0.0-alpha.34",
|
|
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": "
|
|
81
|
+
"gitHead": "97fea385cfd4a0ab9301d45d50e1d145021c1df5"
|
|
82
82
|
}
|
|
@@ -10,12 +10,12 @@ import {
|
|
|
10
10
|
User,
|
|
11
11
|
useSnackbarController
|
|
12
12
|
} from "@firecms/core";
|
|
13
|
-
import { CollectionEditorDialog } from "./
|
|
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 "./
|
|
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 "./
|
|
34
|
-
export * from "./
|
|
33
|
+
export { MissingReferenceWidget } from "./ui/MissingReferenceWidget";
|
|
34
|
+
export * from "./ui/collection_editor/util";
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React, { useEffect, useMemo, useState } from "react";
|
|
2
|
-
import JSON5 from "json5";
|
|
3
2
|
|
|
4
3
|
import { Field, FormikErrors, getIn, useFormikContext } from "formik";
|
|
5
4
|
import {
|
|
@@ -11,9 +10,6 @@ import {
|
|
|
11
10
|
CodeIcon,
|
|
12
11
|
DebouncedTextField,
|
|
13
12
|
defaultBorderMixin,
|
|
14
|
-
Dialog,
|
|
15
|
-
DialogActions,
|
|
16
|
-
DialogContent,
|
|
17
13
|
EntityCollection,
|
|
18
14
|
ErrorBoundary,
|
|
19
15
|
IconButton,
|
|
@@ -31,13 +27,11 @@ import {
|
|
|
31
27
|
useSnackbarController
|
|
32
28
|
} from "@firecms/core";
|
|
33
29
|
|
|
34
|
-
import { Highlight, themes } from "prism-react-renderer"
|
|
35
|
-
|
|
36
30
|
import { getFullId, idToPropertiesPath, namespaceToPropertiesOrderPath } from "./util";
|
|
37
31
|
import { OnPropertyChangedParams, PropertyForm, PropertyFormDialog } from "./PropertyEditView";
|
|
38
32
|
import { PropertyTree } from "./PropertyTree";
|
|
39
33
|
import { PersistedCollection } from "../../types/persisted_collection";
|
|
40
|
-
import {
|
|
34
|
+
import { GetCodeDialog } from "./GetCodeDialog";
|
|
41
35
|
|
|
42
36
|
type CollectionEditorFormProps = {
|
|
43
37
|
showErrors: boolean;
|
|
@@ -54,47 +48,6 @@ type CollectionEditorFormProps = {
|
|
|
54
48
|
collectionEditable: boolean;
|
|
55
49
|
};
|
|
56
50
|
|
|
57
|
-
function GetCodeDialog({ collection, onOpenChange, open }: { onOpenChange: (open: boolean) => void, collection: any, open: any }) {
|
|
58
|
-
const code = "const " + camelCase(collection.name) + "Collection = " + JSON5.stringify(collection, null, "\t");
|
|
59
|
-
return <Dialog open={open}
|
|
60
|
-
onOpenChange={onOpenChange}
|
|
61
|
-
maxWidth={"4xl"}>
|
|
62
|
-
<DialogContent>
|
|
63
|
-
<Typography variant={"h6"} className={"my-4"}>
|
|
64
|
-
Code for {collection.name}
|
|
65
|
-
</Typography>
|
|
66
|
-
<Typography variant={"body2"} className={"my-4 mb-8"}>
|
|
67
|
-
If you want to customise the collection in code, you can add this collection code to your CMS
|
|
68
|
-
app configuration.
|
|
69
|
-
More info in the <a
|
|
70
|
-
rel="noopener noreferrer"
|
|
71
|
-
href={"https://firecms.co/docs/customization_quickstart"}>docs</a>.
|
|
72
|
-
</Typography>
|
|
73
|
-
<Highlight
|
|
74
|
-
theme={themes.vsDark}
|
|
75
|
-
code={code}
|
|
76
|
-
language="typescript"
|
|
77
|
-
>
|
|
78
|
-
{({ className, style, tokens, getLineProps, getTokenProps }) => (
|
|
79
|
-
<pre style={style} className={"p-4 rounded"}>
|
|
80
|
-
{tokens.map((line, i) => (
|
|
81
|
-
<div key={i} {...getLineProps({ line })}>
|
|
82
|
-
{line.map((token, key) => (
|
|
83
|
-
<span key={key} {...getTokenProps({ token })} />
|
|
84
|
-
))}
|
|
85
|
-
</div>
|
|
86
|
-
))}
|
|
87
|
-
</pre>
|
|
88
|
-
)}
|
|
89
|
-
</Highlight>
|
|
90
|
-
|
|
91
|
-
</DialogContent>
|
|
92
|
-
<DialogActions>
|
|
93
|
-
<Button onClick={() => onOpenChange(false)}>Close</Button>
|
|
94
|
-
</DialogActions>
|
|
95
|
-
</Dialog>;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
51
|
export function CollectionPropertiesEditorForm({
|
|
99
52
|
showErrors,
|
|
100
53
|
isNewCollection,
|
|
@@ -374,7 +327,7 @@ export function CollectionPropertiesEditorForm({
|
|
|
374
327
|
</div>}
|
|
375
328
|
|
|
376
329
|
<div className="ml-1 mt-2 flex flex-row gap-2">
|
|
377
|
-
<Tooltip title={"Get the code
|
|
330
|
+
<Tooltip title={"Get the code for this collection"}>
|
|
378
331
|
<IconButton
|
|
379
332
|
variant={"filled"}
|
|
380
333
|
disabled={inferringProperties}
|
|
@@ -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
|
+
}
|
|
@@ -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.
|
|
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`);
|
|
@@ -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 "./
|
|
6
|
-
import { HomePageEditorCollectionAction } from "./
|
|
7
|
-
import { NewCollectionCard } from "./
|
|
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 "./
|
|
11
|
+
import { RootCollectionSuggestions } from "./ui/RootCollectionSuggestions";
|
|
12
12
|
import { joinCollectionLists } from "./utils/join_collections";
|
|
13
|
-
import { CollectionViewHeaderAction } from "./
|
|
14
|
-
import { PropertyAddColumnComponent } from "./
|
|
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
|
-
|
|
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.
|
|
111
|
+
...(collection.additionalFields ?? [])?.map(f => f.key)
|
|
104
112
|
];
|
|
105
113
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/{components → ui}/collection_editor/import/CollectionEditorImportDataPreview.d.ts
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/{components → ui}/collection_editor/properties/validation/ArrayPropertyValidation.d.ts
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/{components → ui}/collection_editor/properties/validation/ValidationPanel.d.ts
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/src/{components → ui}/collection_editor/import/CollectionEditorImportDataPreview.tsx
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/src/{components → ui}/collection_editor/properties/advanced/AdvancedPropertyValidation.tsx
RENAMED
|
File without changes
|
/package/src/{components → ui}/collection_editor/properties/validation/ArrayPropertyValidation.tsx
RENAMED
|
File without changes
|
/package/src/{components → ui}/collection_editor/properties/validation/GeneralPropertyValidation.tsx
RENAMED
|
File without changes
|
/package/src/{components → ui}/collection_editor/properties/validation/NumberPropertyValidation.tsx
RENAMED
|
File without changes
|
/package/src/{components → ui}/collection_editor/properties/validation/StringPropertyValidation.tsx
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|