@firecms/collection_editor 3.0.0-alpha.27 → 3.0.0-alpha.28
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/components/collection_editor/CollectionPropertiesEditorForm.d.ts +2 -2
- package/dist/components/collection_editor/PropertyEditView.d.ts +2 -2
- package/dist/components/collection_editor/PropertySelectItem.d.ts +3 -3
- package/dist/components/collection_editor/import/CollectionEditorImportMapping.d.ts +2 -2
- package/dist/components/collection_editor/properties/BlockPropertyField.d.ts +2 -2
- package/dist/components/collection_editor/properties/MapPropertyField.d.ts +2 -2
- package/dist/components/collection_editor/properties/RepeatPropertyField.d.ts +2 -2
- package/dist/components/collection_editor/utils/supported_fields.d.ts +1 -1
- package/dist/components/collection_editor/utils/update_property_for_widget.d.ts +2 -2
- package/dist/index.es.js +475 -460
- 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/types/config_controller.d.ts +8 -0
- package/package.json +4 -4
- package/src/ConfigControllerProvider.tsx +19 -0
- package/src/components/collection_editor/CollectionPropertiesEditorForm.tsx +2 -2
- package/src/components/collection_editor/PropertyEditView.tsx +12 -12
- package/src/components/collection_editor/PropertyFieldPreview.tsx +8 -8
- package/src/components/collection_editor/PropertySelectItem.tsx +6 -6
- package/src/components/collection_editor/import/CollectionEditorImportMapping.tsx +5 -5
- package/src/components/collection_editor/properties/BlockPropertyField.tsx +2 -2
- package/src/components/collection_editor/properties/MapPropertyField.tsx +2 -2
- package/src/components/collection_editor/properties/RepeatPropertyField.tsx +2 -2
- package/src/components/collection_editor/utils/update_property_for_widget.ts +23 -23
- package/src/types/config_controller.tsx +9 -0
|
@@ -11,6 +11,7 @@ export interface CollectionsConfigController {
|
|
|
11
11
|
[Key: string]: CMSType;
|
|
12
12
|
}>(params: SaveCollectionParams<M>) => Promise<void>;
|
|
13
13
|
saveProperty: (params: SavePropertyParams) => Promise<void>;
|
|
14
|
+
deleteProperty: (params: DeletePropertyParams) => Promise<void>;
|
|
14
15
|
deleteCollection: (props: DeleteCollectionParams) => Promise<void>;
|
|
15
16
|
}
|
|
16
17
|
export type SaveCollectionParams<M extends Record<string, any>> = {
|
|
@@ -27,6 +28,13 @@ export type SavePropertyParams = {
|
|
|
27
28
|
property: Property;
|
|
28
29
|
parentPathSegments?: string[];
|
|
29
30
|
};
|
|
31
|
+
export type DeletePropertyParams = {
|
|
32
|
+
path: string;
|
|
33
|
+
propertyKey: string;
|
|
34
|
+
namespace?: string;
|
|
35
|
+
newPropertiesOrder?: string[];
|
|
36
|
+
parentPathSegments?: string[];
|
|
37
|
+
};
|
|
30
38
|
export type DeleteCollectionParams = {
|
|
31
39
|
path: string;
|
|
32
40
|
parentPathSegments?: 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.28",
|
|
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.28",
|
|
18
|
+
"@firecms/schema_inference": "^3.0.0-alpha.28"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
21
21
|
"react": "^18.2.0",
|
|
@@ -76,5 +76,5 @@
|
|
|
76
76
|
"publishConfig": {
|
|
77
77
|
"access": "public"
|
|
78
78
|
},
|
|
79
|
-
"gitHead": "
|
|
79
|
+
"gitHead": "aba9501b45cf2dc84dc172084510b90e417b42f1"
|
|
80
80
|
}
|
|
@@ -276,6 +276,25 @@ export const ConfigControllerProvider = React.memo(
|
|
|
276
276
|
}}
|
|
277
277
|
onPropertyChangedImmediate={false}
|
|
278
278
|
onDelete={() => {
|
|
279
|
+
if (!currentPropertyDialog?.propertyKey) return;
|
|
280
|
+
const newPropertiesOrder = currentPropertyDialog?.currentPropertiesOrder?.filter(p => p !== currentPropertyDialog?.propertyKey);
|
|
281
|
+
return collectionConfigController.deleteProperty({
|
|
282
|
+
path: currentPropertyDialog?.editedCollectionPath,
|
|
283
|
+
propertyKey: currentPropertyDialog?.propertyKey,
|
|
284
|
+
namespace: currentPropertyDialog?.namespace,
|
|
285
|
+
newPropertiesOrder,
|
|
286
|
+
parentPathSegments: currentPropertyDialog?.parentPathSegments
|
|
287
|
+
})
|
|
288
|
+
.then(() => {
|
|
289
|
+
setCurrentPropertyDialog(undefined);
|
|
290
|
+
}).catch((e) => {
|
|
291
|
+
console.error(e);
|
|
292
|
+
snackbarController.open({
|
|
293
|
+
type: "error",
|
|
294
|
+
message: "Error deleting property: " + (e.message ?? "Details in the console")
|
|
295
|
+
});
|
|
296
|
+
return false;
|
|
297
|
+
});
|
|
279
298
|
}}
|
|
280
299
|
onError={() => {
|
|
281
300
|
}}
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
defaultBorderMixin,
|
|
12
12
|
EntityCollection,
|
|
13
13
|
ErrorBoundary,
|
|
14
|
-
|
|
14
|
+
PropertyConfig,
|
|
15
15
|
isPropertyBuilder,
|
|
16
16
|
makePropertiesEditable,
|
|
17
17
|
Paper,
|
|
@@ -41,7 +41,7 @@ type CollectionEditorFormProps = {
|
|
|
41
41
|
getUser: (uid: string) => User | null;
|
|
42
42
|
getData?: () => Promise<object[]>;
|
|
43
43
|
doCollectionInference: (collection: PersistedCollection<any, string>) => Promise<EntityCollection | null> | undefined;
|
|
44
|
-
customFields: Record<string,
|
|
44
|
+
customFields: Record<string, PropertyConfig>;
|
|
45
45
|
};
|
|
46
46
|
|
|
47
47
|
export function CollectionPropertiesEditorForm({
|
|
@@ -11,7 +11,6 @@ import {
|
|
|
11
11
|
Dialog,
|
|
12
12
|
DialogActions,
|
|
13
13
|
DialogContent,
|
|
14
|
-
FieldConfig,
|
|
15
14
|
FieldConfigBadge,
|
|
16
15
|
FieldConfigId,
|
|
17
16
|
getFieldConfig,
|
|
@@ -21,6 +20,7 @@ import {
|
|
|
21
20
|
isPropertyBuilder,
|
|
22
21
|
mergeDeep,
|
|
23
22
|
Property,
|
|
23
|
+
PropertyConfig,
|
|
24
24
|
Select,
|
|
25
25
|
toSnakeCase,
|
|
26
26
|
Typography
|
|
@@ -72,7 +72,7 @@ export type PropertyFormProps = {
|
|
|
72
72
|
allowDataInference: boolean;
|
|
73
73
|
getData?: () => Promise<object[]>;
|
|
74
74
|
getHelpers?: (formikProps: FormikProps<PropertyWithId>) => void;
|
|
75
|
-
customFields: Record<string,
|
|
75
|
+
customFields: Record<string, PropertyConfig>;
|
|
76
76
|
};
|
|
77
77
|
|
|
78
78
|
export const PropertyForm = React.memo(
|
|
@@ -139,7 +139,7 @@ export const PropertyForm = React.memo(
|
|
|
139
139
|
} = newPropertyWithId;
|
|
140
140
|
doOnPropertyChanged({
|
|
141
141
|
id,
|
|
142
|
-
property
|
|
142
|
+
property: { ...property, editable: property.editable ?? true }
|
|
143
143
|
});
|
|
144
144
|
if (!existingProperty)
|
|
145
145
|
helpers.resetForm({ values: initialValue });
|
|
@@ -287,7 +287,7 @@ function PropertyEditView({
|
|
|
287
287
|
existingPropertyKeys?: string[];
|
|
288
288
|
getData?: () => Promise<object[]>;
|
|
289
289
|
allowDataInference: boolean;
|
|
290
|
-
customFields: Record<string,
|
|
290
|
+
customFields: Record<string, PropertyConfig>;
|
|
291
291
|
} & FormikProps<PropertyWithId>) {
|
|
292
292
|
|
|
293
293
|
const [selectOpen, setSelectOpen] = useState(autoOpenTypeSelect);
|
|
@@ -297,7 +297,7 @@ function PropertyEditView({
|
|
|
297
297
|
const allSupportedFields = Object.entries(DEFAULT_FIELD_CONFIGS).concat(Object.entries(customFields));
|
|
298
298
|
|
|
299
299
|
const displayedWidgets = inArray
|
|
300
|
-
? allSupportedFields.filter(([_,
|
|
300
|
+
? allSupportedFields.filter(([_, propertyConfig]) => !isPropertyBuilder(propertyConfig.property) && propertyConfig.property?.dataType !== "array")
|
|
301
301
|
: allSupportedFields;
|
|
302
302
|
|
|
303
303
|
const deferredValues = useDeferredValue(values);
|
|
@@ -456,11 +456,11 @@ function PropertyEditView({
|
|
|
456
456
|
widget</em>;
|
|
457
457
|
}
|
|
458
458
|
const key = value as FieldConfigId;
|
|
459
|
-
const
|
|
460
|
-
const baseProperty =
|
|
459
|
+
const propertyConfig = DEFAULT_FIELD_CONFIGS[key] ?? customFields[key];
|
|
460
|
+
const baseProperty = propertyConfig.property;
|
|
461
461
|
const baseFieldConfig = baseProperty && !isPropertyBuilder(baseProperty) ? getFieldConfig(baseProperty, customFields) : undefined;
|
|
462
462
|
const optionDisabled = isPropertyBuilder(baseProperty) || (existing && baseProperty.dataType !== values?.dataType);
|
|
463
|
-
const computedFieldConfig = baseFieldConfig ? mergeDeep(baseFieldConfig,
|
|
463
|
+
const computedFieldConfig = baseFieldConfig ? mergeDeep(baseFieldConfig, propertyConfig) : propertyConfig;
|
|
464
464
|
return <div
|
|
465
465
|
onClick={(e) => {
|
|
466
466
|
if (optionDisabled) {
|
|
@@ -472,7 +472,7 @@ function PropertyEditView({
|
|
|
472
472
|
"flex items-center",
|
|
473
473
|
optionDisabled ? "w-full pointer-events-none opacity-50" : "")}>
|
|
474
474
|
<div className={"mr-8"}>
|
|
475
|
-
<FieldConfigBadge
|
|
475
|
+
<FieldConfigBadge propertyConfig={computedFieldConfig}/>
|
|
476
476
|
</div>
|
|
477
477
|
<div className={"flex flex-col items-start text-base text-left"}>
|
|
478
478
|
<div>{computedFieldConfig.name}</div>
|
|
@@ -486,14 +486,14 @@ function PropertyEditView({
|
|
|
486
486
|
onValueChange={(value) => {
|
|
487
487
|
onWidgetSelectChanged(value as FieldConfigId);
|
|
488
488
|
}}>
|
|
489
|
-
{displayedWidgets.map(([key,
|
|
490
|
-
const baseProperty =
|
|
489
|
+
{displayedWidgets.map(([key, propertyConfig]) => {
|
|
490
|
+
const baseProperty = propertyConfig.property;
|
|
491
491
|
const optionDisabled = existing && !isPropertyBuilder(baseProperty) && baseProperty.dataType !== values?.dataType;
|
|
492
492
|
return <PropertySelectItem
|
|
493
493
|
key={key}
|
|
494
494
|
value={key}
|
|
495
495
|
optionDisabled={optionDisabled}
|
|
496
|
-
|
|
496
|
+
propertyConfig={propertyConfig}
|
|
497
497
|
existing={existing}/>;
|
|
498
498
|
})}
|
|
499
499
|
</Select>
|
|
@@ -36,7 +36,7 @@ export function PropertyFieldPreview({
|
|
|
36
36
|
|
|
37
37
|
const { fields } = useFireCMSContext();
|
|
38
38
|
|
|
39
|
-
const
|
|
39
|
+
const propertyConfig = getFieldConfig(property, fields);
|
|
40
40
|
const disabled = !editableProperty(property);
|
|
41
41
|
|
|
42
42
|
const borderColorClass = hasError
|
|
@@ -48,7 +48,7 @@ export function PropertyFieldPreview({
|
|
|
48
48
|
onClick={onClick}
|
|
49
49
|
className="flex flex-row w-full cursor-pointer">
|
|
50
50
|
<div className={"m-4"}>
|
|
51
|
-
<FieldConfigBadge
|
|
51
|
+
<FieldConfigBadge propertyConfig={propertyConfig}/>
|
|
52
52
|
</div>
|
|
53
53
|
<Paper
|
|
54
54
|
className={cn(
|
|
@@ -81,7 +81,7 @@ export function PropertyFieldPreview({
|
|
|
81
81
|
variant={includeName ? "body2" : "subtitle1"}
|
|
82
82
|
component="span"
|
|
83
83
|
color="secondary">
|
|
84
|
-
{
|
|
84
|
+
{propertyConfig?.name}
|
|
85
85
|
</Typography>
|
|
86
86
|
</ErrorBoundary>
|
|
87
87
|
<ErrorBoundary>
|
|
@@ -122,15 +122,15 @@ export function NonEditablePropertyPreview({
|
|
|
122
122
|
|
|
123
123
|
const { fields } = useFireCMSContext();
|
|
124
124
|
|
|
125
|
-
const
|
|
125
|
+
const propertyConfig = !isPropertyBuilder(property) && property ? getFieldConfig(property, fields) : undefined;
|
|
126
126
|
|
|
127
127
|
return (
|
|
128
128
|
<div
|
|
129
129
|
onClick={onClick}
|
|
130
130
|
className="flex flex-row w-full cursor-pointer">
|
|
131
131
|
<div className={"relative m-4"}>
|
|
132
|
-
{
|
|
133
|
-
{!
|
|
132
|
+
{propertyConfig && <FieldConfigBadge propertyConfig={propertyConfig}/>}
|
|
133
|
+
{!propertyConfig && <div
|
|
134
134
|
className={"h-8 w-8 p-1 rounded-full shadow text-white bg-gray-500"}>
|
|
135
135
|
<FunctionsIcon color={"inherit"} size={"medium"}/>
|
|
136
136
|
</div>}
|
|
@@ -157,11 +157,11 @@ export function NonEditablePropertyPreview({
|
|
|
157
157
|
</Typography>
|
|
158
158
|
|
|
159
159
|
<div className="flex flex-row items-center">
|
|
160
|
-
{
|
|
160
|
+
{propertyConfig && <Typography className="flex-grow pr-2"
|
|
161
161
|
variant={"body2"}
|
|
162
162
|
component="span"
|
|
163
163
|
color="secondary">
|
|
164
|
-
{
|
|
164
|
+
{propertyConfig?.name}
|
|
165
165
|
</Typography>}
|
|
166
166
|
|
|
167
167
|
{property && !isPropertyBuilder(property) && <ErrorBoundary>
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { cn,
|
|
1
|
+
import { cn, PropertyConfig, FieldConfigBadge, SelectItem, Typography } from "@firecms/core";
|
|
2
2
|
|
|
3
3
|
export interface PropertySelectItemProps {
|
|
4
4
|
value: string;
|
|
5
5
|
optionDisabled: boolean;
|
|
6
|
-
|
|
6
|
+
propertyConfig: PropertyConfig;
|
|
7
7
|
existing: boolean;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
export function PropertySelectItem({ value, optionDisabled,
|
|
10
|
+
export function PropertySelectItem({ value, optionDisabled, propertyConfig, existing }: PropertySelectItemProps) {
|
|
11
11
|
return <SelectItem value={value}
|
|
12
12
|
disabled={optionDisabled}
|
|
13
13
|
className={"flex flex-row items-center"}>
|
|
@@ -16,14 +16,14 @@ export function PropertySelectItem({ value, optionDisabled, fieldConfig, existin
|
|
|
16
16
|
"flex flex-row items-center text-base min-h-[52px]",
|
|
17
17
|
optionDisabled ? "w-full" : "")}>
|
|
18
18
|
<div className={"mr-8"}>
|
|
19
|
-
<FieldConfigBadge
|
|
19
|
+
<FieldConfigBadge propertyConfig={propertyConfig}/>
|
|
20
20
|
</div>
|
|
21
21
|
<div>
|
|
22
|
-
<div>{
|
|
22
|
+
<div>{propertyConfig.name}</div>
|
|
23
23
|
<Typography variant={"caption"}
|
|
24
24
|
color={"disabled"}
|
|
25
25
|
className={"max-w-sm"}>
|
|
26
|
-
{existing && optionDisabled ? "You can only switch to widgets that use the same data type" :
|
|
26
|
+
{existing && optionDisabled ? "You can only switch to widgets that use the same data type" : propertyConfig.description}
|
|
27
27
|
</Typography>
|
|
28
28
|
</div>
|
|
29
29
|
</div>
|
|
@@ -8,7 +8,7 @@ import { getIn, useFormikContext } from "formik";
|
|
|
8
8
|
|
|
9
9
|
import {
|
|
10
10
|
Container,
|
|
11
|
-
|
|
11
|
+
PropertyConfig,
|
|
12
12
|
FieldConfigBadge,
|
|
13
13
|
getFieldConfig,
|
|
14
14
|
getFieldId,
|
|
@@ -34,7 +34,7 @@ export function CollectionEditorImportMapping({
|
|
|
34
34
|
}:
|
|
35
35
|
{
|
|
36
36
|
importConfig: ImportConfig,
|
|
37
|
-
customFields: Record<string,
|
|
37
|
+
customFields: Record<string, PropertyConfig>
|
|
38
38
|
}) {
|
|
39
39
|
|
|
40
40
|
const {
|
|
@@ -223,7 +223,7 @@ function PropertySelect({
|
|
|
223
223
|
previousId,
|
|
224
224
|
namespace
|
|
225
225
|
}: OnPropertyChangedParams) => void,
|
|
226
|
-
customFields: Record<string,
|
|
226
|
+
customFields: Record<string, PropertyConfig>,
|
|
227
227
|
disabled?: boolean
|
|
228
228
|
}) {
|
|
229
229
|
|
|
@@ -247,7 +247,7 @@ function PropertySelect({
|
|
|
247
247
|
position={"item-aligned"}
|
|
248
248
|
renderValue={(value) => {
|
|
249
249
|
if (!widget) return null;
|
|
250
|
-
return <FieldConfigBadge
|
|
250
|
+
return <FieldConfigBadge propertyConfig={widget}/>
|
|
251
251
|
}}
|
|
252
252
|
onValueChange={(newSelectedWidgetId) => {
|
|
253
253
|
const newProperty = updatePropertyFromWidget(property, newSelectedWidgetId, customFields)
|
|
@@ -265,7 +265,7 @@ function PropertySelect({
|
|
|
265
265
|
key={key}
|
|
266
266
|
value={key}
|
|
267
267
|
optionDisabled={false}
|
|
268
|
-
|
|
268
|
+
propertyConfig={widget}
|
|
269
269
|
existing={false}/>;
|
|
270
270
|
})
|
|
271
271
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useCallback, useState } from "react";
|
|
2
|
-
import { AddIcon, ArrayProperty, Button,
|
|
2
|
+
import { AddIcon, ArrayProperty, Button, PropertyConfig, Paper, Property, Typography } from "@firecms/core";
|
|
3
3
|
import { getIn, useFormikContext } from "formik";
|
|
4
4
|
import { PropertyFormDialog } from "../PropertyEditView";
|
|
5
5
|
import { getFullId, idToPropertiesPath, namespaceToPropertiesOrderPath } from "../util";
|
|
@@ -9,7 +9,7 @@ export function BlockPropertyField({ disabled, getData, allowDataInference, cust
|
|
|
9
9
|
disabled: boolean;
|
|
10
10
|
getData?: () => Promise<object[]>;
|
|
11
11
|
allowDataInference: boolean;
|
|
12
|
-
customFields: Record<string,
|
|
12
|
+
customFields: Record<string, PropertyConfig>
|
|
13
13
|
}) {
|
|
14
14
|
|
|
15
15
|
const {
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
AddIcon,
|
|
4
4
|
BooleanSwitchWithLabel,
|
|
5
5
|
Button,
|
|
6
|
-
|
|
6
|
+
PropertyConfig,
|
|
7
7
|
MapProperty,
|
|
8
8
|
Paper,
|
|
9
9
|
Property,
|
|
@@ -19,7 +19,7 @@ export function MapPropertyField({ disabled, getData, allowDataInference, custom
|
|
|
19
19
|
disabled: boolean;
|
|
20
20
|
getData?: () => Promise<object[]>;
|
|
21
21
|
allowDataInference: boolean;
|
|
22
|
-
customFields: Record<string,
|
|
22
|
+
customFields: Record<string, PropertyConfig>
|
|
23
23
|
}) {
|
|
24
24
|
|
|
25
25
|
const {
|
|
@@ -2,7 +2,7 @@ import React, { useCallback, useState } from "react";
|
|
|
2
2
|
import {
|
|
3
3
|
ArrayProperty,
|
|
4
4
|
Button,
|
|
5
|
-
|
|
5
|
+
PropertyConfig,
|
|
6
6
|
getFieldConfig,
|
|
7
7
|
Paper,
|
|
8
8
|
Property,
|
|
@@ -28,7 +28,7 @@ export function RepeatPropertyField({
|
|
|
28
28
|
disabled: boolean,
|
|
29
29
|
getData?: () => Promise<object[]>;
|
|
30
30
|
allowDataInference: boolean;
|
|
31
|
-
customFields: Record<string,
|
|
31
|
+
customFields: Record<string, PropertyConfig>
|
|
32
32
|
}) {
|
|
33
33
|
|
|
34
34
|
const { fields } = useFireCMSContext();
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { buildProperty,
|
|
1
|
+
import { buildProperty, PropertyConfig, mergeDeep, Property } from "@firecms/core";
|
|
2
2
|
|
|
3
3
|
export function updatePropertyFromWidget(propertyData: any,
|
|
4
4
|
selectedWidgetId: string | undefined,
|
|
5
|
-
customFields: Record<string,
|
|
5
|
+
customFields: Record<string, PropertyConfig>): Property {
|
|
6
6
|
|
|
7
7
|
let updatedProperty;
|
|
8
8
|
if (selectedWidgetId === "text_field") {
|
|
@@ -10,7 +10,7 @@ export function updatePropertyFromWidget(propertyData: any,
|
|
|
10
10
|
propertyData,
|
|
11
11
|
buildProperty({
|
|
12
12
|
dataType: "string",
|
|
13
|
-
|
|
13
|
+
propertyConfig: "text_field",
|
|
14
14
|
editable: propertyData.editable !== undefined ? propertyData.editable : true,
|
|
15
15
|
storage: undefined,
|
|
16
16
|
multiline: undefined,
|
|
@@ -25,7 +25,7 @@ export function updatePropertyFromWidget(propertyData: any,
|
|
|
25
25
|
propertyData,
|
|
26
26
|
buildProperty({
|
|
27
27
|
dataType: "string",
|
|
28
|
-
|
|
28
|
+
propertyConfig: "multiline",
|
|
29
29
|
editable: propertyData.editable !== undefined ? propertyData.editable : true,
|
|
30
30
|
multiline: true,
|
|
31
31
|
storage: undefined,
|
|
@@ -40,7 +40,7 @@ export function updatePropertyFromWidget(propertyData: any,
|
|
|
40
40
|
propertyData,
|
|
41
41
|
buildProperty({
|
|
42
42
|
dataType: "string",
|
|
43
|
-
|
|
43
|
+
propertyConfig: "markdown",
|
|
44
44
|
editable: propertyData.editable !== undefined ? propertyData.editable : true,
|
|
45
45
|
storage: undefined,
|
|
46
46
|
multiline: undefined,
|
|
@@ -54,7 +54,7 @@ export function updatePropertyFromWidget(propertyData: any,
|
|
|
54
54
|
propertyData,
|
|
55
55
|
buildProperty({
|
|
56
56
|
dataType: "string",
|
|
57
|
-
|
|
57
|
+
propertyConfig: "url",
|
|
58
58
|
editable: propertyData.editable !== undefined ? propertyData.editable : true,
|
|
59
59
|
storage: undefined,
|
|
60
60
|
multiline: undefined,
|
|
@@ -69,7 +69,7 @@ export function updatePropertyFromWidget(propertyData: any,
|
|
|
69
69
|
propertyData,
|
|
70
70
|
buildProperty({
|
|
71
71
|
dataType: "string",
|
|
72
|
-
|
|
72
|
+
propertyConfig: "email",
|
|
73
73
|
editable: propertyData.editable !== undefined ? propertyData.editable : true,
|
|
74
74
|
storage: undefined,
|
|
75
75
|
multiline: undefined,
|
|
@@ -84,7 +84,7 @@ export function updatePropertyFromWidget(propertyData: any,
|
|
|
84
84
|
propertyData,
|
|
85
85
|
buildProperty({
|
|
86
86
|
dataType: "string",
|
|
87
|
-
|
|
87
|
+
propertyConfig: "select",
|
|
88
88
|
editable: propertyData.editable !== undefined ? propertyData.editable : true,
|
|
89
89
|
storage: undefined,
|
|
90
90
|
multiline: undefined,
|
|
@@ -99,7 +99,7 @@ export function updatePropertyFromWidget(propertyData: any,
|
|
|
99
99
|
propertyData,
|
|
100
100
|
buildProperty({
|
|
101
101
|
dataType: "array",
|
|
102
|
-
|
|
102
|
+
propertyConfig: "multi_select",
|
|
103
103
|
editable: propertyData.editable !== undefined ? propertyData.editable : true,
|
|
104
104
|
of: {
|
|
105
105
|
dataType: "string",
|
|
@@ -112,7 +112,7 @@ export function updatePropertyFromWidget(propertyData: any,
|
|
|
112
112
|
propertyData,
|
|
113
113
|
buildProperty({
|
|
114
114
|
dataType: "number",
|
|
115
|
-
|
|
115
|
+
propertyConfig: "number_input",
|
|
116
116
|
editable: propertyData.editable !== undefined ? propertyData.editable : true,
|
|
117
117
|
enumValues: undefined
|
|
118
118
|
})
|
|
@@ -122,7 +122,7 @@ export function updatePropertyFromWidget(propertyData: any,
|
|
|
122
122
|
propertyData,
|
|
123
123
|
buildProperty({
|
|
124
124
|
dataType: "number",
|
|
125
|
-
|
|
125
|
+
propertyConfig: "number_select",
|
|
126
126
|
editable: propertyData.editable !== undefined ? propertyData.editable : true,
|
|
127
127
|
enumValues: propertyData.enumValues ?? []
|
|
128
128
|
})
|
|
@@ -132,7 +132,7 @@ export function updatePropertyFromWidget(propertyData: any,
|
|
|
132
132
|
propertyData,
|
|
133
133
|
buildProperty({
|
|
134
134
|
dataType: "array",
|
|
135
|
-
|
|
135
|
+
propertyConfig: "multi_number_select",
|
|
136
136
|
editable: propertyData.editable !== undefined ? propertyData.editable : true,
|
|
137
137
|
of: {
|
|
138
138
|
dataType: "number",
|
|
@@ -145,7 +145,7 @@ export function updatePropertyFromWidget(propertyData: any,
|
|
|
145
145
|
propertyData,
|
|
146
146
|
buildProperty({
|
|
147
147
|
dataType: "string",
|
|
148
|
-
|
|
148
|
+
propertyConfig: "file_upload",
|
|
149
149
|
editable: propertyData.editable !== undefined ? propertyData.editable : true,
|
|
150
150
|
storage: {
|
|
151
151
|
storagePath: "/"
|
|
@@ -157,7 +157,7 @@ export function updatePropertyFromWidget(propertyData: any,
|
|
|
157
157
|
propertyData,
|
|
158
158
|
buildProperty({
|
|
159
159
|
dataType: "array",
|
|
160
|
-
|
|
160
|
+
propertyConfig: "multi_file_upload",
|
|
161
161
|
editable: propertyData.editable !== undefined ? propertyData.editable : true,
|
|
162
162
|
of: {
|
|
163
163
|
dataType: "string",
|
|
@@ -172,7 +172,7 @@ export function updatePropertyFromWidget(propertyData: any,
|
|
|
172
172
|
propertyData,
|
|
173
173
|
buildProperty({
|
|
174
174
|
dataType: "map",
|
|
175
|
-
|
|
175
|
+
propertyConfig: "group",
|
|
176
176
|
editable: propertyData.editable !== undefined ? propertyData.editable : true,
|
|
177
177
|
keyValue: false,
|
|
178
178
|
properties: propertyData.properties ?? {}
|
|
@@ -183,7 +183,7 @@ export function updatePropertyFromWidget(propertyData: any,
|
|
|
183
183
|
propertyData,
|
|
184
184
|
buildProperty({
|
|
185
185
|
dataType: "map",
|
|
186
|
-
|
|
186
|
+
propertyConfig: "key_value",
|
|
187
187
|
editable: propertyData.editable !== undefined ? propertyData.editable : true,
|
|
188
188
|
keyValue: true,
|
|
189
189
|
properties: undefined
|
|
@@ -194,7 +194,7 @@ export function updatePropertyFromWidget(propertyData: any,
|
|
|
194
194
|
propertyData,
|
|
195
195
|
buildProperty({
|
|
196
196
|
dataType: "reference",
|
|
197
|
-
|
|
197
|
+
propertyConfig: "reference",
|
|
198
198
|
editable: propertyData.editable !== undefined ? propertyData.editable : true
|
|
199
199
|
})
|
|
200
200
|
);
|
|
@@ -203,7 +203,7 @@ export function updatePropertyFromWidget(propertyData: any,
|
|
|
203
203
|
propertyData,
|
|
204
204
|
buildProperty({
|
|
205
205
|
dataType: "array",
|
|
206
|
-
|
|
206
|
+
propertyConfig: "multi_references",
|
|
207
207
|
editable: propertyData.editable !== undefined ? propertyData.editable : true,
|
|
208
208
|
of: {
|
|
209
209
|
dataType: "reference"
|
|
@@ -215,7 +215,7 @@ export function updatePropertyFromWidget(propertyData: any,
|
|
|
215
215
|
propertyData,
|
|
216
216
|
buildProperty({
|
|
217
217
|
dataType: "boolean",
|
|
218
|
-
|
|
218
|
+
propertyConfig: "switch",
|
|
219
219
|
editable: propertyData.editable !== undefined ? propertyData.editable : true
|
|
220
220
|
})
|
|
221
221
|
);
|
|
@@ -224,7 +224,7 @@ export function updatePropertyFromWidget(propertyData: any,
|
|
|
224
224
|
propertyData,
|
|
225
225
|
buildProperty({
|
|
226
226
|
dataType: "date",
|
|
227
|
-
|
|
227
|
+
propertyConfig: "date_time",
|
|
228
228
|
editable: propertyData.editable !== undefined ? propertyData.editable : true,
|
|
229
229
|
mode: "date_time"
|
|
230
230
|
})
|
|
@@ -234,7 +234,7 @@ export function updatePropertyFromWidget(propertyData: any,
|
|
|
234
234
|
propertyData,
|
|
235
235
|
buildProperty({
|
|
236
236
|
dataType: "array",
|
|
237
|
-
|
|
237
|
+
propertyConfig: "repeat",
|
|
238
238
|
editable: propertyData.editable !== undefined ? propertyData.editable : true
|
|
239
239
|
})
|
|
240
240
|
);
|
|
@@ -243,7 +243,7 @@ export function updatePropertyFromWidget(propertyData: any,
|
|
|
243
243
|
propertyData,
|
|
244
244
|
buildProperty({
|
|
245
245
|
dataType: "array",
|
|
246
|
-
|
|
246
|
+
propertyConfig: "block",
|
|
247
247
|
editable: propertyData.editable !== undefined ? propertyData.editable : true,
|
|
248
248
|
oneOf: {
|
|
249
249
|
properties: {}
|
|
@@ -251,7 +251,7 @@ export function updatePropertyFromWidget(propertyData: any,
|
|
|
251
251
|
})
|
|
252
252
|
);
|
|
253
253
|
} else if (selectedWidgetId && customFields[selectedWidgetId]) {
|
|
254
|
-
updatedProperty = { ...customFields[selectedWidgetId].property,
|
|
254
|
+
updatedProperty = { ...customFields[selectedWidgetId].property, propertyConfig: selectedWidgetId };
|
|
255
255
|
}
|
|
256
256
|
|
|
257
257
|
return updatedProperty;
|
|
@@ -14,6 +14,7 @@ export interface CollectionsConfigController {
|
|
|
14
14
|
saveCollection: <M extends { [Key: string]: CMSType }>(params: SaveCollectionParams<M>) => Promise<void>;
|
|
15
15
|
|
|
16
16
|
saveProperty: (params: SavePropertyParams) => Promise<void>;
|
|
17
|
+
deleteProperty: (params: DeletePropertyParams) => Promise<void>;
|
|
17
18
|
|
|
18
19
|
deleteCollection: (props: DeleteCollectionParams) => Promise<void>;
|
|
19
20
|
|
|
@@ -35,6 +36,14 @@ export type SavePropertyParams = {
|
|
|
35
36
|
parentPathSegments?: string[]
|
|
36
37
|
}
|
|
37
38
|
|
|
39
|
+
export type DeletePropertyParams = {
|
|
40
|
+
path: string,
|
|
41
|
+
propertyKey: string,
|
|
42
|
+
namespace?: string,
|
|
43
|
+
newPropertiesOrder?: string[],
|
|
44
|
+
parentPathSegments?: string[]
|
|
45
|
+
}
|
|
46
|
+
|
|
38
47
|
export type DeleteCollectionParams = {
|
|
39
48
|
path: string,
|
|
40
49
|
parentPathSegments?: string[]
|