@firecms/core 3.0.0-canary.136 → 3.0.0-canary.138
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/README.md +1 -1
- package/dist/components/PropertyConfigBadge.d.ts +2 -1
- package/dist/index.es.js +49 -52
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +50 -53
- package/dist/index.umd.js.map +1 -1
- package/dist/types/property_config.d.ts +0 -2
- package/dist/util/resolutions.d.ts +6 -6
- package/package.json +5 -5
- package/src/app/Scaffold.tsx +3 -4
- package/src/components/DeleteEntityDialog.tsx +1 -1
- package/src/components/EntityCollectionTable/internal/popup_field/PopupFormField.tsx +1 -1
- package/src/components/EntityCollectionView/EntityCollectionView.tsx +2 -2
- package/src/components/EntityPreview.tsx +1 -1
- package/src/components/EntityView.tsx +1 -1
- package/src/components/PropertyConfigBadge.tsx +9 -3
- package/src/components/ReferenceTable/ReferenceSelectionTable.tsx +1 -2
- package/src/components/common/default_entity_actions.tsx +2 -2
- package/src/core/DefaultAppBar.tsx +69 -73
- package/src/core/EntityEditView.tsx +4 -4
- package/src/core/FireCMS.tsx +1 -4
- package/src/form/PropertyFieldBinding.tsx +2 -2
- package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +0 -1
- package/src/hooks/data/save.ts +3 -3
- package/src/internal/useBuildDataSource.ts +1 -1
- package/src/preview/PropertyPreview.tsx +1 -1
- package/src/preview/components/ImagePreview.tsx +2 -2
- package/src/preview/property_previews/ArrayOfMapsPreview.tsx +1 -1
- package/src/preview/property_previews/ArrayOfReferencesPreview.tsx +1 -1
- package/src/preview/property_previews/ArrayOfStorageComponentsPreview.tsx +1 -1
- package/src/preview/property_previews/ArrayOfStringsPreview.tsx +1 -1
- package/src/preview/property_previews/ArrayOneOfPreview.tsx +1 -1
- package/src/preview/property_previews/ArrayPropertyPreview.tsx +1 -1
- package/src/types/property_config.tsx +0 -2
- package/src/util/property_utils.tsx +1 -1
- package/src/util/resolutions.ts +8 -8
|
@@ -19,8 +19,6 @@ export type PropertyConfig<T extends CMSType = any> = {
|
|
|
19
19
|
* Default config for the property.
|
|
20
20
|
* This property or builder will be used as the base values for the resulting property.
|
|
21
21
|
* You can also use a builder function to generate the base property.
|
|
22
|
-
* You can use a builder function to generate the property based on the values or the path.
|
|
23
|
-
* You can also define a custom Field as a React component to be used for this property.
|
|
24
22
|
*/
|
|
25
23
|
property: PropertyOrBuilder<T>;
|
|
26
24
|
/**
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { ArrayProperty, CMSType, EntityCollection, EntityCustomView, EntityValues, EnumValueConfig, EnumValues, NumberProperty, PropertiesOrBuilders, PropertyConfig, PropertyOrBuilder, ResolvedArrayProperty, ResolvedEntityCollection, ResolvedNumberProperty, ResolvedProperties, ResolvedProperty, ResolvedStringProperty, StringProperty, UserConfigurationPersistence } from "../types";
|
|
2
|
-
export declare const resolveCollection: <M extends Record<string, any>>({ collection, path, entityId, values, previousValues, userConfigPersistence,
|
|
2
|
+
export declare const resolveCollection: <M extends Record<string, any>>({ collection, path, entityId, values, previousValues, userConfigPersistence, propertyConfigs, ignoreMissingFields }: {
|
|
3
3
|
collection: EntityCollection<M> | ResolvedEntityCollection<M>;
|
|
4
4
|
path: string;
|
|
5
5
|
entityId?: string;
|
|
6
6
|
values?: Partial<EntityValues<M>>;
|
|
7
7
|
previousValues?: Partial<EntityValues<M>>;
|
|
8
8
|
userConfigPersistence?: UserConfigurationPersistence;
|
|
9
|
-
|
|
9
|
+
propertyConfigs?: Record<string, PropertyConfig>;
|
|
10
10
|
ignoreMissingFields?: boolean;
|
|
11
11
|
}) => ResolvedEntityCollection<M>;
|
|
12
12
|
/**
|
|
@@ -23,7 +23,7 @@ export declare function resolveProperty<T extends CMSType = CMSType, M extends R
|
|
|
23
23
|
entityId?: string;
|
|
24
24
|
index?: number;
|
|
25
25
|
fromBuilder?: boolean;
|
|
26
|
-
|
|
26
|
+
propertyConfigs?: Record<string, PropertyConfig<any>>;
|
|
27
27
|
ignoreMissingFields?: boolean;
|
|
28
28
|
}): ResolvedProperty<T> | null;
|
|
29
29
|
export declare function getArrayResolvedProperties<M>({ propertyKey, propertyValue, property, ...props }: {
|
|
@@ -37,7 +37,7 @@ export declare function getArrayResolvedProperties<M>({ propertyKey, propertyVal
|
|
|
37
37
|
entityId?: string;
|
|
38
38
|
index?: number;
|
|
39
39
|
fromBuilder?: boolean;
|
|
40
|
-
|
|
40
|
+
propertyConfigs?: Record<string, PropertyConfig>;
|
|
41
41
|
}): ResolvedProperty[];
|
|
42
42
|
export declare function resolveArrayProperty<T extends any[], M>({ propertyKey, property, ignoreMissingFields, ...props }: {
|
|
43
43
|
propertyKey?: string;
|
|
@@ -48,7 +48,7 @@ export declare function resolveArrayProperty<T extends any[], M>({ propertyKey,
|
|
|
48
48
|
entityId?: string;
|
|
49
49
|
index?: number;
|
|
50
50
|
fromBuilder?: boolean;
|
|
51
|
-
|
|
51
|
+
propertyConfigs?: Record<string, PropertyConfig>;
|
|
52
52
|
ignoreMissingFields?: boolean;
|
|
53
53
|
}): ResolvedArrayProperty;
|
|
54
54
|
/**
|
|
@@ -65,7 +65,7 @@ export declare function resolveProperties<M extends Record<string, any>>({ prope
|
|
|
65
65
|
entityId?: string;
|
|
66
66
|
index?: number;
|
|
67
67
|
fromBuilder?: boolean;
|
|
68
|
-
|
|
68
|
+
propertyConfigs?: Record<string, PropertyConfig>;
|
|
69
69
|
ignoreMissingFields?: boolean;
|
|
70
70
|
}): ResolvedProperties<M>;
|
|
71
71
|
/**
|
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.138",
|
|
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.138",
|
|
50
|
+
"@firecms/formex": "^3.0.0-canary.138",
|
|
51
|
+
"@firecms/ui": "^3.0.0-canary.138",
|
|
52
52
|
"@hello-pangea/dnd": "^17.0.0",
|
|
53
53
|
"@radix-ui/react-portal": "^1.1.2",
|
|
54
54
|
"clsx": "^2.1.1",
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
"dist",
|
|
101
101
|
"src"
|
|
102
102
|
],
|
|
103
|
-
"gitHead": "
|
|
103
|
+
"gitHead": "055055d2b116aa0a4dfd6252cd3f0e9da323770a",
|
|
104
104
|
"publishConfig": {
|
|
105
105
|
"access": "public"
|
|
106
106
|
},
|
package/src/app/Scaffold.tsx
CHANGED
|
@@ -137,7 +137,7 @@ export const Scaffold = React.memo<PropsWithChildren<ScaffoldProps>>(
|
|
|
137
137
|
|
|
138
138
|
const DrawerHeader = () => {
|
|
139
139
|
return (
|
|
140
|
-
<div className="flex flex-col min-h-
|
|
140
|
+
<div className="flex flex-col min-h-16"></div>
|
|
141
141
|
);
|
|
142
142
|
};
|
|
143
143
|
|
|
@@ -168,11 +168,10 @@ function DrawerWrapper(props: {
|
|
|
168
168
|
sideOffset={12}
|
|
169
169
|
asChild={true}>
|
|
170
170
|
<div
|
|
171
|
-
className="ml-2 fixed top-2 left-3 !bg-gray-50 dark:!bg-gray-900 rounded-full w-fit z-20">
|
|
171
|
+
className="ml-2 fixed top-1 left-2 sm:top-2 sm:left-3 !bg-gray-50 dark:!bg-gray-900 rounded-full w-fit z-20">
|
|
172
172
|
<IconButton
|
|
173
173
|
color="inherit"
|
|
174
174
|
aria-label="Open menu"
|
|
175
|
-
className="sticky top-2 left-3 "
|
|
176
175
|
onClick={() => props.setDrawerOpen(true)}
|
|
177
176
|
size="large"
|
|
178
177
|
>
|
|
@@ -210,7 +209,7 @@ function DrawerWrapper(props: {
|
|
|
210
209
|
aria-label="Open drawer"
|
|
211
210
|
onClick={() => props.setDrawerOpen(true)}
|
|
212
211
|
size="large"
|
|
213
|
-
className="absolute top-2 left-5"
|
|
212
|
+
className="absolute sm:top-2 sm:left-5 top-1 left-2"
|
|
214
213
|
>
|
|
215
214
|
<MenuIcon/>
|
|
216
215
|
</IconButton>
|
|
@@ -58,7 +58,7 @@ export function DeleteEntityDialog<M extends Record<string, any>>({
|
|
|
58
58
|
const resolvedCollection = useMemo(() => resolveCollection<M>({
|
|
59
59
|
collection,
|
|
60
60
|
path,
|
|
61
|
-
|
|
61
|
+
propertyConfigs: customizationController.propertyConfigs
|
|
62
62
|
}), [collection, path]);
|
|
63
63
|
|
|
64
64
|
const handleCancel = useCallback(() => {
|
|
@@ -101,7 +101,7 @@ export function PopupFormFieldInternal<M extends Record<string, any>>({
|
|
|
101
101
|
path,
|
|
102
102
|
values: internalValue,
|
|
103
103
|
entityId,
|
|
104
|
-
|
|
104
|
+
propertyConfigs: customizationController.propertyConfigs
|
|
105
105
|
})
|
|
106
106
|
: undefined;
|
|
107
107
|
|
|
@@ -353,7 +353,7 @@ export const EntityCollectionView = React.memo(
|
|
|
353
353
|
const resolvedCollection = useMemo(() => resolveCollection<M>({
|
|
354
354
|
collection,
|
|
355
355
|
path: fullPath,
|
|
356
|
-
|
|
356
|
+
propertyConfigs: customizationController.propertyConfigs
|
|
357
357
|
}), [collection, fullPath]);
|
|
358
358
|
|
|
359
359
|
const getPropertyFor = useCallback(({
|
|
@@ -374,7 +374,7 @@ export const EntityCollectionView = React.memo(
|
|
|
374
374
|
path: entity.path,
|
|
375
375
|
values: entity.values,
|
|
376
376
|
entityId: entity.id,
|
|
377
|
-
|
|
377
|
+
propertyConfigs: customizationController.propertyConfigs
|
|
378
378
|
});
|
|
379
379
|
}, [collection.properties, customizationController.propertyConfigs, resolvedCollection.properties]);
|
|
380
380
|
|
|
@@ -62,7 +62,7 @@ export function EntityPreview({
|
|
|
62
62
|
collection,
|
|
63
63
|
path: entity.path,
|
|
64
64
|
values: entity.values,
|
|
65
|
-
|
|
65
|
+
propertyConfigs: customizationController.propertyConfigs
|
|
66
66
|
}), [collection]);
|
|
67
67
|
|
|
68
68
|
const listProperties = useMemo(() => getEntityPreviewKeys(resolvedCollection, customizationController.propertyConfigs, previewProperties, size === "small" || size === "medium" ? 3 : 1),
|
|
@@ -30,7 +30,7 @@ export function EntityView<M extends Record<string, any>>(
|
|
|
30
30
|
path,
|
|
31
31
|
entityId: entity.id,
|
|
32
32
|
values: entity.values,
|
|
33
|
-
|
|
33
|
+
propertyConfigs: customizationController.propertyConfigs
|
|
34
34
|
}), [collection, path, entity, customizationController.propertyConfigs]);
|
|
35
35
|
|
|
36
36
|
const properties: ResolvedProperties = resolvedCollection.properties;
|
|
@@ -2,15 +2,21 @@ import { getIconForWidget } from "../util";
|
|
|
2
2
|
import { PropertyConfig } from "../types";
|
|
3
3
|
import { getDefaultFieldConfig } from "../core";
|
|
4
4
|
|
|
5
|
-
export function PropertyConfigBadge({
|
|
6
|
-
|
|
5
|
+
export function PropertyConfigBadge({
|
|
6
|
+
propertyConfig,
|
|
7
|
+
disabled
|
|
8
|
+
}: {
|
|
9
|
+
propertyConfig: PropertyConfig | undefined,
|
|
10
|
+
disabled?: boolean
|
|
11
|
+
}): React.ReactNode {
|
|
12
|
+
const classes = "h-8 w-8 p-1 rounded-full shadow text-white " + (disabled ? "bg-gray-400 dark:bg-gray-600" : "");
|
|
7
13
|
|
|
8
14
|
const defaultPropertyConfig = typeof propertyConfig?.property === "object" ? getDefaultFieldConfig(propertyConfig.property) : undefined;
|
|
9
15
|
|
|
10
16
|
return <div
|
|
11
17
|
className={classes}
|
|
12
18
|
style={{
|
|
13
|
-
background: propertyConfig?.color ?? defaultPropertyConfig?.color ?? "#888"
|
|
19
|
+
background: !disabled ? (propertyConfig?.color ?? defaultPropertyConfig?.color ?? "#888") : undefined
|
|
14
20
|
}}>
|
|
15
21
|
{propertyConfig?.Icon ? getIconForWidget(propertyConfig, "medium") : getIconForWidget(defaultPropertyConfig, "medium")}
|
|
16
22
|
</div>
|
|
@@ -109,7 +109,6 @@ export function ReferenceSelectionTable<M extends Record<string, any>>(
|
|
|
109
109
|
|
|
110
110
|
const fullPath = navigation.resolveAliasesFrom(pathInput);
|
|
111
111
|
|
|
112
|
-
console.trace("Opening reference dialog for path " + fullPath);
|
|
113
112
|
const dataSource = useDataSource(collection);
|
|
114
113
|
|
|
115
114
|
const [entitiesDisplayedFirst, setEntitiesDisplayedFirst] = useState<Entity<any>[]>([]);
|
|
@@ -252,7 +251,7 @@ export function ReferenceSelectionTable<M extends Record<string, any>>(
|
|
|
252
251
|
collection: collection,
|
|
253
252
|
path: fullPath,
|
|
254
253
|
values: {},
|
|
255
|
-
|
|
254
|
+
propertyConfigs: customizationController.propertyConfigs
|
|
256
255
|
}), [collection, customizationController.propertyConfigs, fullPath]);
|
|
257
256
|
|
|
258
257
|
const displayedColumnIds = useColumnIds(resolvedCollection, false);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { ArchiveIcon, DeleteIcon,
|
|
1
|
+
import { ArchiveIcon, DeleteIcon, EditIcon, FileCopyIcon, OpenInNewIcon } from "@firecms/ui";
|
|
2
2
|
import { EntityAction } from "../../types";
|
|
3
3
|
import { DeleteEntityDialog } from "../DeleteEntityDialog";
|
|
4
4
|
import { addRecentId } from "../EntityCollectionView/utils";
|
|
5
5
|
|
|
6
6
|
export const editEntityAction: EntityAction = {
|
|
7
|
-
icon: <
|
|
7
|
+
icon: <EditIcon/>,
|
|
8
8
|
name: "Edit",
|
|
9
9
|
collapsed: false,
|
|
10
10
|
onClick({
|
|
@@ -95,86 +95,82 @@ export const DefaultAppBar = function DefaultAppBar({
|
|
|
95
95
|
return (
|
|
96
96
|
<div
|
|
97
97
|
style={style}
|
|
98
|
-
className={cls("w-full h-16 transition-all ease-in duration-75
|
|
98
|
+
className={cls("w-full h-16 transition-all ease-in duration-75 absolute top-0 max-w-full overflow-x-auto no-scrollbar",
|
|
99
|
+
"flex flex-row gap-2 px-4 items-center",
|
|
99
100
|
{
|
|
100
|
-
"pl-[
|
|
101
|
-
"pl-
|
|
101
|
+
"pl-[19rem]": drawerOpen && largeLayout,
|
|
102
|
+
"pl-24": hasDrawer && !(drawerOpen && largeLayout),
|
|
102
103
|
"z-10": largeLayout,
|
|
103
|
-
|
|
104
|
-
// "w-[calc(100%-64px)]": hasDrawer && !(drawerOpen && largeLayout),
|
|
105
|
-
// "w-[calc(100%-17rem)]": hasDrawer && (drawerOpen && largeLayout),
|
|
106
|
-
"duration-150": drawerOpen && largeLayout,
|
|
104
|
+
"duration-100": drawerOpen && largeLayout,
|
|
107
105
|
},
|
|
108
106
|
className)}>
|
|
109
107
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
>
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
108
|
+
|
|
109
|
+
{navigation && <div className="mr-8 hidden lg:block">
|
|
110
|
+
<ReactLink
|
|
111
|
+
className="visited:text-inherit visited:dark:text-inherit"
|
|
112
|
+
to={navigation?.basePath ?? "/"}
|
|
113
|
+
>
|
|
114
|
+
<div className={"flex flex-row gap-4"}>
|
|
115
|
+
{!hasDrawer && (logo
|
|
116
|
+
? <img src={logo}
|
|
117
|
+
alt="Logo"
|
|
118
|
+
className={cls("w-[32px] h-[32px] object-contain")}/>
|
|
119
|
+
: <FireCMSLogo width={"32px"} height={"32px"}/>)}
|
|
120
|
+
|
|
121
|
+
{typeof title === "string"
|
|
122
|
+
? <Typography variant="subtitle1"
|
|
123
|
+
noWrap
|
|
124
|
+
className={cls("transition-all", drawerOpen ? "ml-2" : "")}>
|
|
125
|
+
{title}
|
|
126
|
+
</Typography>
|
|
127
|
+
: title}
|
|
128
|
+
</div>
|
|
129
|
+
</ReactLink>
|
|
130
|
+
</div>}
|
|
131
|
+
|
|
132
|
+
{startAdornment}
|
|
133
|
+
|
|
134
|
+
<div className={"flex-grow"}/>
|
|
135
|
+
|
|
136
|
+
{endAdornment &&
|
|
137
|
+
<ErrorBoundary>
|
|
138
|
+
{endAdornment}
|
|
139
|
+
</ErrorBoundary>}
|
|
140
|
+
|
|
141
|
+
{includeModeToggle && <IconButton
|
|
142
|
+
color="inherit"
|
|
143
|
+
aria-label="Open drawer"
|
|
144
|
+
onClick={toggleMode}
|
|
145
|
+
size="large">
|
|
146
|
+
{mode === "dark"
|
|
147
|
+
? <DarkModeIcon/>
|
|
148
|
+
: <LightModeIcon/>}
|
|
149
|
+
</IconButton>}
|
|
150
|
+
|
|
151
|
+
<Menu trigger={avatarComponent}>
|
|
152
|
+
{user && <div className={"px-4 py-2 mb-2"}>
|
|
153
|
+
{user.displayName && <Typography variant={"body1"} color={"secondary"}>
|
|
154
|
+
{user.displayName}
|
|
155
|
+
</Typography>}
|
|
156
|
+
{user.email && <Typography variant={"body2"} color={"secondary"}>
|
|
157
|
+
{user.email}
|
|
158
|
+
</Typography>}
|
|
133
159
|
</div>}
|
|
134
160
|
|
|
135
|
-
{
|
|
136
|
-
|
|
137
|
-
<
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
size="large">
|
|
149
|
-
{mode === "dark"
|
|
150
|
-
? <DarkModeIcon/>
|
|
151
|
-
: <LightModeIcon/>}
|
|
152
|
-
</IconButton>}
|
|
153
|
-
|
|
154
|
-
<Menu trigger={avatarComponent}>
|
|
155
|
-
{user && <div className={"px-4 py-2 mb-2"}>
|
|
156
|
-
{user.displayName && <Typography variant={"body1"} color={"secondary"}>
|
|
157
|
-
{user.displayName}
|
|
158
|
-
</Typography>}
|
|
159
|
-
{user.email && <Typography variant={"body2"} color={"secondary"}>
|
|
160
|
-
{user.email}
|
|
161
|
-
</Typography>}
|
|
162
|
-
</div>}
|
|
163
|
-
|
|
164
|
-
{dropDownActions}
|
|
165
|
-
|
|
166
|
-
{!dropDownActions && <MenuItem onClick={async () => {
|
|
167
|
-
await authController.signOut();
|
|
168
|
-
// replace current route with home
|
|
169
|
-
navigate("/");
|
|
170
|
-
}}>
|
|
171
|
-
<LogoutIcon/>
|
|
172
|
-
Log Out
|
|
173
|
-
</MenuItem>}
|
|
174
|
-
|
|
175
|
-
</Menu>
|
|
176
|
-
|
|
177
|
-
</div>
|
|
161
|
+
{dropDownActions}
|
|
162
|
+
|
|
163
|
+
{!dropDownActions && <MenuItem onClick={async () => {
|
|
164
|
+
await authController.signOut();
|
|
165
|
+
// replace current route with home
|
|
166
|
+
navigate("/");
|
|
167
|
+
}}>
|
|
168
|
+
<LogoutIcon/>
|
|
169
|
+
Log Out
|
|
170
|
+
</MenuItem>}
|
|
171
|
+
|
|
172
|
+
</Menu>
|
|
173
|
+
|
|
178
174
|
</div>
|
|
179
175
|
);
|
|
180
176
|
}
|
|
@@ -185,7 +185,7 @@ export function EntityEditViewInner<M extends Record<string, any>>({
|
|
|
185
185
|
collection: inputCollection,
|
|
186
186
|
path,
|
|
187
187
|
values: entity?.values,
|
|
188
|
-
|
|
188
|
+
propertyConfigs: customizationController.propertyConfigs
|
|
189
189
|
}), [entity?.values, path, customizationController.propertyConfigs]);
|
|
190
190
|
|
|
191
191
|
const initialStatus = copy ? "copy" : (entityIdProp ? "existing" : "new");
|
|
@@ -446,7 +446,7 @@ export function EntityEditViewInner<M extends Record<string, any>>({
|
|
|
446
446
|
entityId,
|
|
447
447
|
values: formex.values,
|
|
448
448
|
previousValues: formex.initialValues,
|
|
449
|
-
|
|
449
|
+
propertyConfigs: customizationController.propertyConfigs
|
|
450
450
|
});
|
|
451
451
|
|
|
452
452
|
const lastSavedValues = useRef<EntityValues<M> | undefined>(entity?.values);
|
|
@@ -659,7 +659,7 @@ export function EntityEditViewInner<M extends Record<string, any>>({
|
|
|
659
659
|
});
|
|
660
660
|
setEntityId(updatedId);
|
|
661
661
|
} catch (e) {
|
|
662
|
-
onIdUpdateError
|
|
662
|
+
onIdUpdateError?.(e);
|
|
663
663
|
console.error(e);
|
|
664
664
|
}
|
|
665
665
|
setCustomIdLoading(false);
|
|
@@ -894,7 +894,7 @@ export function EntityEditViewInner<M extends Record<string, any>>({
|
|
|
894
894
|
|
|
895
895
|
<div className="h-full overflow-auto">
|
|
896
896
|
|
|
897
|
-
<div className="pt-12 pb-16 pl-
|
|
897
|
+
<div className="pt-12 pb-16 pl-4 sm:px-8 md:px-10">
|
|
898
898
|
<div
|
|
899
899
|
className={`w-full py-2 flex flex-col items-start mt-${4 + (pluginActions ? 8 : 0)} lg:mt-${8 + (pluginActions ? 8 : 0)} mb-8`}>
|
|
900
900
|
|
package/src/core/FireCMS.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useMemo } from "react";
|
|
2
|
-
|
|
2
|
+
import { CenteredView, Typography } from "@firecms/ui";
|
|
3
3
|
import { CustomizationController, EntityCollection, FireCMSContext, FireCMSPlugin, FireCMSProps, User } from "../types";
|
|
4
4
|
import { AuthControllerContext } from "../contexts";
|
|
5
5
|
import { useBuildSideEntityController } from "../internal/useBuildSideEntityController";
|
|
@@ -12,7 +12,6 @@ import { DataSourceContext } from "../contexts/DataSourceContext";
|
|
|
12
12
|
import { SideEntityControllerContext } from "../contexts/SideEntityControllerContext";
|
|
13
13
|
import { NavigationContext } from "../contexts/NavigationContext";
|
|
14
14
|
import { SideDialogsControllerContext } from "../contexts/SideDialogsControllerContext";
|
|
15
|
-
import { CenteredView, Typography, useLocaleConfig } from "@firecms/ui";
|
|
16
15
|
import { DialogsProvider } from "../contexts/DialogsProvider";
|
|
17
16
|
import { useBuildDataSource } from "../internal/useBuildDataSource";
|
|
18
17
|
import { CustomizationControllerContext } from "../contexts/CustomizationControllerContext";
|
|
@@ -51,8 +50,6 @@ export function FireCMS<UserType extends User, EC extends EntityCollection>(prop
|
|
|
51
50
|
apiKey
|
|
52
51
|
} = props;
|
|
53
52
|
|
|
54
|
-
useLocaleConfig(locale);
|
|
55
|
-
|
|
56
53
|
/**
|
|
57
54
|
* Controller in charge of fetching and persisting data
|
|
58
55
|
*/
|
|
@@ -105,7 +105,7 @@ function PropertyFieldBindingInternal<T extends CMSType = CMSType, M extends Rec
|
|
|
105
105
|
values: fieldProps.form.values,
|
|
106
106
|
path: context.path,
|
|
107
107
|
entityId: context.entityId,
|
|
108
|
-
|
|
108
|
+
propertyConfigs: customizationController.propertyConfigs,
|
|
109
109
|
index
|
|
110
110
|
});
|
|
111
111
|
|
|
@@ -134,7 +134,7 @@ function PropertyFieldBindingInternal<T extends CMSType = CMSType, M extends Rec
|
|
|
134
134
|
values: fieldProps.form.values,
|
|
135
135
|
path: context.path,
|
|
136
136
|
entityId: context.entityId,
|
|
137
|
-
|
|
137
|
+
propertyConfigs: customizationController.propertyConfigs,
|
|
138
138
|
index
|
|
139
139
|
});
|
|
140
140
|
Component = configProperty.Field as ComponentType<FieldProps<T>>;
|
|
@@ -56,7 +56,6 @@ export function ArrayOfReferencesFieldBinding({
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
const onMultipleEntitiesSelected = useCallback((entities: Entity<any>[]) => {
|
|
59
|
-
console.debug("onMultipleEntitiesSelected", entities);
|
|
60
59
|
setValue(entities.map(e => getReferenceFrom(e)));
|
|
61
60
|
}, [setValue]);
|
|
62
61
|
|
package/src/hooks/data/save.ts
CHANGED
|
@@ -86,7 +86,7 @@ export async function saveEntityWithCallbacks<M extends Record<string, any>, Use
|
|
|
86
86
|
path,
|
|
87
87
|
values: previousValues as EntityValues<M>,
|
|
88
88
|
entityId,
|
|
89
|
-
|
|
89
|
+
propertyConfigs: customizationController.propertyConfigs
|
|
90
90
|
});
|
|
91
91
|
updatedValues = await callbacks.onPreSave({
|
|
92
92
|
collection: resolvedCollection,
|
|
@@ -128,7 +128,7 @@ export async function saveEntityWithCallbacks<M extends Record<string, any>, Use
|
|
|
128
128
|
path,
|
|
129
129
|
values: updatedValues as EntityValues<M>,
|
|
130
130
|
entityId,
|
|
131
|
-
|
|
131
|
+
propertyConfigs: customizationController.propertyConfigs
|
|
132
132
|
});
|
|
133
133
|
callbacks.onSaveSuccess({
|
|
134
134
|
collection: resolvedCollection,
|
|
@@ -157,7 +157,7 @@ export async function saveEntityWithCallbacks<M extends Record<string, any>, Use
|
|
|
157
157
|
path,
|
|
158
158
|
values: updatedValues as EntityValues<M>,
|
|
159
159
|
entityId,
|
|
160
|
-
|
|
160
|
+
propertyConfigs: customizationController.propertyConfigs
|
|
161
161
|
});
|
|
162
162
|
callbacks.onSaveFailure({
|
|
163
163
|
collection: resolvedCollection,
|
|
@@ -53,7 +53,7 @@ export const PropertyPreview = React.memo(function PropertyPreview<T extends CMS
|
|
|
53
53
|
const property = resolveProperty({
|
|
54
54
|
propertyKey,
|
|
55
55
|
propertyOrBuilder: inputProperty,
|
|
56
|
-
|
|
56
|
+
propertyConfigs: customizationController.propertyConfigs
|
|
57
57
|
});
|
|
58
58
|
|
|
59
59
|
if (value === undefined || property === null) {
|
|
@@ -70,7 +70,7 @@ export function ImagePreview({
|
|
|
70
70
|
return navigator.clipboard.writeText(url);
|
|
71
71
|
}}>
|
|
72
72
|
<ContentCopyIcon className={"text-gray-700 dark:text-gray-300"}
|
|
73
|
-
size={"
|
|
73
|
+
size={"smallest"}/>
|
|
74
74
|
</IconButton>
|
|
75
75
|
</Tooltip>}
|
|
76
76
|
|
|
@@ -86,7 +86,7 @@ export function ImagePreview({
|
|
|
86
86
|
onClick={(e: any) => e.stopPropagation()}
|
|
87
87
|
>
|
|
88
88
|
<OpenInNewIcon className={"text-gray-700 dark:text-gray-300"}
|
|
89
|
-
size={"
|
|
89
|
+
size={"smallest"}/>
|
|
90
90
|
</IconButton>
|
|
91
91
|
</Tooltip>
|
|
92
92
|
</div>
|
|
@@ -20,7 +20,7 @@ export function ArrayOfMapsPreview({
|
|
|
20
20
|
const property = resolveArrayProperty({
|
|
21
21
|
propertyKey,
|
|
22
22
|
property: inputProperty,
|
|
23
|
-
|
|
23
|
+
propertyConfigs: customizationController.propertyConfigs
|
|
24
24
|
});
|
|
25
25
|
|
|
26
26
|
if (Array.isArray(property?.of)) {
|
|
@@ -18,7 +18,7 @@ export function ArrayOfReferencesPreview({
|
|
|
18
18
|
const property = resolveArrayProperty({
|
|
19
19
|
propertyKey,
|
|
20
20
|
property: inputProperty,
|
|
21
|
-
|
|
21
|
+
propertyConfigs: customizationController.propertyConfigs
|
|
22
22
|
});
|
|
23
23
|
|
|
24
24
|
if (Array.isArray(property?.of)) {
|
|
@@ -23,7 +23,7 @@ export function ArrayOfStorageComponentsPreview({
|
|
|
23
23
|
const property = resolveArrayProperty({
|
|
24
24
|
propertyKey,
|
|
25
25
|
property: inputProperty,
|
|
26
|
-
|
|
26
|
+
propertyConfigs: customizationController.propertyConfigs
|
|
27
27
|
});
|
|
28
28
|
|
|
29
29
|
if (Array.isArray(property.of)) {
|
|
@@ -21,7 +21,7 @@ export function ArrayOfStringsPreview({
|
|
|
21
21
|
const property = resolveArrayProperty({
|
|
22
22
|
propertyKey,
|
|
23
23
|
property: inputProperty,
|
|
24
|
-
|
|
24
|
+
propertyConfigs: customizationController.propertyConfigs
|
|
25
25
|
});
|
|
26
26
|
|
|
27
27
|
if (Array.isArray(property.of)) {
|
|
@@ -23,7 +23,7 @@ export function ArrayOneOfPreview({
|
|
|
23
23
|
const property = resolveArrayProperty({
|
|
24
24
|
propertyKey,
|
|
25
25
|
property: inputProperty,
|
|
26
|
-
|
|
26
|
+
propertyConfigs: customizationController.propertyConfigs
|
|
27
27
|
});
|
|
28
28
|
|
|
29
29
|
if (property?.dataType !== "array")
|
|
@@ -23,7 +23,7 @@ export function ArrayPropertyPreview({
|
|
|
23
23
|
const property = resolveArrayProperty({
|
|
24
24
|
propertyKey,
|
|
25
25
|
property: inputProperty,
|
|
26
|
-
|
|
26
|
+
propertyConfigs: customizationController.propertyConfigs
|
|
27
27
|
});
|
|
28
28
|
|
|
29
29
|
if (!property.of) {
|
|
@@ -23,8 +23,6 @@ export type PropertyConfig<T extends CMSType = any> = {
|
|
|
23
23
|
* Default config for the property.
|
|
24
24
|
* This property or builder will be used as the base values for the resulting property.
|
|
25
25
|
* You can also use a builder function to generate the base property.
|
|
26
|
-
* You can use a builder function to generate the property based on the values or the path.
|
|
27
|
-
* You can also define a custom Field as a React component to be used for this property.
|
|
28
26
|
*/
|
|
29
27
|
property: PropertyOrBuilder<T>;
|
|
30
28
|
|
|
@@ -11,7 +11,7 @@ export function isReferenceProperty(propertyOrBuilder: PropertyOrBuilder,
|
|
|
11
11
|
const resolvedProperty = resolveProperty({
|
|
12
12
|
propertyKey: "ignore", // TODO
|
|
13
13
|
propertyOrBuilder,
|
|
14
|
-
fields
|
|
14
|
+
propertyConfigs: fields
|
|
15
15
|
});
|
|
16
16
|
if (!resolvedProperty) return null;
|
|
17
17
|
if (resolvedProperty.dataType === "reference") {
|