@firecms/collection_editor 3.0.0-alpha.9 → 3.0.0-beta.10
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/LICENSE +114 -21
- package/dist/ConfigControllerProvider.d.ts +13 -3
- package/dist/index.d.ts +4 -2
- package/dist/index.es.js +5587 -4976
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +6829 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/types/collection_editor_controller.d.ts +36 -8
- package/dist/types/collection_inference.d.ts +1 -1
- package/dist/types/config_controller.d.ts +33 -6
- package/dist/types/persisted_collection.d.ts +4 -2
- package/dist/ui/CollectionViewHeaderAction.d.ts +11 -0
- package/dist/{components → ui}/EditorCollectionAction.d.ts +1 -1
- package/dist/ui/EditorCollectionActionStart.d.ts +2 -0
- package/dist/ui/MissingReferenceWidget.d.ts +3 -0
- package/dist/ui/NewCollectionButton.d.ts +1 -0
- package/dist/ui/PropertyAddColumnComponent.d.ts +8 -0
- package/dist/{components → ui}/collection_editor/CollectionDetailsForm.d.ts +3 -2
- package/dist/{components → ui}/collection_editor/CollectionEditorDialog.d.ts +15 -11
- package/dist/{components → ui}/collection_editor/CollectionEditorWelcomeView.d.ts +3 -3
- package/dist/{components → ui}/collection_editor/CollectionPropertiesEditorForm.d.ts +8 -6
- package/dist/{components → ui}/collection_editor/CollectionYupValidation.d.ts +3 -0
- package/dist/ui/collection_editor/EntityCustomViewsSelectDialog.d.ts +4 -0
- package/dist/{components → ui}/collection_editor/EnumForm.d.ts +1 -2
- package/dist/ui/collection_editor/GetCodeDialog.d.ts +5 -0
- package/dist/{components → ui}/collection_editor/PropertyEditView.d.ts +21 -11
- package/dist/{components → ui}/collection_editor/PropertyFieldPreview.d.ts +4 -3
- package/dist/{components → ui}/collection_editor/PropertyTree.d.ts +11 -7
- package/dist/{components → ui}/collection_editor/SubcollectionsEditTab.d.ts +3 -3
- package/dist/ui/collection_editor/SwitchControl.d.ts +8 -0
- package/dist/{components → ui}/collection_editor/import/CollectionEditorImportDataPreview.d.ts +1 -1
- package/dist/ui/collection_editor/import/CollectionEditorImportMapping.d.ts +14 -0
- package/dist/{components → ui}/collection_editor/import/clean_import_data.d.ts +1 -1
- package/dist/{components → ui}/collection_editor/properties/BlockPropertyField.d.ts +4 -1
- package/dist/{components → ui}/collection_editor/properties/CommonPropertyFields.d.ts +1 -1
- package/dist/{components → ui}/collection_editor/properties/MapPropertyField.d.ts +4 -1
- package/dist/ui/collection_editor/properties/MarkdownPropertyField.d.ts +4 -0
- package/dist/{components → ui}/collection_editor/properties/RepeatPropertyField.d.ts +4 -1
- package/dist/{components → ui}/collection_editor/properties/StringPropertyField.d.ts +1 -1
- package/dist/ui/collection_editor/properties/UrlPropertyField.d.ts +4 -0
- package/dist/ui/collection_editor/templates/blog_template.d.ts +2 -0
- package/dist/ui/collection_editor/templates/pages_template.d.ts +2 -0
- package/dist/ui/collection_editor/templates/products_template.d.ts +2 -0
- package/dist/ui/collection_editor/templates/users_template.d.ts +2 -0
- package/dist/{components → ui}/collection_editor/util.d.ts +1 -0
- package/dist/ui/collection_editor/utils/strings.d.ts +1 -0
- package/dist/ui/collection_editor/utils/supported_fields.d.ts +3 -0
- package/dist/ui/collection_editor/utils/update_property_for_widget.d.ts +2 -0
- package/dist/useCollectionEditorPlugin.d.ts +17 -6
- package/dist/utils/collections.d.ts +6 -0
- package/dist/utils/entities.d.ts +3 -4
- package/package.json +35 -37
- package/src/ConfigControllerProvider.tsx +350 -0
- package/src/index.ts +36 -0
- package/src/types/collection_editor_controller.tsx +53 -0
- package/src/types/collection_inference.ts +3 -0
- package/src/types/config_controller.tsx +60 -0
- package/src/types/config_permissions.ts +20 -0
- package/src/types/persisted_collection.ts +9 -0
- package/src/ui/CollectionViewHeaderAction.tsx +48 -0
- package/src/ui/EditorCollectionAction.tsx +56 -0
- package/src/ui/EditorCollectionActionStart.tsx +88 -0
- package/src/ui/HomePageEditorCollectionAction.tsx +89 -0
- package/src/ui/MissingReferenceWidget.tsx +37 -0
- package/src/ui/NewCollectionButton.tsx +18 -0
- package/src/ui/NewCollectionCard.tsx +48 -0
- package/src/ui/PropertyAddColumnComponent.tsx +47 -0
- package/src/ui/collection_editor/CollectionDetailsForm.tsx +426 -0
- package/src/ui/collection_editor/CollectionEditorDialog.tsx +826 -0
- package/src/ui/collection_editor/CollectionEditorWelcomeView.tsx +214 -0
- package/src/ui/collection_editor/CollectionPropertiesEditorForm.tsx +513 -0
- package/src/ui/collection_editor/CollectionYupValidation.tsx +7 -0
- package/src/ui/collection_editor/EntityCustomViewsSelectDialog.tsx +37 -0
- package/src/ui/collection_editor/EnumForm.tsx +357 -0
- package/src/ui/collection_editor/GetCodeDialog.tsx +122 -0
- package/src/ui/collection_editor/PropertyEditView.tsx +789 -0
- package/src/ui/collection_editor/PropertyFieldPreview.tsx +204 -0
- package/src/ui/collection_editor/PropertyTree.tsx +254 -0
- package/src/ui/collection_editor/SubcollectionsEditTab.tsx +269 -0
- package/src/ui/collection_editor/SwitchControl.tsx +39 -0
- package/src/ui/collection_editor/UnsavedChangesDialog.tsx +47 -0
- package/src/ui/collection_editor/import/CollectionEditorImportDataPreview.tsx +53 -0
- package/src/ui/collection_editor/import/CollectionEditorImportMapping.tsx +299 -0
- package/src/ui/collection_editor/import/clean_import_data.ts +53 -0
- package/src/ui/collection_editor/properties/BlockPropertyField.tsx +144 -0
- package/src/ui/collection_editor/properties/BooleanPropertyField.tsx +40 -0
- package/src/ui/collection_editor/properties/CommonPropertyFields.tsx +110 -0
- package/src/ui/collection_editor/properties/DateTimePropertyField.tsx +89 -0
- package/src/ui/collection_editor/properties/EnumPropertyField.tsx +114 -0
- package/src/ui/collection_editor/properties/KeyValuePropertyField.tsx +20 -0
- package/src/ui/collection_editor/properties/MapPropertyField.tsx +150 -0
- package/src/ui/collection_editor/properties/MarkdownPropertyField.tsx +139 -0
- package/src/ui/collection_editor/properties/NumberPropertyField.tsx +38 -0
- package/src/ui/collection_editor/properties/ReferencePropertyField.tsx +160 -0
- package/src/ui/collection_editor/properties/RepeatPropertyField.tsx +108 -0
- package/src/ui/collection_editor/properties/StoragePropertyField.tsx +215 -0
- package/src/ui/collection_editor/properties/StringPropertyField.tsx +70 -0
- package/src/ui/collection_editor/properties/UrlPropertyField.tsx +89 -0
- package/src/ui/collection_editor/properties/advanced/AdvancedPropertyValidation.tsx +45 -0
- package/src/ui/collection_editor/properties/validation/ArrayPropertyValidation.tsx +50 -0
- package/src/ui/collection_editor/properties/validation/GeneralPropertyValidation.tsx +61 -0
- package/src/ui/collection_editor/properties/validation/NumberPropertyValidation.tsx +115 -0
- package/src/ui/collection_editor/properties/validation/StringPropertyValidation.tsx +150 -0
- package/src/ui/collection_editor/properties/validation/ValidationPanel.tsx +28 -0
- package/src/ui/collection_editor/templates/blog_template.ts +115 -0
- package/src/ui/collection_editor/templates/pages_template.ts +183 -0
- package/src/ui/collection_editor/templates/products_template.ts +88 -0
- package/src/ui/collection_editor/templates/users_template.ts +42 -0
- package/src/ui/collection_editor/util.ts +28 -0
- package/src/ui/collection_editor/utils/strings.ts +9 -0
- package/src/ui/collection_editor/utils/supported_fields.tsx +29 -0
- package/src/ui/collection_editor/utils/update_property_for_widget.ts +271 -0
- package/src/ui/collection_editor/utils/useTraceUpdate.tsx +23 -0
- package/src/useCollectionEditorController.tsx +9 -0
- package/src/useCollectionEditorPlugin.tsx +164 -0
- package/src/useCollectionsConfigController.tsx +9 -0
- package/src/utils/arrays.ts +3 -0
- package/src/utils/collections.ts +30 -0
- package/src/utils/entities.ts +38 -0
- package/src/vite-env.d.ts +1 -0
- package/dist/components/collection_editor/PropertySelectItem.d.ts +0 -8
- package/dist/components/collection_editor/SelectIcons.d.ts +0 -6
- package/dist/components/collection_editor/import/CollectionEditorImportMapping.d.ts +0 -4
- package/dist/components/collection_editor/properties/FieldHelperView.d.ts +0 -4
- package/dist/components/collection_editor/templates/blog_template.d.ts +0 -10
- package/dist/components/collection_editor/templates/products_template.d.ts +0 -12
- package/dist/components/collection_editor/templates/users_template.d.ts +0 -7
- package/dist/components/collection_editor/utils/supported_fields.d.ts +0 -3
- package/dist/components/collection_editor/utils/update_property_for_widget.d.ts +0 -3
- package/dist/types/editable_properties.d.ts +0 -10
- package/dist/utils/icons.d.ts +0 -2
- package/dist/utils/synonyms.d.ts +0 -1951
- /package/dist/{components → ui}/HomePageEditorCollectionAction.d.ts +0 -0
- /package/dist/{components → ui}/NewCollectionCard.d.ts +0 -0
- /package/dist/{components → ui}/collection_editor/UnsavedChangesDialog.d.ts +0 -0
- /package/dist/{components → ui}/collection_editor/properties/BooleanPropertyField.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/KeyValuePropertyField.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/StoragePropertyField.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/utils/useTraceUpdate.d.ts +0 -0
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { FireCMSPlugin, useAuthController, useNavigationController, User } from "@firecms/core";
|
|
3
|
+
import { ConfigControllerProvider } from "./ConfigControllerProvider";
|
|
4
|
+
import { CollectionEditorPermissionsBuilder } from "./types/config_permissions";
|
|
5
|
+
import { EditorCollectionAction } from "./ui/EditorCollectionAction";
|
|
6
|
+
import { HomePageEditorCollectionAction } from "./ui/HomePageEditorCollectionAction";
|
|
7
|
+
import { PersistedCollection } from "./types/persisted_collection";
|
|
8
|
+
import { CollectionInference } from "./types/collection_inference";
|
|
9
|
+
import { CollectionsConfigController } from "./types/config_controller";
|
|
10
|
+
import { CollectionViewHeaderAction } from "./ui/CollectionViewHeaderAction";
|
|
11
|
+
import { PropertyAddColumnComponent } from "./ui/PropertyAddColumnComponent";
|
|
12
|
+
import { NewCollectionButton } from "./ui/NewCollectionButton";
|
|
13
|
+
import { AddIcon, Button, Paper, Typography } from "@firecms/ui";
|
|
14
|
+
import { useCollectionEditorController } from "./useCollectionEditorController";
|
|
15
|
+
import { EditorCollectionActionStart } from "./ui/EditorCollectionActionStart";
|
|
16
|
+
import { NewCollectionCard } from "./ui/NewCollectionCard";
|
|
17
|
+
|
|
18
|
+
export interface CollectionConfigControllerProps<EC extends PersistedCollection = PersistedCollection, UserType extends User = User> {
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Firebase app where the configuration is saved.
|
|
22
|
+
*/
|
|
23
|
+
collectionConfigController: CollectionsConfigController;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Define what actions can be performed on the configuration.
|
|
27
|
+
*/
|
|
28
|
+
configPermissions?: CollectionEditorPermissionsBuilder<UserType, EC>;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* The words you define here will not be allowed to be used as group
|
|
32
|
+
* names when creating collections.
|
|
33
|
+
* e.g. ["admin"]
|
|
34
|
+
*/
|
|
35
|
+
reservedGroups?: string[];
|
|
36
|
+
|
|
37
|
+
extraView?: {
|
|
38
|
+
View: React.ComponentType<{
|
|
39
|
+
path: string
|
|
40
|
+
}>,
|
|
41
|
+
icon: React.ReactNode
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
getPathSuggestions?: (path?: string) => Promise<string[]>;
|
|
45
|
+
|
|
46
|
+
collectionInference?: CollectionInference;
|
|
47
|
+
|
|
48
|
+
getData?: (path: string, parentPaths: string[]) => Promise<object[]>;
|
|
49
|
+
|
|
50
|
+
getUser?: (uid: string) => UserType | null;
|
|
51
|
+
|
|
52
|
+
onAnalyticsEvent?: (event: string, params?: object) => void;
|
|
53
|
+
|
|
54
|
+
components?: {
|
|
55
|
+
/**
|
|
56
|
+
* Custom component to render the database field
|
|
57
|
+
*/
|
|
58
|
+
DatabaseField?: React.ComponentType<{ databaseId?: string, onDatabaseIdUpdate: (databaseId:string) => void }>;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Use this hook to initialise the Collection Editor plugin.
|
|
65
|
+
* This is likely the only hook you will need to use.
|
|
66
|
+
* @param firebaseApp Firebase app where your project data lives.
|
|
67
|
+
* @param configPermissions
|
|
68
|
+
* @param reservedGroups
|
|
69
|
+
* @param extraView
|
|
70
|
+
* @param getData
|
|
71
|
+
* @param getUser
|
|
72
|
+
* @param collectionInference
|
|
73
|
+
*/
|
|
74
|
+
export function useCollectionEditorPlugin<EC extends PersistedCollection = PersistedCollection, UserType extends User = User>
|
|
75
|
+
({
|
|
76
|
+
collectionConfigController,
|
|
77
|
+
configPermissions,
|
|
78
|
+
reservedGroups,
|
|
79
|
+
extraView,
|
|
80
|
+
getPathSuggestions,
|
|
81
|
+
getUser,
|
|
82
|
+
collectionInference,
|
|
83
|
+
getData,
|
|
84
|
+
onAnalyticsEvent,
|
|
85
|
+
components
|
|
86
|
+
}: CollectionConfigControllerProps<EC, UserType>): FireCMSPlugin<any, any, PersistedCollection> {
|
|
87
|
+
|
|
88
|
+
return {
|
|
89
|
+
key: "collection_editor",
|
|
90
|
+
loading: collectionConfigController.loading,
|
|
91
|
+
provider: {
|
|
92
|
+
Component: ConfigControllerProvider,
|
|
93
|
+
props: {
|
|
94
|
+
collectionConfigController,
|
|
95
|
+
configPermissions,
|
|
96
|
+
collectionInference,
|
|
97
|
+
reservedGroups,
|
|
98
|
+
extraView,
|
|
99
|
+
getPathSuggestions,
|
|
100
|
+
getUser,
|
|
101
|
+
getData,
|
|
102
|
+
onAnalyticsEvent,
|
|
103
|
+
components
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
homePage: {
|
|
107
|
+
additionalActions: <NewCollectionButton/>,
|
|
108
|
+
additionalChildrenStart: <IntroWidget/>,
|
|
109
|
+
// additionalChildrenEnd: <RootCollectionSuggestions introMode={introMode}/>,
|
|
110
|
+
CollectionActions: HomePageEditorCollectionAction,
|
|
111
|
+
AdditionalCards: NewCollectionCard,
|
|
112
|
+
},
|
|
113
|
+
collectionView: {
|
|
114
|
+
CollectionActionsStart: EditorCollectionActionStart,
|
|
115
|
+
CollectionActions: EditorCollectionAction,
|
|
116
|
+
HeaderAction: CollectionViewHeaderAction,
|
|
117
|
+
AddColumnComponent: PropertyAddColumnComponent
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export function IntroWidget({}: {}) {
|
|
123
|
+
|
|
124
|
+
const navigation = useNavigationController();
|
|
125
|
+
if (!navigation.topLevelNavigation)
|
|
126
|
+
throw Error("Navigation not ready in FireCMSHomePage");
|
|
127
|
+
|
|
128
|
+
const authController = useAuthController();
|
|
129
|
+
|
|
130
|
+
const collectionEditorController = useCollectionEditorController();
|
|
131
|
+
const canCreateCollections = collectionEditorController.configPermissions
|
|
132
|
+
? collectionEditorController.configPermissions({
|
|
133
|
+
user: authController.user,
|
|
134
|
+
}).createCollections
|
|
135
|
+
: true;
|
|
136
|
+
|
|
137
|
+
if (!navigation.initialised || (navigation.collections ?? []).length > 0) {
|
|
138
|
+
return null;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
return (
|
|
142
|
+
<Paper
|
|
143
|
+
className={"my-4 px-4 py-6 flex flex-col bg-white dark:bg-slate-800 gap-2"}>
|
|
144
|
+
<Typography variant={"subtitle2"} className={"uppercase"}>No collections found</Typography>
|
|
145
|
+
<Typography>
|
|
146
|
+
Start building collections in FireCMS easily. Map them to your existing
|
|
147
|
+
database data, import from files, or use our templates.
|
|
148
|
+
</Typography>
|
|
149
|
+
{canCreateCollections && <Button
|
|
150
|
+
onClick={collectionEditorController && canCreateCollections
|
|
151
|
+
? () => collectionEditorController.createCollection({
|
|
152
|
+
parentCollectionIds: [],
|
|
153
|
+
redirect: true,
|
|
154
|
+
sourceClick: "new_collection_card"
|
|
155
|
+
})
|
|
156
|
+
: undefined}>
|
|
157
|
+
<AddIcon/>Create your first collection
|
|
158
|
+
</Button>}
|
|
159
|
+
<Typography color={"secondary"}>
|
|
160
|
+
You can also define collections programmatically.
|
|
161
|
+
</Typography>
|
|
162
|
+
</Paper>
|
|
163
|
+
);
|
|
164
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { useContext } from "react";
|
|
2
|
+
import { CollectionsConfigController } from "./types/config_controller";
|
|
3
|
+
import { ConfigControllerContext } from "./ConfigControllerProvider";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Use this hook to access the configuration controller.
|
|
7
|
+
* You can use it to get the list of collections, and to save/delete collections.
|
|
8
|
+
*/
|
|
9
|
+
export const useCollectionsConfigController = (): CollectionsConfigController => useContext(ConfigControllerContext);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import {
|
|
2
|
+
EntityCollection,
|
|
3
|
+
joinCollectionLists,
|
|
4
|
+
makePropertiesEditable,
|
|
5
|
+
ModifyCollectionProps,
|
|
6
|
+
Properties
|
|
7
|
+
} from "@firecms/core";
|
|
8
|
+
import { PersistedCollection } from "../types/persisted_collection";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Function in charge of merging collections defined in code with those stored in the backend.
|
|
12
|
+
*/
|
|
13
|
+
export const mergeCollections = (baseCollections: EntityCollection[],
|
|
14
|
+
backendCollections: PersistedCollection[],
|
|
15
|
+
modifyCollection?: (props: ModifyCollectionProps) => EntityCollection | void
|
|
16
|
+
) => {
|
|
17
|
+
|
|
18
|
+
const markAsEditable = (c: PersistedCollection) => {
|
|
19
|
+
makePropertiesEditable(c.properties as Properties);
|
|
20
|
+
c.subcollections?.forEach(markAsEditable);
|
|
21
|
+
};
|
|
22
|
+
const storedCollections = backendCollections ?? [];
|
|
23
|
+
storedCollections.forEach(markAsEditable);
|
|
24
|
+
|
|
25
|
+
console.debug("Collections specified in code:", baseCollections);
|
|
26
|
+
console.debug("Collections stored in the backend", storedCollections);
|
|
27
|
+
const result = joinCollectionLists(baseCollections, storedCollections, [], modifyCollection);
|
|
28
|
+
console.debug("Collections after joining:", result);
|
|
29
|
+
return result;
|
|
30
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { isPropertyBuilder, Properties, PropertiesOrBuilders, Property, PropertyOrBuilder } from "@firecms/core";
|
|
2
|
+
|
|
3
|
+
export function editableProperty(property: PropertyOrBuilder | PropertyOrBuilder): boolean {
|
|
4
|
+
if (isPropertyBuilder(property))
|
|
5
|
+
return false;
|
|
6
|
+
if (isPropertyBuilder(property as PropertyOrBuilder))
|
|
7
|
+
return false;
|
|
8
|
+
else {
|
|
9
|
+
const eProperty = property as Property;
|
|
10
|
+
if (eProperty.dataType === "array" && typeof eProperty.of === "function")
|
|
11
|
+
return false;
|
|
12
|
+
else if (eProperty.dataType === "array" && Array.isArray(eProperty.of))
|
|
13
|
+
return false;
|
|
14
|
+
return Boolean(eProperty.editable);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function removeNonEditableProperties(properties: PropertiesOrBuilders<any>): Properties {
|
|
19
|
+
return Object.entries(properties)
|
|
20
|
+
.filter(([_, property]) => editableProperty(property))
|
|
21
|
+
.map(([key, propertyOrBuilder]) => {
|
|
22
|
+
const property = propertyOrBuilder as Property;
|
|
23
|
+
if (!editableProperty(property)) {
|
|
24
|
+
return undefined;
|
|
25
|
+
} else if (property.dataType === "map" && property.properties) {
|
|
26
|
+
return {
|
|
27
|
+
[key]: {
|
|
28
|
+
...property,
|
|
29
|
+
properties: removeNonEditableProperties(property.properties as PropertiesOrBuilders)
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
} else {
|
|
33
|
+
return { [key]: property };
|
|
34
|
+
}
|
|
35
|
+
})
|
|
36
|
+
.filter((e) => Boolean(e))
|
|
37
|
+
.reduce((a, b) => ({ ...a, ...b }), {}) as Properties;
|
|
38
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { FieldConfig } from "@firecms/core";
|
|
2
|
-
export interface PropertySelectItemProps {
|
|
3
|
-
value: string;
|
|
4
|
-
optionDisabled: boolean;
|
|
5
|
-
widget: FieldConfig;
|
|
6
|
-
existing: boolean;
|
|
7
|
-
}
|
|
8
|
-
export declare function PropertySelectItem({ value, optionDisabled, widget, existing }: PropertySelectItemProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export declare const blogCollectionTemplate: import("@firecms/core").EntityCollection<{
|
|
2
|
-
name: string;
|
|
3
|
-
header_image: string;
|
|
4
|
-
content: any[];
|
|
5
|
-
created_on: unknown;
|
|
6
|
-
status: unknown;
|
|
7
|
-
publish_date: unknown;
|
|
8
|
-
reviewed: unknown;
|
|
9
|
-
tags: unknown;
|
|
10
|
-
}, string, import("@firecms/core").User>;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export declare const productsCollectionTemplate: import("@firecms/core").EntityCollection<{
|
|
2
|
-
name: unknown;
|
|
3
|
-
brand: unknown;
|
|
4
|
-
description: unknown;
|
|
5
|
-
main_image: unknown;
|
|
6
|
-
available: unknown;
|
|
7
|
-
price: unknown;
|
|
8
|
-
images: unknown;
|
|
9
|
-
related_products: unknown;
|
|
10
|
-
metadata: unknown;
|
|
11
|
-
added_on: unknown;
|
|
12
|
-
}, string, import("@firecms/core").User>;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { CMSType, Property, PropertyBuilderProps, ResolvedProperty } from "@firecms/core";
|
|
2
|
-
export type EditablePropertyOrBuilder = EditableProperty | EditablePropertyBuilder;
|
|
3
|
-
export type EditableProperty = Property & {
|
|
4
|
-
editable: boolean;
|
|
5
|
-
};
|
|
6
|
-
export type EditablePropertyBuilder<T extends CMSType = any, M extends Record<string, any> = any> = ({ values, previousValues, propertyValue, path, entityId }: PropertyBuilderProps<M>) => EditableProperty | null;
|
|
7
|
-
export type EditablePropertiesOrBuilders<M extends Record<string, any> = Record<string, any>> = {
|
|
8
|
-
[k in keyof M]: EditablePropertyOrBuilder;
|
|
9
|
-
};
|
|
10
|
-
export declare function isEditablePropertyBuilder<T extends CMSType, M extends Record<string, any>>(propertyOrBuilder?: EditablePropertyOrBuilder | ResolvedProperty<T>): propertyOrBuilder is EditablePropertyBuilder;
|
package/dist/utils/icons.d.ts
DELETED