@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.
- package/dist/index.d.ts +2 -2
- package/dist/index.es.js +910 -802
- 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/dist/ui/collection_editor/utils/strings.d.ts +1 -0
- package/package.json +6 -4
- package/src/ConfigControllerProvider.tsx +2 -2
- package/src/index.ts +2 -2
- package/src/{components → ui}/collection_editor/CollectionPropertiesEditorForm.tsx +25 -8
- 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/ui/collection_editor/utils/strings.ts +8 -0
- 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/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/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
|
@@ -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.
|
|
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.
|
|
18
|
-
"@firecms/schema_inference": "^3.0.0-alpha.
|
|
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": "
|
|
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 "./
|
|
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";
|
|
@@ -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
|
-
|
|
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
|
-
<
|
|
328
|
-
variant={"
|
|
339
|
+
<IconButton
|
|
340
|
+
variant={"filled"}
|
|
329
341
|
disabled={inferringProperties}
|
|
330
342
|
onClick={inferPropertiesFromData}>
|
|
331
343
|
{inferringProperties ? <CircularProgress size={"small"}/> : <AutoAwesomeIcon/>}
|
|
332
|
-
</
|
|
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
|
+
}
|
|
@@ -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
|
/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
|