@firecms/core 3.0.0-canary.109 → 3.0.0-canary.110
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/form/field_bindings/MarkdownEditorFieldBinding.d.ts +3 -1
- package/dist/index.es.js +20 -16
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +19 -15
- package/dist/index.umd.js.map +1 -1
- package/package.json +5 -5
- package/src/components/HomePage/SmallNavigationCard.tsx +1 -2
- package/src/core/DefaultAppBar.tsx +1 -1
- package/src/core/EntityEditView.tsx +34 -31
- package/src/core/SideDialogs.tsx +3 -0
- package/src/form/field_bindings/MarkdownEditorFieldBinding.tsx +8 -5
- package/src/form/field_bindings/StorageUploadFieldBinding.tsx +1 -3
- package/src/hooks/data/save.ts +0 -1
- package/src/internal/useBuildSideEntityController.tsx +4 -2
- package/src/internal/useUnsavedChangesDialog.tsx +3 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@firecms/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "3.0.0-canary.
|
|
4
|
+
"version": "3.0.0-canary.110",
|
|
5
5
|
"description": "Awesome Firebase/Firestore-based headless open-source CMS",
|
|
6
6
|
"funding": {
|
|
7
7
|
"url": "https://github.com/sponsors/firecmsco"
|
|
@@ -46,9 +46,9 @@
|
|
|
46
46
|
"./package.json": "./package.json"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@firecms/editor": "^3.0.0-canary.
|
|
50
|
-
"@firecms/formex": "^3.0.0-canary.
|
|
51
|
-
"@firecms/ui": "^3.0.0-canary.
|
|
49
|
+
"@firecms/editor": "^3.0.0-canary.110",
|
|
50
|
+
"@firecms/formex": "^3.0.0-canary.110",
|
|
51
|
+
"@firecms/ui": "^3.0.0-canary.110",
|
|
52
52
|
"@hello-pangea/dnd": "^16.6.0",
|
|
53
53
|
"@radix-ui/react-portal": "^1.1.1",
|
|
54
54
|
"clsx": "^2.1.1",
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
"dist",
|
|
101
101
|
"src"
|
|
102
102
|
],
|
|
103
|
-
"gitHead": "
|
|
103
|
+
"gitHead": "24781d95e840c68233d4529ff1f36f6cdc261f95",
|
|
104
104
|
"publishConfig": {
|
|
105
105
|
"access": "public"
|
|
106
106
|
},
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ArrowForwardIcon, cardClickableMixin, cardMixin, cls,
|
|
1
|
+
import { ArrowForwardIcon, cardClickableMixin, cardMixin, cls, Typography, } from "@firecms/ui";
|
|
2
2
|
|
|
3
3
|
import { Link } from "react-router-dom";
|
|
4
4
|
|
|
@@ -21,7 +21,6 @@ export function SmallNavigationCard({
|
|
|
21
21
|
tabIndex={0}
|
|
22
22
|
className={cls(cardMixin,
|
|
23
23
|
cardClickableMixin,
|
|
24
|
-
focusedMixin,
|
|
25
24
|
"cursor-pointer flex flex-row items-center px-4 py-2 text-inherit dark:text-inherit visited:text-inherit visited:dark:text-inherit hover:text-inherit hover:dark:text-inherit ")}
|
|
26
25
|
to={url}
|
|
27
26
|
>
|
|
@@ -124,7 +124,7 @@ export const DefaultAppBar = function DefaultAppBar({
|
|
|
124
124
|
{typeof title === "string"
|
|
125
125
|
? <Typography variant="subtitle1"
|
|
126
126
|
noWrap
|
|
127
|
-
className={cls("
|
|
127
|
+
className={cls("transition-all", drawerOpen ? "ml-2" : "")}>
|
|
128
128
|
{title}
|
|
129
129
|
</Typography>
|
|
130
130
|
: title}
|
|
@@ -307,7 +307,7 @@ export function EntityEditViewInner<M extends Record<string, any>>({
|
|
|
307
307
|
sideEntityController.replace({
|
|
308
308
|
path,
|
|
309
309
|
entityId: updatedEntity.id,
|
|
310
|
-
selectedSubPath: selectedTabRef.current,
|
|
310
|
+
selectedSubPath: MAIN_TAB_VALUE === selectedTabRef.current ? undefined : selectedTabRef.current,
|
|
311
311
|
updateUrl: true,
|
|
312
312
|
collection,
|
|
313
313
|
});
|
|
@@ -884,51 +884,54 @@ export function EntityEditViewInner<M extends Record<string, any>>({
|
|
|
884
884
|
|
|
885
885
|
function buildForm() {
|
|
886
886
|
|
|
887
|
-
let form =
|
|
887
|
+
let form = <>
|
|
888
888
|
|
|
889
889
|
{pluginActions.length > 0 && <div
|
|
890
890
|
className={cls("w-full flex justify-end items-center sticky top-0 right-0 left-0 z-10 bg-opacity-60 bg-slate-200 dark:bg-opacity-60 dark:bg-slate-800 backdrop-blur-md")}>
|
|
891
891
|
{pluginActions}
|
|
892
892
|
</div>}
|
|
893
893
|
|
|
894
|
-
<div className="
|
|
895
|
-
<div
|
|
896
|
-
className={`w-full py-2 flex flex-col items-start mt-${4 + (pluginActions ? 8 : 0)} lg:mt-${8 + (pluginActions ? 8 : 0)} mb-8`}>
|
|
894
|
+
<div className="h-full overflow-auto">
|
|
897
895
|
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
896
|
+
<div className="pt-12 pb-16 pl-8 pr-8 md:pl-10 md:pr-10">
|
|
897
|
+
<div
|
|
898
|
+
className={`w-full py-2 flex flex-col items-start mt-${4 + (pluginActions ? 8 : 0)} lg:mt-${8 + (pluginActions ? 8 : 0)} mb-8`}>
|
|
899
|
+
|
|
900
|
+
<Typography
|
|
901
|
+
className={"mt-4 flex-grow line-clamp-1 " + inputCollection.hideIdFromForm ? "mb-2" : "mb-0"}
|
|
902
|
+
variant={"h4"}>{title ?? inputCollection.singularName ?? inputCollection.name}
|
|
903
|
+
</Typography>
|
|
904
|
+
<Alert color={"base"} className={"w-full"} size={"small"}>
|
|
905
|
+
<code className={"text-xs select-all"}>{path}/{entityId}</code>
|
|
906
|
+
</Alert>
|
|
907
|
+
</div>
|
|
906
908
|
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
909
|
+
{!collection.hideIdFromForm &&
|
|
910
|
+
<CustomIdField customId={inputCollection.customId}
|
|
911
|
+
entityId={entityId}
|
|
912
|
+
status={status}
|
|
913
|
+
onChange={setEntityId}
|
|
914
|
+
error={entityIdError}
|
|
915
|
+
loading={customIdLoading}
|
|
916
|
+
entity={entity}/>}
|
|
915
917
|
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
918
|
+
{entityId && formContext && <>
|
|
919
|
+
<div className="mt-12 flex flex-col gap-8"
|
|
920
|
+
ref={formRef}>
|
|
919
921
|
|
|
920
|
-
|
|
922
|
+
{formFields}
|
|
921
923
|
|
|
922
|
-
|
|
924
|
+
<ErrorFocus containerRef={formRef}/>
|
|
923
925
|
|
|
924
|
-
|
|
926
|
+
</div>
|
|
925
927
|
|
|
926
|
-
|
|
928
|
+
<div className="h-14"/>
|
|
927
929
|
|
|
928
|
-
|
|
930
|
+
</>}
|
|
929
931
|
|
|
932
|
+
</div>
|
|
930
933
|
</div>
|
|
931
|
-
|
|
934
|
+
</>;
|
|
932
935
|
|
|
933
936
|
if (plugins) {
|
|
934
937
|
plugins.forEach((plugin: FireCMSPlugin) => {
|
|
@@ -1058,7 +1061,7 @@ export function EntityEditViewInner<M extends Record<string, any>>({
|
|
|
1058
1061
|
role="tabpanel"
|
|
1059
1062
|
hidden={!mainViewVisible}
|
|
1060
1063
|
id={`form_${path}`}
|
|
1061
|
-
className={" w-full"}>
|
|
1064
|
+
className={"relative w-full"}>
|
|
1062
1065
|
|
|
1063
1066
|
{globalLoading
|
|
1064
1067
|
? <CircularProgressCenter/>
|
package/src/core/SideDialogs.tsx
CHANGED
|
@@ -94,6 +94,7 @@ function SideDialogView({
|
|
|
94
94
|
const handleDrawerCloseOk = () => {
|
|
95
95
|
setBlocked(false);
|
|
96
96
|
setDrawerCloseRequested(false);
|
|
97
|
+
console.log("handleDrawerCloseOk");
|
|
97
98
|
sideDialogsController.close();
|
|
98
99
|
panel?.onClose?.();
|
|
99
100
|
};
|
|
@@ -103,9 +104,11 @@ function SideDialogView({
|
|
|
103
104
|
};
|
|
104
105
|
|
|
105
106
|
const onCloseRequest = (force?: boolean) => {
|
|
107
|
+
console.log("onCloseRequest", blocked, force);
|
|
106
108
|
if (blocked && !force) {
|
|
107
109
|
setDrawerCloseRequested(true);
|
|
108
110
|
} else {
|
|
111
|
+
console.log("onCloseRequest closing");
|
|
109
112
|
sideDialogsController.close();
|
|
110
113
|
panel?.onClose?.();
|
|
111
114
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React, { useCallback, useEffect, useRef, useState } from "react";
|
|
1
2
|
import {
|
|
2
3
|
FieldHelperText,
|
|
3
4
|
FieldProps,
|
|
@@ -7,12 +8,12 @@ import {
|
|
|
7
8
|
useStorageSource
|
|
8
9
|
} from "../../index";
|
|
9
10
|
import { cls, fieldBackgroundHoverMixin, fieldBackgroundMixin } from "@firecms/ui";
|
|
10
|
-
import { FireCMSEditor } from "@firecms/editor";
|
|
11
|
-
import
|
|
12
|
-
import { resolveStorageFilenameString, resolveStoragePathString } from "../../util/storage";
|
|
11
|
+
import { FireCMSEditor, FireCMSEditorProps } from "@firecms/editor";
|
|
12
|
+
import { resolveStorageFilenameString, resolveStoragePathString } from "../../util";
|
|
13
13
|
|
|
14
14
|
interface MarkdownEditorFieldProps {
|
|
15
15
|
highlight?: { from: number, to: number };
|
|
16
|
+
editorProps?: Partial<FireCMSEditorProps>
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
export function MarkdownEditorFieldBinding({
|
|
@@ -27,10 +28,10 @@ export function MarkdownEditorFieldBinding({
|
|
|
27
28
|
isSubmitting,
|
|
28
29
|
context,
|
|
29
30
|
customProps,
|
|
30
|
-
...props
|
|
31
31
|
}: FieldProps<string, MarkdownEditorFieldProps>) {
|
|
32
32
|
|
|
33
33
|
const highlight = customProps?.highlight;
|
|
34
|
+
const editorProps = customProps?.editorProps;
|
|
34
35
|
const storageSource = useStorageSource();
|
|
35
36
|
const storage = property.storage;
|
|
36
37
|
|
|
@@ -108,7 +109,9 @@ export function MarkdownEditorFieldBinding({
|
|
|
108
109
|
throw new Error("Error uploading image");
|
|
109
110
|
}
|
|
110
111
|
return url;
|
|
111
|
-
}}
|
|
112
|
+
}}
|
|
113
|
+
{...editorProps}
|
|
114
|
+
/>;
|
|
112
115
|
|
|
113
116
|
if (minimalistView)
|
|
114
117
|
return editor;
|
|
@@ -16,7 +16,6 @@ import {
|
|
|
16
16
|
fieldBackgroundDisabledMixin,
|
|
17
17
|
fieldBackgroundHoverMixin,
|
|
18
18
|
fieldBackgroundMixin,
|
|
19
|
-
focusedMixin,
|
|
20
19
|
Typography
|
|
21
20
|
} from "@firecms/ui";
|
|
22
21
|
import { useClearRestoreValue } from "../useClearRestoreValue";
|
|
@@ -198,7 +197,6 @@ function FileDropComponent({
|
|
|
198
197
|
disabled ? fieldBackgroundDisabledMixin : fieldBackgroundHoverMixin,
|
|
199
198
|
dropZoneClasses,
|
|
200
199
|
multipleFilesSupported && internalValue.length ? "" : "flex",
|
|
201
|
-
focusedMixin,
|
|
202
200
|
{
|
|
203
201
|
[nonActiveDropClasses]: !isDragActive,
|
|
204
202
|
[activeDropClasses]: isDragActive,
|
|
@@ -256,7 +254,7 @@ function FileDropComponent({
|
|
|
256
254
|
ref={provided.innerRef}
|
|
257
255
|
{...provided.draggableProps}
|
|
258
256
|
{...provided.dragHandleProps}
|
|
259
|
-
className={cls(
|
|
257
|
+
className={cls("rounded-md")}
|
|
260
258
|
style={{
|
|
261
259
|
...provided.draggableProps.style
|
|
262
260
|
}}
|
package/src/hooks/data/save.ts
CHANGED
|
@@ -121,7 +121,6 @@ export async function saveEntityWithCallbacks<M extends Record<string, any>, Use
|
|
|
121
121
|
previousValues,
|
|
122
122
|
status
|
|
123
123
|
}).then((entity) => {
|
|
124
|
-
console.log("Entity saved");
|
|
125
124
|
try {
|
|
126
125
|
if (callbacks?.onSaveSuccess) {
|
|
127
126
|
const resolvedCollection = resolveCollection<M>({
|
|
@@ -2,7 +2,7 @@ import { useCallback, useEffect, useRef } from "react";
|
|
|
2
2
|
import {
|
|
3
3
|
EntityCollection,
|
|
4
4
|
EntitySidePanelProps,
|
|
5
|
-
NavigationController,
|
|
5
|
+
NavigationController,
|
|
6
6
|
ResolvedProperty,
|
|
7
7
|
SideDialogPanelProps,
|
|
8
8
|
SideDialogsController,
|
|
@@ -227,12 +227,14 @@ const propsToSidePanel = (props: EntitySidePanelProps<any>,
|
|
|
227
227
|
path: resolvedPath,
|
|
228
228
|
};
|
|
229
229
|
|
|
230
|
+
const entityViewWidth = getEntityViewWidth(props, smallLayout);
|
|
231
|
+
|
|
230
232
|
return {
|
|
231
233
|
key: `${props.path}/${props.entityId}`,
|
|
232
234
|
component: <EntitySidePanel {...resolvedPanelProps}/>,
|
|
233
235
|
urlPath: newPath,
|
|
234
236
|
parentUrlPath: buildUrlCollectionPath(collectionPath),
|
|
235
|
-
width:
|
|
237
|
+
width: entityViewWidth,
|
|
236
238
|
onClose: props.onClose
|
|
237
239
|
};
|
|
238
240
|
}
|
|
@@ -84,8 +84,10 @@ export function UnsavedChangesDialog({
|
|
|
84
84
|
|
|
85
85
|
return (
|
|
86
86
|
<Dialog
|
|
87
|
+
onEscapeKeyDown={() => {
|
|
88
|
+
handleCancel();
|
|
89
|
+
}}
|
|
87
90
|
open={open}
|
|
88
|
-
onOpenChange={(open) => open ? handleCancel() : handleOk()}
|
|
89
91
|
>
|
|
90
92
|
<DialogContent>
|
|
91
93
|
<Typography variant={"h6"}>{title}</Typography>
|