@firecms/collection_editor 3.0.0-beta.10 → 3.0.0-beta.11
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.es.js +8975 -5244
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +8967 -5237
- package/dist/index.umd.js.map +1 -1
- package/dist/types/config_permissions.d.ts +2 -2
- package/dist/types/persisted_collection.d.ts +1 -1
- package/dist/useCollectionEditorPlugin.d.ts +4 -4
- package/package.json +18 -16
- package/src/types/config_permissions.ts +1 -1
- package/src/types/persisted_collection.ts +2 -3
- package/src/ui/CollectionViewHeaderAction.tsx +1 -1
- package/src/ui/NewCollectionButton.tsx +1 -1
- package/src/ui/PropertyAddColumnComponent.tsx +2 -2
- package/src/ui/collection_editor/CollectionDetailsForm.tsx +8 -4
- package/src/ui/collection_editor/CollectionEditorDialog.tsx +9 -5
- package/src/ui/collection_editor/CollectionEditorWelcomeView.tsx +2 -2
- package/src/ui/collection_editor/CollectionPropertiesEditorForm.tsx +5 -9
- package/src/ui/collection_editor/EntityCustomViewsSelectDialog.tsx +6 -5
- package/src/ui/collection_editor/EnumForm.tsx +10 -6
- package/src/ui/collection_editor/GetCodeDialog.tsx +41 -23
- package/src/ui/collection_editor/PropertyEditView.tsx +7 -4
- package/src/ui/collection_editor/PropertyFieldPreview.tsx +4 -4
- package/src/ui/collection_editor/PropertyTree.tsx +2 -2
- package/src/ui/collection_editor/UnsavedChangesDialog.tsx +3 -5
- package/src/ui/collection_editor/import/CollectionEditorImportMapping.tsx +2 -0
- package/src/ui/collection_editor/properties/BlockPropertyField.tsx +18 -12
- package/src/ui/collection_editor/properties/DateTimePropertyField.tsx +4 -0
- package/src/ui/collection_editor/properties/EnumPropertyField.tsx +2 -0
- package/src/ui/collection_editor/properties/MapPropertyField.tsx +2 -1
- package/src/ui/collection_editor/properties/MarkdownPropertyField.tsx +3 -3
- package/src/ui/collection_editor/properties/ReferencePropertyField.tsx +2 -0
- package/src/ui/collection_editor/properties/StoragePropertyField.tsx +3 -3
- package/src/ui/collection_editor/properties/UrlPropertyField.tsx +1 -0
- package/src/ui/collection_editor/properties/validation/ValidationPanel.tsx +1 -1
- package/src/useCollectionEditorPlugin.tsx +6 -6
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { Button, Dialog, DialogActions, DialogContent, Typography } from "@firecms/ui";
|
|
2
|
+
import { Button, Dialog, DialogActions, DialogContent, DialogTitle, Typography } from "@firecms/ui";
|
|
3
3
|
|
|
4
4
|
export interface UnsavedChangesDialogProps {
|
|
5
5
|
open: boolean;
|
|
@@ -24,11 +24,9 @@ export function UnsavedChangesDialog({
|
|
|
24
24
|
aria-labelledby="alert-dialog-title"
|
|
25
25
|
aria-describedby="alert-dialog-description"
|
|
26
26
|
>
|
|
27
|
-
<DialogContent>
|
|
28
|
-
<Typography variant={"h6"}>
|
|
29
|
-
{title ?? "Unsaved changes"}
|
|
30
|
-
</Typography>
|
|
31
27
|
|
|
28
|
+
<DialogTitle>{title ?? "Unsaved changes"}</DialogTitle>
|
|
29
|
+
<DialogContent>
|
|
32
30
|
{body && <Typography>
|
|
33
31
|
{body}
|
|
34
32
|
</Typography>}
|
|
@@ -235,9 +235,11 @@ function PropertySelect({
|
|
|
235
235
|
open={selectOpen}
|
|
236
236
|
onOpenChange={setSelectOpen}
|
|
237
237
|
invisible={true}
|
|
238
|
+
size={"large"}
|
|
238
239
|
className={"w-full"}
|
|
239
240
|
disabled={disabled}
|
|
240
241
|
error={!widget}
|
|
242
|
+
fullWidth={true}
|
|
241
243
|
value={fieldId ?? ""}
|
|
242
244
|
placeholder={"Select a property widget"}
|
|
243
245
|
position={"item-aligned"}
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
2
|
import { AddIcon, Button, Paper, Typography } from "@firecms/ui";
|
|
3
3
|
import { getIn, useFormex } from "@firecms/formex";
|
|
4
|
-
import { PropertyFormDialog } from "../PropertyEditView";
|
|
5
|
-
import {
|
|
4
|
+
import { OnPropertyChangedParams, PropertyFormDialog } from "../PropertyEditView";
|
|
5
|
+
import {
|
|
6
|
+
getFullId,
|
|
7
|
+
getFullIdPath,
|
|
8
|
+
idToPropertiesPath,
|
|
9
|
+
namespaceToPropertiesOrderPath,
|
|
10
|
+
namespaceToPropertiesPath
|
|
11
|
+
} from "../util";
|
|
6
12
|
import { PropertyTree } from "../PropertyTree";
|
|
7
|
-
import { ArrayProperty,
|
|
13
|
+
import { ArrayProperty, PropertyConfig } from "@firecms/core";
|
|
8
14
|
|
|
9
15
|
export function BlockPropertyField({
|
|
10
16
|
disabled,
|
|
@@ -31,18 +37,17 @@ export function BlockPropertyField({
|
|
|
31
37
|
|
|
32
38
|
const onPropertyChanged = ({
|
|
33
39
|
id,
|
|
40
|
+
namespace,
|
|
34
41
|
property
|
|
35
|
-
}:
|
|
42
|
+
}: OnPropertyChangedParams) => {
|
|
36
43
|
if (!id)
|
|
37
44
|
throw Error();
|
|
38
45
|
|
|
39
|
-
setFieldValue("oneOf.
|
|
40
|
-
|
|
41
|
-
[id]: property
|
|
42
|
-
}, false);
|
|
46
|
+
setFieldValue("oneOf." + getFullIdPath(id, namespace), property, false);
|
|
47
|
+
|
|
43
48
|
const currentPropertiesOrder = values.oneOf?.propertiesOrder ?? Object.keys(values.oneOf?.properties ?? {});
|
|
44
49
|
const newPropertiesOrder = currentPropertiesOrder.includes(id) ? currentPropertiesOrder : [...currentPropertiesOrder, id];
|
|
45
|
-
setFieldValue("oneOf.
|
|
50
|
+
setFieldValue("oneOf." + namespaceToPropertiesOrderPath(namespace), newPropertiesOrder, false);
|
|
46
51
|
setPropertyDialogOpen(false);
|
|
47
52
|
};
|
|
48
53
|
|
|
@@ -82,8 +87,9 @@ export function BlockPropertyField({
|
|
|
82
87
|
<>
|
|
83
88
|
<div className={"col-span-12"}>
|
|
84
89
|
<div className={"flex justify-between items-end mt-8 mb-4"}>
|
|
85
|
-
<Typography variant={"subtitle2"}>
|
|
86
|
-
block
|
|
90
|
+
<Typography variant={"subtitle2"}>
|
|
91
|
+
Properties in this block
|
|
92
|
+
</Typography>
|
|
87
93
|
{addChildButton}
|
|
88
94
|
</div>
|
|
89
95
|
<Paper className="p-2 pl-8">
|
|
@@ -104,7 +110,7 @@ export function BlockPropertyField({
|
|
|
104
110
|
? undefined
|
|
105
111
|
: onPropertyMove}/>
|
|
106
112
|
|
|
107
|
-
{!disabled &&
|
|
113
|
+
{!disabled && (values.oneOf?.propertiesOrder?.length === 0)&&
|
|
108
114
|
<div className="h-full flex items-center justify-center p-4">
|
|
109
115
|
Add the first property to this block
|
|
110
116
|
</div>}
|
|
@@ -31,8 +31,10 @@ export function DateTimePropertyField({ disabled }: {
|
|
|
31
31
|
<Select name={modePath}
|
|
32
32
|
value={modeValue ?? "date"}
|
|
33
33
|
error={Boolean(modeError)}
|
|
34
|
+
size={"large"}
|
|
34
35
|
onValueChange={(v) => setFieldValue(modePath, v)}
|
|
35
36
|
label={"Mode"}
|
|
37
|
+
fullWidth={true}
|
|
36
38
|
renderValue={(v) => {
|
|
37
39
|
switch (v) {
|
|
38
40
|
case "date_time":
|
|
@@ -54,6 +56,8 @@ export function DateTimePropertyField({ disabled }: {
|
|
|
54
56
|
<div>
|
|
55
57
|
<Select name={autoValuePath}
|
|
56
58
|
disabled={disabled}
|
|
59
|
+
size={"large"}
|
|
60
|
+
fullWidth={true}
|
|
57
61
|
value={autoValueValue ?? ""}
|
|
58
62
|
onValueChange={(v) => setFieldValue(autoValuePath, v === "none" ? null : v)}
|
|
59
63
|
renderValue={(v) => {
|
|
@@ -93,9 +93,11 @@ export function EnumPropertyField({
|
|
|
93
93
|
<Select
|
|
94
94
|
disabled={disabled}
|
|
95
95
|
position={"item-aligned"}
|
|
96
|
+
fullWidth={true}
|
|
96
97
|
onValueChange={(value: string) => {
|
|
97
98
|
setFieldValue("defaultValue", value);
|
|
98
99
|
}}
|
|
100
|
+
size={"large"}
|
|
99
101
|
label={"Default value"}
|
|
100
102
|
value={defaultValue ?? ""}>
|
|
101
103
|
{enumValues
|
|
@@ -113,7 +113,8 @@ export function MapPropertyField({ disabled, getData, allowDataInference, proper
|
|
|
113
113
|
value={values.spreadChildren ?? false}
|
|
114
114
|
/>
|
|
115
115
|
<FieldCaption>
|
|
116
|
-
Set this flag to true if you want to display the children of this group as individual columns.
|
|
116
|
+
Set this flag to true if you want to display the children of this group as individual columns. This
|
|
117
|
+
will only work for top level groups.
|
|
117
118
|
</FieldCaption>
|
|
118
119
|
</div>
|
|
119
120
|
|
|
@@ -3,7 +3,7 @@ import { StringPropertyValidation } from "./validation/StringPropertyValidation"
|
|
|
3
3
|
import { ValidationPanel } from "./validation/ValidationPanel";
|
|
4
4
|
import { Field, getIn, useFormex } from "@firecms/formex";
|
|
5
5
|
|
|
6
|
-
import { DebouncedTextField, ExpandablePanel,
|
|
6
|
+
import { CloudUploadIcon, DebouncedTextField, ExpandablePanel, TextField, Typography } from "@firecms/ui";
|
|
7
7
|
|
|
8
8
|
export function MarkdownPropertyField({
|
|
9
9
|
disabled,
|
|
@@ -54,8 +54,8 @@ export function MarkdownPropertyField({
|
|
|
54
54
|
<div className={"col-span-12"}>
|
|
55
55
|
<ExpandablePanel
|
|
56
56
|
title={
|
|
57
|
-
<div className="flex flex-row text-
|
|
58
|
-
<
|
|
57
|
+
<div className="flex flex-row text-surface-500">
|
|
58
|
+
<CloudUploadIcon/>
|
|
59
59
|
<Typography variant={"subtitle2"}
|
|
60
60
|
className="ml-2">
|
|
61
61
|
File upload config
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import {
|
|
3
3
|
Button,
|
|
4
|
+
CloudUploadIcon,
|
|
4
5
|
DebouncedTextField,
|
|
5
6
|
ExpandablePanel,
|
|
6
|
-
FileUploadIcon,
|
|
7
7
|
MultiSelect,
|
|
8
8
|
MultiSelectItem,
|
|
9
9
|
Typography
|
|
@@ -74,8 +74,8 @@ export function StoragePropertyField({
|
|
|
74
74
|
|
|
75
75
|
<ExpandablePanel
|
|
76
76
|
title={
|
|
77
|
-
<div className="flex flex-row text-
|
|
78
|
-
<
|
|
77
|
+
<div className="flex flex-row text-surface-500">
|
|
78
|
+
<CloudUploadIcon/>
|
|
79
79
|
<Typography variant={"subtitle2"}
|
|
80
80
|
className="ml-2">
|
|
81
81
|
File upload config
|
|
@@ -12,7 +12,7 @@ export function ValidationPanel({
|
|
|
12
12
|
asField={true}
|
|
13
13
|
innerClassName="p-4"
|
|
14
14
|
title={
|
|
15
|
-
<div className="flex flex-row text-
|
|
15
|
+
<div className="flex flex-row text-surface-500">
|
|
16
16
|
<RuleIcon/>
|
|
17
17
|
<Typography variant={"subtitle2"}
|
|
18
18
|
className="ml-2">
|
|
@@ -15,7 +15,7 @@ import { useCollectionEditorController } from "./useCollectionEditorController";
|
|
|
15
15
|
import { EditorCollectionActionStart } from "./ui/EditorCollectionActionStart";
|
|
16
16
|
import { NewCollectionCard } from "./ui/NewCollectionCard";
|
|
17
17
|
|
|
18
|
-
export interface CollectionConfigControllerProps<EC extends PersistedCollection = PersistedCollection,
|
|
18
|
+
export interface CollectionConfigControllerProps<EC extends PersistedCollection = PersistedCollection, USER extends User = User> {
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* Firebase app where the configuration is saved.
|
|
@@ -25,7 +25,7 @@ export interface CollectionConfigControllerProps<EC extends PersistedCollection
|
|
|
25
25
|
/**
|
|
26
26
|
* Define what actions can be performed on the configuration.
|
|
27
27
|
*/
|
|
28
|
-
configPermissions?: CollectionEditorPermissionsBuilder<
|
|
28
|
+
configPermissions?: CollectionEditorPermissionsBuilder<USER, EC>;
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
31
|
* The words you define here will not be allowed to be used as group
|
|
@@ -47,7 +47,7 @@ export interface CollectionConfigControllerProps<EC extends PersistedCollection
|
|
|
47
47
|
|
|
48
48
|
getData?: (path: string, parentPaths: string[]) => Promise<object[]>;
|
|
49
49
|
|
|
50
|
-
getUser?: (uid: string) =>
|
|
50
|
+
getUser?: (uid: string) => USER | null;
|
|
51
51
|
|
|
52
52
|
onAnalyticsEvent?: (event: string, params?: object) => void;
|
|
53
53
|
|
|
@@ -71,7 +71,7 @@ export interface CollectionConfigControllerProps<EC extends PersistedCollection
|
|
|
71
71
|
* @param getUser
|
|
72
72
|
* @param collectionInference
|
|
73
73
|
*/
|
|
74
|
-
export function useCollectionEditorPlugin<EC extends PersistedCollection = PersistedCollection,
|
|
74
|
+
export function useCollectionEditorPlugin<EC extends PersistedCollection = PersistedCollection, USER extends User = User>
|
|
75
75
|
({
|
|
76
76
|
collectionConfigController,
|
|
77
77
|
configPermissions,
|
|
@@ -83,7 +83,7 @@ export function useCollectionEditorPlugin<EC extends PersistedCollection = Persi
|
|
|
83
83
|
getData,
|
|
84
84
|
onAnalyticsEvent,
|
|
85
85
|
components
|
|
86
|
-
}: CollectionConfigControllerProps<EC,
|
|
86
|
+
}: CollectionConfigControllerProps<EC, USER>): FireCMSPlugin<any, any, PersistedCollection> {
|
|
87
87
|
|
|
88
88
|
return {
|
|
89
89
|
key: "collection_editor",
|
|
@@ -140,7 +140,7 @@ export function IntroWidget({}: {}) {
|
|
|
140
140
|
|
|
141
141
|
return (
|
|
142
142
|
<Paper
|
|
143
|
-
className={"my-4 px-4 py-6 flex flex-col bg-white dark:bg-
|
|
143
|
+
className={"my-4 px-4 py-6 flex flex-col bg-white dark:bg-surface-accent-800 gap-2"}>
|
|
144
144
|
<Typography variant={"subtitle2"} className={"uppercase"}>No collections found</Typography>
|
|
145
145
|
<Typography>
|
|
146
146
|
Start building collections in FireCMS easily. Map them to your existing
|